"use strict";(globalThis.webpackChunk_affine_web=globalThis.webpackChunk_affine_web||[]).push([[4810],{23725:(e,t,i)=>{var s,o,r,a;i.d(t,{$2o:()=>t2,$oz:()=>eT,A1x:()=>ev,BQZ:()=>tf,BfH:()=>tk,C9h:()=>tK,CIh:()=>tG,CVU:()=>eb,CbU:()=>tA,EIO:()=>tr,EW9:()=>tX,Ea5:()=>eH,FHP:()=>tT,FYP:()=>tE,FlE:()=>ip,Fzz:()=>eM,H0W:()=>th,HNH:()=>ts,HNp:()=>tS,I5t:()=>eV,IDF:()=>e4,ITz:()=>eA,JQk:()=>tW,JmJ:()=>ta,Jps:()=>e_,JvT:()=>tn,K3f:()=>e8,KRn:()=>eL,L0c:()=>id,Lfm:()=>t_,M80:()=>tc,N$i:()=>ic,N0f:()=>t6,NAP:()=>tY,Nrq:()=>tm,O4E:()=>tt,OSm:()=>ii,OTM:()=>ek,P$Z:()=>eq,PHA:()=>tZ,PtA:()=>eI,QGg:()=>tB,QlO:()=>ez,Qol:()=>tI,RGD:()=>te,RyS:()=>eP,S1N:()=>it,SAc:()=>ew,SBc:()=>ef,SoJ:()=>tg,Syo:()=>eD,TXg:()=>ty,TdU:()=>eN,Tje:()=>ey,USm:()=>eZ,Uhd:()=>iy,Ui8:()=>iu,Upg:()=>il,VNq:()=>ih,VQ$:()=>tq,Vrn:()=>eE,Vx1:()=>ia,WFt:()=>t8,WIv:()=>tJ,WXD:()=>tv,Xnc:()=>is,Y2f:()=>eh,YlR:()=>e9,Z$r:()=>tw,Zes:()=>t0,_GB:()=>t5,_PQ:()=>iv,aJy:()=>ep,aiU:()=>tO,b8b:()=>tQ,c11:()=>tF,cAq:()=>ie,cEz:()=>eS,cFS:()=>tN,cFy:()=>eO,cqr:()=>iC,cyP:()=>t4,cyi:()=>tU,d$q:()=>eJ,d7y:()=>eX,dHM:()=>t3,e9L:()=>eQ,eoT:()=>eB,eqL:()=>e2,fFF:()=>e1,gZg:()=>tD,hhC:()=>tP,jNK:()=>t$,jNf:()=>tp,jaP:()=>e3,kjd:()=>t9,kqb:()=>eR,l88:()=>td,lL2:()=>eU,loI:()=>ej,mK9:()=>tl,ma5:()=>tb,mib:()=>em,mjz:()=>tL,n7i:()=>eg,nFg:()=>tu,njB:()=>ti,o7e:()=>im,oik:()=>ex,qUP:()=>e6,qYV:()=>tM,rWB:()=>ir,rZj:()=>tR,s3U:()=>e5,t5Y:()=>t7,t5i:()=>ig,tCQ:()=>iw,tE0:()=>tH,tPq:()=>e$,u20:()=>ix,uYI:()=>eu,ucD:()=>eK,v1n:()=>tV,vKo:()=>eY,v_L:()=>tj,vbr:()=>to,vrT:()=>tz,w$A:()=>i_,w4L:()=>e7,wBL:()=>t1,ws:()=>eW,xPL:()=>ib,xfq:()=>tx,y3_:()=>eG,yOR:()=>tC,zII:()=>eC,zPo:()=>eF,za1:()=>e0,ziP:()=>io});/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */let n=window,l=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,c=Symbol(),d=new WeakMap,h=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==c)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(l&&void 0===e){let i=void 0!==t&&1===t.length;i&&(e=d.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&d.set(t,e))}return e}toString(){return this.cssText}},u=e=>new h("string"==typeof e?e:e+"",void 0,c),p=(e,t)=>{l?e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(t=>{let i=document.createElement("style"),s=n.litNonce;void 0!==s&&i.setAttribute("nonce",s),i.textContent=t.cssText,e.appendChild(i)})},f=l?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return u(t)})(e):e,g=window,m=g.trustedTypes,v=m?m.emptyScript:"",y=g.reactiveElementPolyfillSupport,b={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},w=(e,t)=>t!==e&&(t==t||e==e),x={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:w},_="finalized",C=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,i)=>{let s=this._$Ep(i,t);void 0!==s&&(this._$Ev.set(s,i),e.push(s))}),e}static createProperty(e,t=x){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let i="symbol"==typeof e?Symbol():"__"+e,s=this.getPropertyDescriptor(e,i,t);void 0!==s&&Object.defineProperty(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(s){let o=this[e];this[t]=s,this.requestUpdate(e,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||x}static finalize(){if(this.hasOwnProperty(_))return!1;this[_]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let e=this.properties;for(let t of[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)])this.createProperty(t,e[t])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e))for(let i of new Set(e.flat(1/0).reverse()))t.unshift(f(i));else void 0!==e&&t.push(f(e));return t}static _$Ep(e,t){let i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach(e=>e(this))}addController(e){var t,i;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(i=e.hostConnected)||void 0===i||i.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return p(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)})}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=x){var s;let o=this.constructor._$Ep(e,i);if(void 0!==o&&!0===i.reflect){let r=(void 0!==(null===(s=i.converter)||void 0===s?void 0:s.toAttribute)?i.converter:b).toAttribute(t,i.type);this._$El=e,null==r?this.removeAttribute(o):this.setAttribute(o,r),this._$El=null}}_$AK(e,t){var i;let s=this.constructor,o=s._$Ev.get(e);if(void 0!==o&&this._$El!==o){let e=s.getPropertyOptions(o),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(i=e.converter)||void 0===i?void 0:i.fromAttribute)?e.converter:b;this._$El=o,this[o]=r.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,i){let s=!0;void 0!==e&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||w)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===i.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,i))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((e,t)=>this[t]=e),this._$Ei=void 0);let t=!1,i=this._$AL;try{(t=this.shouldUpdate(i))?(this.willUpdate(i),null===(e=this._$ES)||void 0===e||e.forEach(e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)}),this.update(i)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach(e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach((e,t)=>this._$EO(t,this[t],e)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};C[_]=!0,C.elementProperties=new Map,C.elementStyles=[],C.shadowRootOptions={mode:"open"},null==y||y({ReactiveElement:C}),(null!==(s=g.reactiveElementVersions)&&void 0!==s?s:g.reactiveElementVersions=[]).push("1.6.3");let k=window,S=k.trustedTypes,M=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,E="$lit$",I=`lit$${(Math.random()+"").slice(9)}$`,B="?"+I,$=`<${B}>`,T=document,O=()=>T.createComment(""),P=e=>null===e||"object"!=typeof e&&"function"!=typeof e,H=Array.isArray,A=e=>H(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),L="[ \n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Z=/-->/g,j=/>/g,V=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),z=/'/g,R=/"/g,F=/^(?:script|style|textarea|title)$/i,N=(e,...t)=>({_$litType$:1,strings:e,values:t}),q=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),W=new WeakMap,G=T.createTreeWalker(T,129,null,!1);function Y(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==M?M.createHTML(t):t}let K=(e,t)=>{let i=e.length-1,s=[],o,r=2===t?"":"",a=D;for(let t=0;t"===l[0]?(a=null!=o?o:D,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,n=l[1],a=void 0===l[3]?V:'"'===l[3]?R:z):a===R||a===z?a=V:a===Z||a===j?a=D:(a=V,o=void 0);let h=a===V&&e[t+1].startsWith("/>")?" ":"";r+=a===D?i+$:c>=0?(s.push(n),i.slice(0,c)+E+i.slice(c)+I+h):i+I+(-2===c?(s.push(void 0),t):h)}return[Y(e,r+(e[i]||"")+(2===t?"":"")),s]};class X{constructor({strings:e,_$litType$:t},i){let s;this.parts=[];let o=0,r=0,a=e.length-1,n=this.parts,[l,c]=K(e,t);if(this.el=X.createElement(l,i),G.currentNode=this.el.content,2===t){let e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(s=G.nextNode())&&n.length0){s.textContent=S?S.emptyScript:"";for(let i=0;i2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=U}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,s){let o=this.strings,r=!1;if(void 0===o)(r=!P(e=Q(this,e,t,0))||e!==this._$AH&&e!==q)&&(this._$AH=e);else{let s,a;let n=e;for(e=o[0],s=0;s{var s,o;let r=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:t,a=r._$litPart$;if(void 0===a){let e=null!==(o=null==i?void 0:i.renderBefore)&&void 0!==o?o:null;r._$litPart$=a=new ee(t.insertBefore(O(),e),e,void 0,null!=i?i:{})}return a._$AI(e),a};class ec extends C{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let i=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=i.firstChild),i}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=el(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return q}}ec.finalized=!0,ec._$litElement$=!0,null===(r=globalThis.litElementHydrateSupport)||void 0===r||r.call(globalThis,{LitElement:ec});let ed=globalThis.litElementPolyfillSupport;null==ed||ed({LitElement:ec}),(null!==(a=globalThis.litElementVersions)&&void 0!==a?a:globalThis.litElementVersions=[]).push("3.3.3");let eh=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eu=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ep=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ef=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eg=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,em=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ev=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ey=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eb=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ew=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ex=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,e_=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eC=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ek=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eS=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eM=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eE=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eI=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eB=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,e$=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eT=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eO=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eP=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eH=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eA=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eL=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eD=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eZ=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ej=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eV=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ez=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eR=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eF=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eN=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eq=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eU=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eW=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eG=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eY=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eK=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eX=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eQ=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,eJ=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,e1=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,e0=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,e2=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,e5=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,e7=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,e3=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,e4=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,e6=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,e8=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,e9=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,te=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tt=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ti=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ts=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,to=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tr=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ta=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tn=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tl=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tc=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,td=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,th=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tu=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tp=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tf=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tg=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tm=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tv=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ty=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tb=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tw=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tx=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,t_=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tC=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tk=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tS=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tM=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tE=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tI=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tB=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,t$=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tT=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tO=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tP=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tH=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tA=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tL=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tD=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tZ=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tj=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tV=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tz=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tR=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tF=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tN=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tq=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tU=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tW=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tG=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tY=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tK=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tX=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tQ=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,tJ=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,t1=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,t0=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,t2=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,t5=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,t7=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,t3=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,t4=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,t6=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,t8=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,t9=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ie=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,it=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ii=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,is=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,io=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ir=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ia=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,il=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ic=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,id=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ih=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,iu=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ip=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ig=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,im=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,iv=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,iy=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ib=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,iw=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,ix=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,i_=({width:e="1em",height:t="1em",style:i=""}={})=>N` `,iC=({width:e="1em",height:t="1em",style:i=""}={})=>N` `},45483:(e,t,i)=>{i.r(t),i.d(t,{AccountIcon:()=>o,AddCommentIcon:()=>r,AddCursorIcon:()=>a,AddTextIcon:()=>n,AfFiNeIcon:()=>l,AiIcon:()=>c,AlignBottomIcon:()=>d,AlignHorizontalCenterIcon:()=>h,AlignLeftIcon:()=>u,AlignRightIcon:()=>p,AlignTopIcon:()=>f,AlignVerticalCenterIcon:()=>g,AllDocsIcon:()=>m,AppearanceIcon:()=>v,ArrowDownBigBottomIcon:()=>b,ArrowDownBigIcon:()=>y,ArrowDownSmallIcon:()=>w,ArrowLeftBigIcon:()=>x,ArrowLeftSmallIcon:()=>_,ArrowLeftSmallPlusIcon:()=>C,ArrowRightBigIcon:()=>k,ArrowRightSmallIcon:()=>S,ArrowRightSmallPlusIcon:()=>M,ArrowUpBigIcon:()=>E,ArrowUpBigTopIcon:()=>I,ArrowUpSmallIcon:()=>B,AtIcon:()=>$,AttachmentIcon:()=>T,AutoHeightIcon:()=>O,AutoSizeIcon:()=>P,BanIcon:()=>H,BlockIcon:()=>A,BlocksuiteIcon:()=>L,BoldIcon:()=>D,BookmarkIcon:()=>Z,BrokenImageIcon:()=>j,BroomIcon:()=>V,BrushIcon:()=>z,BulletedListIcon:()=>R,CameraIcon:()=>F,CancelWrapIcon:()=>N,CaptionIcon:()=>q,CenterPeekIcon:()=>U,ChatWithAiIcon:()=>W,CheckBoxCheckLinearIcon:()=>G,CheckBoxCkeckSolidIcon:()=>Y,CheckBoxUnIcon:()=>K,ClientIcon:()=>X,CloseIcon:()=>Q,CloudWorkspaceIcon:()=>J,CodeBlockIcon:()=>et,CodeIcon:()=>ee,CollaborationIcon:()=>ei,CollapseIcon:()=>es,ColorPickerIcon:()=>eo,CommentDuodoneIcon:()=>ea,CommentIcon:()=>er,CommentsAvatarIcon:()=>en,CompressIcon:()=>el,ConnectorCIcon:()=>ed,ConnectorEIcon:()=>eh,ConnectorIcon:()=>ec,ConnectorLIcon:()=>eu,ContactWithUsIcon:()=>ep,ConvertIcon:()=>ef,CopyIcon:()=>eg,CornerIcon:()=>em,CreatedIcon:()=>ev,CurveLineIcon:()=>ey,CustomSizeIcon:()=>eb,CustomizedHeightIcon:()=>ew,DarkModeIcon:()=>ex,DashLineIcon:()=>e_,DatabaseKanbanViewIcon:()=>eC,DatabaseListViewIcon:()=>ek,DatabaseTableViewIcon:()=>eS,DateTimeIcon:()=>eM,DeleteIcon:()=>eE,DeletePermanentlyIcon:()=>eI,DeleteTemporarilyIcon:()=>eB,DiamondIcon:()=>e$,DiscordIcon:()=>eT,DistributeHorizontalIcon:()=>eO,DistributeVerticalIcon:()=>eP,DividerIcon:()=>eH,DocsIcon:()=>eA,DoneIcon:()=>eL,DownloadIcon:()=>eD,DragCursorIcon:()=>eZ,DropCursorIcon:()=>ej,DualLinkIcon:()=>eV,DuplicateIcon:()=>ez,EdgelessIcon:()=>eR,EditIcon:()=>eF,ElbowedLineIcon:()=>eN,EllipseIcon:()=>eq,EllipsisIcon:()=>eU,EmailIcon:()=>eW,EmbedWebIcon:()=>eG,EmptyIcon:()=>eY,EndPointArrowIcon:()=>eK,EndPointCircleIcon:()=>eX,EndPointDiamondIcon:()=>eQ,EndPointTriangleIcon:()=>eJ,EnterIcon:()=>e1,EqIcon:()=>e0,EraserIcon:()=>e2,ExpandCloseIcon:()=>e7,ExpandFullIcon:()=>e3,ExpandIcon:()=>e5,ExpandWideIcon:()=>e4,ExperimentIcon:()=>e6,ExplainIcon:()=>e8,ExportIcon:()=>e9,ExportToHtmlIcon:()=>te,ExportToMarkdownIcon:()=>tt,ExportToPdfIcon:()=>ti,ExportToPngIcon:()=>ts,ExportToSvgIcon:()=>to,FavoriteIcon:()=>tr,FavoritedIcon:()=>ta,FigmaDuotoneIcon:()=>tn,FileIcon:()=>tl,FilterIcon:()=>tc,FilterMinusIcon:()=>td,FilterUndoIcon:()=>th,FilteredIcon:()=>tu,FlipDirectionIcon:()=>tp,FolderIcon:()=>tf,FontIcon:()=>tg,FrameIcon:()=>tm,GithubIcon:()=>tv,GitlabIcon:()=>ty,GoodIcon:()=>tb,GoogleDuotoneIcon:()=>tx,GoogleIcon:()=>tw,GoogleMapDuotoneIcon:()=>t_,GridIcon:()=>tC,GroupIcon:()=>tk,Group_276Icon:()=>tS,Group_277Icon:()=>tM,GroupingIcon:()=>tE,GtIcon:()=>tI,HandIcon:()=>tB,Heading1Icon:()=>t$,Heading2Icon:()=>tT,Heading3Icon:()=>tO,Heading4Icon:()=>tP,Heading5Icon:()=>tH,Heading6Icon:()=>tA,HeadingsIcon:()=>tL,HeartbreakIcon:()=>tD,HelpCenterIcon:()=>tj,HelpIcon:()=>tZ,HighLightDuotoneIcon:()=>tV,HighLightLinearIcon:()=>tz,HistoryIcon:()=>tR,ImageIcon:()=>tF,ImportIcon:()=>tN,ImproveWritingIcon:()=>tq,InboxIcon:()=>tU,InfoIcon:()=>tW,InformationFillDuotoneIcon:()=>tY,InformationIcon:()=>tG,InsertBleowIcon:()=>tK,InsertBlocksIcon:()=>tX,InsertLeftIcon:()=>tQ,InsertRightIcon:()=>tJ,InsertTopIcon:()=>t1,InstagramDuotoneIcon:()=>t0,InsyncIcon:()=>t2,InvisibleIcon:()=>t5,IssueIcon:()=>t7,ItalicIcon:()=>t3,JournalIcon:()=>t4,KeyboardIcon:()=>t6,LanguageIcon:()=>t8,LayerIcon:()=>t9,LayoutIcon:()=>ie,LevelIcon:()=>it,LightModeIcon:()=>ii,LineStyleIcon:()=>is,LinearLogoIcon:()=>io,LinkIcon:()=>ir,LinkedEdgelessIcon:()=>ia,LinkedPageIcon:()=>il,LocalDataIcon:()=>ic,LocalWorkspaceIcon:()=>id,LocateIcon:()=>ih,LockIcon:()=>iu,Logo1Icon:()=>ip,Logo2Icon:()=>ig,Logo3Icon:()=>im,Logo4Icon:()=>iv,LongerIcon:()=>iy,LoomLogoIcon:()=>ib,LtIcon:()=>iw,MakeItRealIcon:()=>ix,MindmapIcon:()=>i_,MindmapNodeIcon:()=>iC,MinusIcon:()=>ik,MoreHorizontalIcon:()=>iS,MoreVerticalIcon:()=>iM,MoveLeftIcon:()=>iE,MoveRightIcon:()=>iI,MoveToIcon:()=>iB,MoveToLeftDuotoneIcon:()=>i$,MoveToRightDuotoneIcon:()=>iT,MultiCursorDuotoneIcon:()=>iO,MultiSelectIcon:()=>iP,MyConnectionsIcon:()=>iH,NeIcon:()=>iA,NewIcon:()=>iL,NewPageIcon:()=>iD,NoNetworkIcon:()=>iZ,NoteShadowDuotoneIcon:()=>ij,NotificationIcon:()=>iV,NotionIcon:()=>iz,NowIcon:()=>iR,NumberIcon:()=>iF,NumberedListIcon:()=>iN,OctobaseIcon:()=>iq,OpenInNewIcon:()=>iU,OtherIcon:()=>iW,PageIcon:()=>iG,PaletteIcon:()=>iY,PasteIcon:()=>iK,PaymentIcon:()=>iX,PenIcon:()=>iQ,PenThickIcon:()=>iJ,PenThinIcon:()=>i1,PinIcon:()=>i0,PinboardIcon:()=>i2,PinedIcon:()=>i5,PlayFillIcon:()=>i3,PlayIcon:()=>i7,PluginIcon:()=>i4,PlusIcon:()=>i6,PlusThickIcon:()=>i8,PptIcon:()=>i9,PresentationIcon:()=>se,ProductHuntIcon:()=>st,ProgressIcon:()=>si,PropertyIcon:()=>ss,PublishIcon:()=>so,QuoteIcon:()=>sr,RadiantIcon:()=>sa,RedditDuotoneIcon:()=>sn,RedoIcon:()=>sl,ReleaseFromGroupIcon:()=>sc,RemoveFolderIcon:()=>sh,RemoveIcon:()=>sd,ReplaceIcon:()=>su,ResetIcon:()=>sp,RightLayoutIcon:()=>sf,RightSidebarIcon:()=>sg,RotateAnticlockwiseIcon:()=>sv,RotateIcon:()=>sm,RoundedRectangleIcon:()=>sy,SaveIcon:()=>sb,ScaleAltIcon:()=>sx,ScaleIcon:()=>sw,ScissorsIcon:()=>s_,SearchIcon:()=>sC,SelectAreaIcon:()=>sS,SelectIcon:()=>sk,SelectTextIcon:()=>sM,SelectionIcon:()=>sE,SendIcon:()=>sI,SettingsIcon:()=>sB,ShapeIcon:()=>s$,ShareIcon:()=>sT,SharedIcon:()=>sO,ShorterIcon:()=>sP,SiblingNodeIcon:()=>sH,SidebarIcon:()=>sA,SignOutIcon:()=>sL,SingleSelectIcon:()=>sD,SingleSelectSelectLinearIcon:()=>sZ,SingleSelectSelectSolidIcon:()=>sj,SingleSelectUnIcon:()=>sV,SmileIcon:()=>sz,SoloViewIcon:()=>sR,SortDownIcon:()=>sN,SortIcon:()=>sF,SortUpIcon:()=>sq,SplitViewIcon:()=>sU,SquareIcon:()=>sW,StartNumberingIcon:()=>sG,StartPointArrowIcon:()=>sK,StartPointCircleIcon:()=>sX,StartPointDiamondIcon:()=>sQ,StartPointIcon:()=>sY,StartPointTriangleIcon:()=>sJ,StopAiIcon:()=>s0,StopIcon:()=>s1,StraightLineIcon:()=>s2,StrikeThroughIcon:()=>s5,StyleGeneralIcon:()=>s3,StyleIcon:()=>s7,StyleScribbleIcon:()=>s4,SubNodeIcon:()=>s6,SucessfulDuotoneIcon:()=>s8,SummarizeIcon:()=>s9,TagIcon:()=>oe,TagsIcon:()=>ot,TelegramDuotoneIcon:()=>oi,TextAlignCenterIcon:()=>oo,TextAlignLeftIcon:()=>or,TextAlignRightIcon:()=>oa,TextBackgroundDuotoneIcon:()=>on,TextColorIcon:()=>ol,TextIcon:()=>os,TextTypeIcon:()=>oc,TimelineIcon:()=>od,TitleIcon:()=>oh,TocIcon:()=>ou,TodayIcon:()=>op,ToggleCollapseIcon:()=>of,ToggleExpandIcon:()=>og,TomorrowIcon:()=>om,ToneIcon:()=>ov,TriangleIcon:()=>oy,TwitterIcon:()=>ob,UnderLineIcon:()=>ow,UndoIcon:()=>ox,UngroupIcon:()=>o_,UnlinkIcon:()=>oC,UnlockIcon:()=>ok,UnpinIcon:()=>oS,UnsucessfulDuotoneIcon:()=>oM,UnsyncIcon:()=>oE,UpdatedIcon:()=>oI,UpgradeIcon:()=>oB,UploadIcon:()=>o$,UserGuideIcon:()=>oT,ViewBarIcon:()=>oP,ViewIcon:()=>oO,ViewLayersIcon:()=>oH,WarningIcon:()=>oA,WebIcon:()=>oL,WrapIcon:()=>oD,YesterdayIcon:()=>oZ,YoutubeDuotoneIcon:()=>oj,ZendeskIcon:()=>oV,ZoomDownIcon:()=>oz,ZoomUpIcon:()=>oR});var s=i(36870);let o=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.75a3.25 3.25 0 1 0 0 6.5 3.25 3.25 0 0 0 0-6.5ZM7.25 7a4.75 4.75 0 1 1 9.5 0 4.75 4.75 0 0 1-9.5 0ZM12 14.75a6.253 6.253 0 0 0-5.998 4.488.665.665 0 0 0 .162.666c.182.2.486.346.836.346h10c.35 0 .654-.146.837-.346a.665.665 0 0 0 .161-.666A6.253 6.253 0 0 0 12 14.75Zm-7.438 4.065a7.753 7.753 0 0 1 14.876 0 2.163 2.163 0 0 1-.495 2.102A2.64 2.64 0 0 1 17 21.75H7a2.64 2.64 0 0 1-1.943-.833 2.163 2.163 0 0 1-.495-2.102Z",clipRule:"evenodd"})}),r=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M18.83 4.08a.655.655 0 0 0-1.31 0v1.964h-1.965a.655.655 0 0 0 0 1.31h1.965v1.964a.655.655 0 1 0 1.31 0V7.353h1.963a.655.655 0 1 0 0-1.31H18.83V4.08Zm1.435 15.397c.192-.12.31-.33.31-.557v-8.075a.655.655 0 1 0-1.31 0v7.016l-1.954-.977-.032-.017c-.19-.094-.338-.169-.497-.222a2.409 2.409 0 0 0-.433-.102c-.166-.024-.333-.023-.544-.023H8.397c-.744 0-1.263 0-1.667-.034-.396-.032-.624-.093-.796-.18a1.964 1.964 0 0 1-.858-.859c-.088-.172-.149-.4-.181-.796-.033-.404-.034-.923-.034-1.667V9.143c0-.744.001-1.263.034-1.667.032-.396.093-.624.18-.796.189-.37.49-.67.859-.858.172-.088.4-.149.796-.181.404-.033.923-.034 1.667-.034h4.758a.655.655 0 1 0 0-1.309H8.369c-.71 0-1.282 0-1.745.038-.478.039-.897.121-1.285.319a3.274 3.274 0 0 0-1.43 1.43c-.198.388-.28.807-.32 1.285-.037.463-.037 1.035-.037 1.745v3.897c0 .71 0 1.282.038 1.745.039.478.121.897.319 1.285a3.273 3.273 0 0 0 1.43 1.43c.388.198.807.28 1.285.32.463.037 1.035.037 1.745.037h7.4c.263 0 .334.002.399.01.066.01.132.026.196.047.062.02.126.051.361.169l2.902 1.45c.203.102.445.091.638-.028ZM7.699 8.663a.655.655 0 1 0 0 1.31h6.983a.655.655 0 1 0 0-1.31H7.7Zm-.655 4.146c0-.361.293-.654.655-.654h4.364a.655.655 0 0 1 0 1.31H7.7a.655.655 0 0 1-.655-.656Z",clipRule:"evenodd"})}),a=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12h12m-6-6v12"})}),n=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.25 5A.75.75 0 0 1 7 4.25h14a.75.75 0 0 1 .75.75v2.333a.75.75 0 0 1-1.5 0V5.75h-5.5v12.5h2.75a.75.75 0 0 1 0 1.5h-7a.75.75 0 0 1 0-1.5h2.75V5.75h-5.5v1.583a.75.75 0 1 1-1.5 0V5Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M1.25 13a.75.75 0 0 1 .75-.75h5a.75.75 0 0 1 0 1.5H2a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.5 16.25a.75.75 0 0 1-.75-.75v-5a.75.75 0 0 1 1.5 0v5a.75.75 0 0 1-.75.75Z",clipRule:"evenodd"})]}),l=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.893 2.293c-.717-.538-1.769-.31-2.207.48-.35.624-1.413 2.504-2.697 4.775l-.001.001C5.493 11.96 2.166 17.843 1.61 18.865c-.341.838.135 1.831.99 2.075.251.068.512.063.758.059.101-.002.2-.004.295 0 2.243.002 5.182 0 8.153 0 3.255-.002 6.55-.004 9.016 0 .137.002.375 0 .576-.059.62-.176 1.082-.78 1.1-1.436a1.644 1.644 0 0 0-.11-.638c-.07-.156-.128-.257-.186-.357l-.066-.117-.476-.844-3.831-6.78-.232-.412L14.03 4.04l-.716-1.267a1.661 1.661 0 0 0-.421-.48Zm-2.331 3.026 1.11-1.965a.377.377 0 0 1 .656 0c.068.118.199.352.333.592.15.268.305.544.382.675l3.686 6.525 1.834 3.245-8.001-9.072ZM8.826 8.39c-2.458 4.35-5.633 9.971-6.16 10.917-.095.23.078.52.324.524.048.005.335.005.52.004h1.682L8.826 8.39Zm4.007 11.445h8.015c.07 0 .158 0 .162-.004a.146.146 0 0 0 .048-.005c.01-.003.021-.005.032-.006a.396.396 0 0 0 .245-.513c-.008-.012-.012-.02-.016-.03a.718.718 0 0 0-.049-.092l-1.043-1.847-11.472 2.498h4.078Zm5.932-4.337a11.46 11.46 0 0 0-.68-.561l-7.748 3.825-.057.041 9.365-2.371-.88-.934Zm-6.711 1.671 5.139-2.836a7.958 7.958 0 0 0-.924-.473l-4.215 3.31Zm.778-1.433 2.487-2.207a6.708 6.708 0 0 0-.406-.097 6.167 6.167 0 0 0-.728-.092l-1.353 2.396Zm-1.24.749L10.24 14.09l.627 3.301c.097-.1.191-.203.283-.31.159-.19.307-.39.442-.597Zm-1.369-3.866a6.435 6.435 0 0 1-.285-.691 7.156 7.156 0 0 1-.121-.405l3.11 1.096h-2.704Zm-.599-4.227 7.001 4.866.05.023-6.612-7.02-.145.514a12.69 12.69 0 0 0-.294 1.617Zm.484 9.678-.73-5.662a7.446 7.446 0 0 1-.044-.118l-.179 6.413c.332-.188.65-.398.953-.633Zm-1.91 1.108.612-8.473-2.572 9.122.003-.001.09-.023c.639-.163 1.267-.367 1.868-.625Zm6.24-6.63L9.56 9.48c0 .345.019.69.061 1.032l4.816 2.038Zm-3.65 1.095 1.035 1.83c.08.14.277.14.355 0l1.035-1.83c.079-.14-.02-.315-.177-.315h-2.07c-.158 0-.257.175-.178.315Z",clipRule:"evenodd"})}),c=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M11.281 5.491a.714.714 0 0 0-1.42-.001c-.27 2.345-.971 3.994-2.102 5.126-1.132 1.131-2.781 1.832-5.127 2.103a.714.714 0 0 0 .002 1.42c2.307.26 3.991.962 5.15 2.099 1.153 1.133 1.87 2.782 2.076 5.11a.714.714 0 0 0 1.423 0c.198-2.291.914-3.975 2.073-5.135 1.16-1.16 2.843-1.875 5.134-2.073a.714.714 0 0 0 .002-1.423c-2.33-.207-3.978-.923-5.111-2.077-1.138-1.158-1.838-2.842-2.1-5.149ZM18.943 2.247a.278.278 0 0 0-.552-.001c-.105.912-.378 1.554-.818 1.993-.44.44-1.082.713-1.994.818a.278.278 0 0 0 0 .552c.898.102 1.553.375 2.003.817.45.44.727 1.082.808 1.987a.278.278 0 0 0 .553 0c.077-.891.356-1.546.807-1.997.45-.45 1.105-.729 1.996-.806a.278.278 0 0 0 0-.553c-.905-.08-1.546-.36-1.987-.808-.442-.45-.715-1.105-.816-2.002Z"})}),d=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M15 4a1 1 0 0 1 1 1v12a1 1 0 0 1-.031.25H20a.75.75 0 0 1 0 1.5H4a.75.75 0 0 1 0-1.5h4.031A1.002 1.002 0 0 1 8 17v-6a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v6a1 1 0 0 1-.031.25h2.063A1 1 0 0 1 13 17V5a1 1 0 0 1 1-1h1Z",clipRule:"evenodd"})}),h=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.25a.75.75 0 0 1 .75.75v4H18a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-5.25v2H15a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-2.25v4a.75.75 0 0 1-1.5 0v-4H9a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h2.25v-2H6a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h5.25V4a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),u=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5.75 3.25A.75.75 0 0 1 6.5 4v4.031c.08-.02.164-.031.25-.031h12a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-12a1 1 0 0 1-.25-.031v2.063A1 1 0 0 1 6.75 13h6a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-6a1 1 0 0 1-.25-.031V20A.75.75 0 0 1 5 20V4a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),p=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M19 3.25a.75.75 0 0 1 .75.75v16a.75.75 0 0 1-1.5 0v-4.031A1 1 0 0 1 18 16h-6a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1h6a1 1 0 0 1 .25.031v-2.063A1 1 0 0 1 18 11H6a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h12c.086 0 .17.01.25.031V4a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),f=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3 5.75A.75.75 0 0 1 3.75 5h16a.75.75 0 0 1 0 1.5h-4.031a1 1 0 0 1 .031.25v12a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-12a1 1 0 0 1 .031-.25h-2.063a1 1 0 0 1 .032.25v6a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-6c0-.086.01-.17.032-.25H3.75A.75.75 0 0 1 3 5.75Z",clipRule:"evenodd"})}),g=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M15 5a1 1 0 0 1 1 1v5.25h4a.75.75 0 0 1 0 1.5h-4V18a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-5.25h-2V15a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1v-2.25H4a.75.75 0 0 1 0-1.5h4V9a1 1 0 0 1 1-1h1a1 1 0 0 1 1 1v2.25h2V6a1 1 0 0 1 1-1h1Z",clipRule:"evenodd"})}),m=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.167 3.25c-.783 0-1.417.634-1.417 1.417V15.5c0 .782.634 1.417 1.417 1.417h8.666c.783 0 1.417-.635 1.417-1.417V8.125h-2.5a1.833 1.833 0 0 1-1.833-1.833V3.25h-5.75Zm7.25 1.223 1.913 2.152h-1.58a.333.333 0 0 1-.333-.333v-1.82ZM7.25 4.667a2.917 2.917 0 0 1 2.917-2.917h6.5a.75.75 0 0 1 .56.252l4.334 4.875a.75.75 0 0 1 .189.498V15.5a2.917 2.917 0 0 1-2.917 2.917H16.75v.916a2.917 2.917 0 0 1-2.917 2.917H5.708a3.458 3.458 0 0 1-3.458-3.458V8.5a2.917 2.917 0 0 1 2.917-2.917H7.25v-.916Zm0 2.416H5.167c-.783 0-1.417.635-1.417 1.417v10.292c0 1.081.877 1.958 1.958 1.958h8.125c.783 0 1.417-.634 1.417-1.417v-.916h-5.083A2.917 2.917 0 0 1 7.25 15.5V7.083Zm4.333-.25a.75.75 0 0 1 .75-.75h1.409a.75.75 0 0 1 0 1.5h-1.409a.75.75 0 0 1-.75-.75Zm0 3.25a.75.75 0 0 1 .75-.75h4.334a.75.75 0 0 1 0 1.5h-4.334a.75.75 0 0 1-.75-.75Zm0 3.25a.75.75 0 0 1 .75-.75h3.25a.75.75 0 0 1 0 1.5h-3.25a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"})}),v=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.75a8.25 8.25 0 1 0 0 16.5A2.25 2.25 0 0 0 14.25 18v-.659c0-.314 0-.556.034-.771a2.75 2.75 0 0 1 2.286-2.286c.215-.034.457-.034.771-.034H18A2.25 2.25 0 0 0 20.25 12 8.25 8.25 0 0 0 12 3.75ZM2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75A3.75 3.75 0 0 1 18 15.75h-.6c-.4 0-.513.002-.595.015a1.25 1.25 0 0 0-1.04 1.04c-.013.082-.015.195-.015.595v.6A3.75 3.75 0 0 1 12 21.75c-5.385 0-9.75-4.365-9.75-9.75Zm7-4.5a1.25 1.25 0 1 1 2.5 0 1.25 1.25 0 0 1-2.5 0Zm5 1a1.25 1.25 0 1 1 2.5 0 1.25 1.25 0 0 1-2.5 0Zm-8 3a1.25 1.25 0 1 1 2.5 0 1.25 1.25 0 0 1-2.5 0Z",clipRule:"evenodd"})}),y=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.507 13.003a.75.75 0 0 0-1.06.045l-3.697 4.027V5a.75.75 0 0 0-1.5 0v12.075l-3.698-4.027a.75.75 0 1 0-1.104 1.015l5 5.444a.75.75 0 0 0 1.104 0l5-5.444a.75.75 0 0 0-.045-1.06Z",clipRule:"evenodd"})}),b=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.75 4a.75.75 0 0 0-1.5 0v10.19l-2.72-2.72a.75.75 0 0 0-1.06 1.06l4 4a.75.75 0 0 0 1.06 0l4-4a.75.75 0 1 0-1.06-1.06l-2.72 2.72V4ZM5 19.25a.75.75 0 0 0 0 1.5h14a.75.75 0 0 0 0-1.5H5Z",clipRule:"evenodd"})}),w=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.58 8.97a.75.75 0 0 1 0 1.06l-5 5a.75.75 0 0 1-1.06 0l-5-5a.75.75 0 1 1 1.06-1.06l4.47 4.47 4.47-4.47a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})}),x=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.997 6.493a.75.75 0 0 1-.045 1.06L6.925 11.25H19a.75.75 0 0 1 0 1.5H6.925l4.027 3.698a.75.75 0 1 1-1.015 1.104l-5.444-5a.75.75 0 0 1 0-1.104l5.444-5a.75.75 0 0 1 1.06.045Z",clipRule:"evenodd"})}),_=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.53 6.47a.75.75 0 0 1 0 1.06L10.06 12l4.47 4.47a.75.75 0 1 1-1.06 1.06l-5-5a.75.75 0 0 1 0-1.06l5-5a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})}),C=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.707 6.293a1 1 0 0 1 0 1.414L10.414 12l4.293 4.293a1 1 0 0 1-1.414 1.414l-5-5a1 1 0 0 1 0-1.414l5-5a1 1 0 0 1 1.414 0Z",clipRule:"evenodd"})}),k=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.003 6.493a.75.75 0 0 0 .045 1.06l4.027 3.697H5a.75.75 0 0 0 0 1.5h12.075l-4.027 3.698a.75.75 0 1 0 1.015 1.104l5.444-5a.75.75 0 0 0 0-1.104l-5.444-5a.75.75 0 0 0-1.06.045Z",clipRule:"evenodd"})}),S=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.47 6.47a.75.75 0 0 0 0 1.06L12.94 12l-4.47 4.47a.75.75 0 1 0 1.06 1.06l5-5a.75.75 0 0 0 0-1.06l-5-5a.75.75 0 0 0-1.06 0Z",clipRule:"evenodd"})}),M=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.293 6.293a1 1 0 0 0 0 1.414L12.586 12l-4.293 4.293a1 1 0 1 0 1.414 1.414l5-5a1 1 0 0 0 0-1.414l-5-5a1 1 0 0 0-1.414 0Z",clipRule:"evenodd"})}),E=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.507 10.997a.75.75 0 0 1-1.06-.045L12.75 6.925V19a.75.75 0 0 1-1.5 0V6.925l-3.698 4.027a.75.75 0 1 1-1.104-1.015l5-5.444a.75.75 0 0 1 1.104 0l5 5.444a.75.75 0 0 1-.045 1.06Z",clipRule:"evenodd"})}),I=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 3.25a.75.75 0 0 0 0 1.5h14a.75.75 0 0 0 0-1.5H5ZM12.75 20a.75.75 0 0 1-1.5 0V9.81l-2.72 2.72a.75.75 0 0 1-1.06-1.06l4-4a.75.75 0 0 1 1.06 0l4 4a.75.75 0 1 1-1.06 1.06l-2.72-2.72V20Z",clipRule:"evenodd"})}),B=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.58 15.03a.75.75 0 0 0 0-1.06l-5-5a.75.75 0 0 0-1.06 0l-5 5a.75.75 0 1 0 1.06 1.06l4.47-4.47 4.47 4.47a.75.75 0 0 0 1.06 0Z",clipRule:"evenodd"})}),$=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.75a8.25 8.25 0 1 0 4.125 15.395.75.75 0 0 1 .75 1.299 9.708 9.708 0 0 1-4.925 1.306c-5.362-.027-9.7-4.382-9.7-9.75 0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75v1.5a3.25 3.25 0 0 1-6.108 1.55A4.75 4.75 0 1 1 16.75 12v1.5a1.75 1.75 0 1 0 3.5 0V12A8.25 8.25 0 0 0 12 3.75ZM15.25 12a3.25 3.25 0 1 0-6.5 0 3.25 3.25 0 0 0 6.5 0Z",clipRule:"evenodd"})}),T=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"m12.217 5.608-6.04 6.04a4.65 4.65 0 0 0 0 6.704c1.914 1.864 5.026 1.864 6.94 0l5.89-5.723a.75.75 0 1 1 1.045 1.076l-5.889 5.721c-2.496 2.432-6.536 2.432-9.032 0a6.15 6.15 0 0 1-.004-8.849l6.04-6.04c1.762-1.716 4.61-1.716 6.371 0a4.35 4.35 0 0 1 .004 6.256l-6.04 6.04c-1.027 1-2.683 1-3.71 0a2.55 2.55 0 0 1 0-3.667l6.2-6.037a.75.75 0 0 1 1.046 1.075l-6.199 6.037a1.05 1.05 0 0 0 0 1.518 1.168 1.168 0 0 0 1.613.003l6.04-6.04a2.85 2.85 0 0 0 0-4.11 3.086 3.086 0 0 0-4.275-.004Z",clipRule:"evenodd"})}),O=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 4A.75.75 0 0 1 4 3.25h16a.75.75 0 0 1 0 1.5H4A.75.75 0 0 1 3.25 4ZM3.25 20a.75.75 0 0 1 .75-.75h16a.75.75 0 0 1 0 1.5H4a.75.75 0 0 1-.75-.75ZM11.47 5.47a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1-1.06 1.06L12 7.06 9.53 9.53a.75.75 0 0 1-1.06-1.06l3-3ZM8.47 14.47a.75.75 0 0 1 1.06 0L12 16.94l2.47-2.47a.75.75 0 1 1 1.06 1.06l-3 3a.75.75 0 0 1-1.06 0l-3-3a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 5.25a.75.75 0 0 1 .75.75v12a.75.75 0 0 1-1.5 0V6a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})]}),P=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 6A2.75 2.75 0 0 1 6 3.25h2.5a.75.75 0 0 1 0 1.5H6c-.69 0-1.25.56-1.25 1.25v2.5a.75.75 0 0 1-1.5 0V6Zm11.5-2a.75.75 0 0 1 .75-.75H18A2.75 2.75 0 0 1 20.75 6v2.5a.75.75 0 0 1-1.5 0V6c0-.69-.56-1.25-1.25-1.25h-2.5a.75.75 0 0 1-.75-.75ZM4 14.75a.75.75 0 0 1 .75.75V18c0 .69.56 1.25 1.25 1.25h3a.75.75 0 0 1 0 1.5H6A2.75 2.75 0 0 1 3.25 18v-2.5a.75.75 0 0 1 .75-.75Zm16 0a.75.75 0 0 1 .75.75V18A2.75 2.75 0 0 1 18 20.75h-3a.75.75 0 0 1 0-1.5h3c.69 0 1.25-.56 1.25-1.25v-2.5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),H=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.28 5.66 5.66 17.28A8.25 8.25 0 0 1 17.28 5.66ZM6.72 18.34 18.34 6.72A8.25 8.25 0 0 1 6.72 18.34ZM18.894 5.106c-3.807-3.808-9.98-3.808-13.788 0-3.808 3.807-3.808 9.98 0 13.788 3.807 3.808 9.98 3.808 13.788 0 3.808-3.807 3.808-9.98 0-13.788Z",clipRule:"evenodd"})}),A=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.7 2.813a.75.75 0 0 1 .6 0l8 3.5c.274.12.45.389.45.687v10a.75.75 0 0 1-.45.687l-8 3.5a.75.75 0 0 1-.6 0l-8-3.5A.75.75 0 0 1 3.25 17V7a.75.75 0 0 1 .45-.687l8-3.5ZM4.75 8.147v8.362l6.5 2.844V10.99l-6.5-2.843Zm8 2.844v8.362l6.5-2.844V8.147l-6.5 2.844ZM18.129 7 12 9.681 5.871 7 12 4.319 18.129 7Z",clipRule:"evenodd"})}),L=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M20 8.182 14.703 4 4 6.121v9.696L9.298 20 20 17.88V8.181Zm-6.356-2.65v2.754l1.62-.32v-1.71l2.34 1.846-7.81 1.548-3.398-2.682 7.248-1.436ZM5.62 8.167l3.116 2.459v2.887l1.62-.32V10.86l8.024-1.59v6.564l-3.116-2.46v-2.886l-1.62.32v2.332L5.62 14.73V8.168Zm4.736 10.301v-2.754l-1.62.321v1.71L6.396 15.9l7.811-1.548 3.397 2.681-7.247 1.436Z"})}),D=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.25 4A.75.75 0 0 1 7 3.25h5.958c2.67 0 4.875 2.105 4.875 4.75 0 1.515-.723 2.853-1.843 3.72 1.626.764 2.76 2.383 2.76 4.28 0 2.645-2.204 4.75-4.875 4.75H7a.75.75 0 0 1-.75-.75V4Zm1.5 8.75v6.5h6.125c1.886 0 3.375-1.477 3.375-3.25s-1.49-3.25-3.375-3.25H7.75Zm0-1.5h5.208c1.886 0 3.375-1.477 3.375-3.25s-1.489-3.25-3.375-3.25H7.75v6.5Z",clipRule:"evenodd"})}),Z=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 3.25A2.75 2.75 0 0 0 2.25 6v7a.75.75 0 0 0 1.5 0V6c0-.69.56-1.25 1.25-1.25h14c.69 0 1.25.56 1.25 1.25v12c0 .69-.56 1.25-1.25 1.25h-7a.75.75 0 0 0 0 1.5h7A2.75 2.75 0 0 0 21.75 18V6A2.75 2.75 0 0 0 19 3.25H5Zm4.116 9.866a1.25 1.25 0 0 1 1.768 1.768l-2 2a1.25 1.25 0 0 1-1.768 0 .75.75 0 0 0-1.06 1.06 2.75 2.75 0 0 0 3.889 0l2-2a2.75 2.75 0 1 0-3.89-3.889l-.55.55a.75.75 0 1 0 1.061 1.06l.55-.549Zm-3 3a1.25 1.25 0 0 1 1.768 0 .75.75 0 0 0 1.06-1.06 2.75 2.75 0 0 0-3.889 0l-2 2a2.75 2.75 0 1 0 3.89 3.889l.55-.551a.75.75 0 0 0-1.06-1.06l-.551.55a1.25 1.25 0 0 1-1.768-1.768l2-2Z",clipRule:"evenodd"})}),j=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 6A2.75 2.75 0 0 1 6 3.25h12A2.75 2.75 0 0 1 20.75 6v5a.75.75 0 0 1-1.5 0V6c0-.69-.56-1.25-1.25-1.25H6c-.69 0-1.25.56-1.25 1.25v8.19l3.305-3.306a2.75 2.75 0 0 1 3.89 0l.585.586a.75.75 0 1 1-1.06 1.06l-.586-.585a1.25 1.25 0 0 0-1.768 0L4.75 16.31V18c0 .69.56 1.25 1.25 1.25h5a.75.75 0 0 1 0 1.5H6A2.75 2.75 0 0 1 3.25 18V6Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",d:"M15 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.47 13.47a.75.75 0 0 1 1.06 0L17 15.94l2.47-2.47a.75.75 0 1 1 1.06 1.06L18.06 17l2.47 2.47a.75.75 0 1 1-1.06 1.06L17 18.06l-2.47 2.47a.75.75 0 1 1-1.06-1.06L15.94 17l-2.47-2.47a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})]}),V=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.777 3.723a.76.76 0 0 1 0 1.075l-6.968 6.968a5.09 5.09 0 0 1 .068 5.946l-2.881 4.1a.663.663 0 0 1-.92.164 29.851 29.851 0 0 1-7.552-7.552.663.663 0 0 1 .164-.92l4.1-2.88a5.09 5.09 0 0 1 5.946.067l6.968-6.968a.76.76 0 0 1 1.075 0ZM10.25 20.23l2.384-3.393.027-.04c-1.023-.4-2.056-1.083-2.965-1.993-.91-.91-1.592-1.942-1.993-2.965a3.63 3.63 0 0 0-.04.027L4.27 14.251a28.329 28.329 0 0 0 5.98 5.98Zm-1.137-8.962c.313.808.87 1.674 1.658 2.461.787.788 1.653 1.345 2.46 1.658a3.567 3.567 0 0 0-4.118-4.119Z",clipRule:"evenodd"})}),z=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.25 4.968a.75.75 0 0 1 .782-.717 83.76 83.76 0 0 1 7.141.63c1.323.178 2.63.398 3.77.664 1.127.263 2.15.585 2.873.987.228.127.444.275.61.453.164.177.347.461.322.832-.025.37-.243.623-.417.766a2.188 2.188 0 0 1-.582.327c-.759.302-2.052.501-3.404.663-.818.098-1.716.187-2.593.275-.594.06-1.178.118-1.723.177-.277.03-.544.06-.797.091a136.573 136.573 0 0 0 .953.142c2.324.342 5.287.777 7.09 1.48.16.064.41.177.585.394a.88.88 0 0 1 .198.551.887.887 0 0 1-.18.532 1.375 1.375 0 0 1-.513.393 4.156 4.156 0 0 1-.543.208c-.767.242-1.994.482-3.266.725l-.406.078c-1.175.223-2.39.454-3.412.701a14.25 14.25 0 0 0-1.443.413 4.472 4.472 0 0 0-.37.15c.295.23.799.507 1.466.801 1.43.631 3.34 1.232 4.669 1.592a.75.75 0 0 1-.393 1.448c-1.361-.37-3.352-.993-4.88-1.668-.75-.33-1.46-.703-1.921-1.102-.222-.192-.478-.467-.58-.828a1.133 1.133 0 0 1 .002-.636c.065-.217.188-.391.327-.527.293-.286.746-.487 1.17-.64a15.683 15.683 0 0 1 1.602-.461c1.06-.256 2.312-.494 3.48-.716l.408-.078a74.838 74.838 0 0 0 1.951-.392c-1.57-.39-3.545-.681-5.299-.94l-.605-.09c-1.197-.178-2.29-.35-2.908-.545a2.228 2.228 0 0 1-.483-.206c-.098-.06-.459-.292-.473-.755-.015-.48.35-.732.46-.802.159-.102.352-.177.54-.239.76-.247 2.049-.417 3.408-.565.577-.063 1.172-.122 1.767-.182.86-.086 1.722-.171 2.534-.269 1.066-.127 1.954-.264 2.556-.42-.527-.231-1.248-.453-2.12-.657-1.08-.252-2.335-.464-3.63-.64a82.271 82.271 0 0 0-7.005-.617.75.75 0 0 1-.717-.78Zm13.543 8.197-.006-.004a.065.065 0 0 1 .006.004Zm-.035-.931Z",clipRule:"evenodd"})}),R=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.3 7.5a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm4.033-1.75a.75.75 0 0 0 0 1.5l11.917.001a.75.75 0 0 0 0-1.5H8.333Zm0 5.5a.75.75 0 1 0 0 1.5l11.917.002a.75.75 0 0 0 0-1.5L8.333 11.25Zm0 5.5a.75.75 0 1 0 0 1.5l11.917.002a.75.75 0 1 0 0-1.5L8.333 16.75ZM5.3 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-1 6.5a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"})}),F=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.285 5.75c-.35 0-.67.172-.858.45l-.723 1.066a2.535 2.535 0 0 1-2.1 1.109h-.826c-.579 0-1.028.459-1.028 1v7.875c0 .541.449 1 1.028 1h12.444c.579 0 1.028-.459 1.028-1V9.375c0-.541-.449-1-1.028-1h-.826c-.84 0-1.63-.413-2.1-1.109L14.573 6.2a1.035 1.035 0 0 0-.858-.45h-3.43Zm-2.1-.391a2.535 2.535 0 0 1 2.1-1.109h3.43c.84 0 1.63.413 2.1 1.109l.723 1.066c.188.278.509.45.858.45h.826c1.385 0 2.528 1.108 2.528 2.5v7.875c0 1.392-1.143 2.5-2.528 2.5H5.778c-1.385 0-2.528-1.108-2.528-2.5V9.375c0-1.392 1.143-2.5 2.528-2.5h.826c.349 0 .67-.172.858-.45l.723-1.066ZM12 11c-1.07 0-1.917.85-1.917 1.875 0 1.024.847 1.875 1.917 1.875s1.917-.85 1.917-1.875C13.917 11.851 13.07 11 12 11Zm-3.417 1.875C8.583 11 10.124 9.5 12 9.5s3.417 1.5 3.417 3.375S13.876 16.25 12 16.25s-3.417-1.5-3.417-3.375Z",clipRule:"evenodd"})}),N=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M16.53 2.47a.75.75 0 1 0-1.06 1.06l2.72 2.72H8a.75.75 0 0 0 0 1.5h10.19l-2.72 2.72a.75.75 0 1 0 1.06 1.06l4-4a.75.75 0 0 0 0-1.06l-4-4Zm-5 9a.75.75 0 1 0-1.06 1.06l2.72 2.72H4.5a.75.75 0 0 0 0 1.5h8.69l-2.72 2.72a.75.75 0 1 0 1.06 1.06l4-4a.75.75 0 0 0 0-1.06l-4-4Z",clipRule:"evenodd"})}),q=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.25 7A2.75 2.75 0 0 1 7 4.25h5A2.75 2.75 0 0 1 14.75 7v3A2.75 2.75 0 0 1 12 12.75H7A2.75 2.75 0 0 1 4.25 10V7ZM7 5.75c-.69 0-1.25.56-1.25 1.25v3c0 .69.56 1.25 1.25 1.25h5c.69 0 1.25-.56 1.25-1.25V7c0-.69-.56-1.25-1.25-1.25H7ZM4.25 15.5a.75.75 0 0 1 .75-.75h14a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75ZM5 18.25a.75.75 0 0 0 0 1.5h9a.75.75 0 0 0 0-1.5H5Z",clipRule:"evenodd"})}),U=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 4.75a.25.25 0 0 0-.25.25v2a.75.75 0 0 1-1.5 0V5c0-.966.784-1.75 1.75-1.75h2a.75.75 0 0 1 0 1.5H5ZM16.25 4a.75.75 0 0 1 .75-.75h2c.966 0 1.75.784 1.75 1.75v2a.75.75 0 0 1-1.5 0V5a.25.25 0 0 0-.25-.25h-2a.75.75 0 0 1-.75-.75Zm-9 5.1c0-.47.38-.85.85-.85h7.8c.47 0 .85.38.85.85v5.8c0 .47-.38.85-.85.85H8.1a.85.85 0 0 1-.85-.85V9.1Zm1.5.65v4.5h6.5v-4.5h-6.5ZM4 16.25a.75.75 0 0 1 .75.75v2c0 .138.112.25.25.25h2a.75.75 0 0 1 0 1.5H5A1.75 1.75 0 0 1 3.25 19v-2a.75.75 0 0 1 .75-.75Zm16 0a.75.75 0 0 1 .75.75v2A1.75 1.75 0 0 1 19 20.75h-2a.75.75 0 0 1 0-1.5h2a.25.25 0 0 0 .25-.25v-2a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),W=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.755 7.913C2.74 6.996 3.35 5.25 4.765 5.25h14.237c1.18 0 1.878 1.279 1.317 2.277l-6.982 12.448c-.686 1.221-2.484.937-2.792-.408l-1.595-6.96-5.195-4.694Zm6.728 4.667 1.524 6.652a.073.073 0 0 0 .005.016.026.026 0 0 0 .01.002.077.077 0 0 0 .006-.009L18.312 8.04l-7.83 4.54Zm7.063-5.83H4.761a.052.052 0 0 0-.007.013.049.049 0 0 0-.004.025l.01.012 4.965 4.486 7.821-4.536Z",clipRule:"evenodd"})}),G=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 3.25A2.75 2.75 0 0 0 3.25 6v12A2.75 2.75 0 0 0 6 20.75h12A2.75 2.75 0 0 0 20.75 18V6A2.75 2.75 0 0 0 18 3.25H6ZM4.75 6c0-.69.56-1.25 1.25-1.25h12c.69 0 1.25.56 1.25 1.25v12c0 .69-.56 1.25-1.25 1.25H6c-.69 0-1.25-.56-1.25-1.25V6Zm11.78 3.53a.75.75 0 0 0-1.06-1.06l-4.97 4.97-1.47-1.47a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l5.5-5.5Z",clipRule:"evenodd"})}),Y=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 6A2.75 2.75 0 0 1 6 3.25h12A2.75 2.75 0 0 1 20.75 6v12A2.75 2.75 0 0 1 18 20.75H6A2.75 2.75 0 0 1 3.25 18V6Zm13.28 3.53a.75.75 0 0 0-1.06-1.06l-4.97 4.97-1.47-1.47a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l5.5-5.5Z",clipRule:"evenodd"})}),K=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 3.25A2.75 2.75 0 0 0 3.25 6v12A2.75 2.75 0 0 0 6 20.75h12A2.75 2.75 0 0 0 20.75 18V6A2.75 2.75 0 0 0 18 3.25H6ZM4.75 6c0-.69.56-1.25 1.25-1.25h12c.69 0 1.25.56 1.25 1.25v12c0 .69-.56 1.25-1.25 1.25H6c-.69 0-1.25-.56-1.25-1.25V6Z",clipRule:"evenodd"})}),X=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7.25 5.5H5a.5.5 0 0 0-.5.5v12a.5.5 0 0 0 .5.5h2.25v-13Zm1.5 0v2.75H19.5V6a.5.5 0 0 0-.5-.5H8.75Zm0 4.25v8.75H19a.5.5 0 0 0 .5-.5V9.75H8.75Zm0 10.25H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H8.75Z",clipRule:"evenodd"})}),Q=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),J=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11 5.75a4.25 4.25 0 0 0-4.147 5.183.75.75 0 0 1-.568.896A3.252 3.252 0 0 0 7 18.25h9a4.25 4.25 0 1 0-.085-8.5.75.75 0 0 1-.75-.6A4.252 4.252 0 0 0 11 5.75ZM5.25 10a5.75 5.75 0 0 1 11.235-1.73A5.75 5.75 0 0 1 16 19.75H7a4.75 4.75 0 0 1-1.722-9.178A5.81 5.81 0 0 1 5.25 10Z",clipRule:"evenodd"})}),ee=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.982 4.272a.75.75 0 0 1 .546.91l-3.6 14.4a.75.75 0 1 1-1.456-.364l3.6-14.4a.75.75 0 0 1 .91-.546ZM7.13 8.07a.75.75 0 0 1 0 1.06L4.06 12.2l3.07 3.07a.75.75 0 0 1-1.06 1.06l-3.6-3.6a.75.75 0 0 1 0-1.06l3.6-3.6a.75.75 0 0 1 1.06 0Zm9.74 0a.75.75 0 0 1 1.06 0l3.6 3.6a.75.75 0 0 1 0 1.06l-3.6 3.6a.75.75 0 1 1-1.06-1.06l3.07-3.07-3.07-3.07a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),et=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.25 6A2.75 2.75 0 0 1 5 3.25h14A2.75 2.75 0 0 1 21.75 6v12A2.75 2.75 0 0 1 19 20.75H5A2.75 2.75 0 0 1 2.25 18V6ZM5 4.75c-.69 0-1.25.56-1.25 1.25v12c0 .69.56 1.25 1.25 1.25h14c.69 0 1.25-.56 1.25-1.25V6c0-.69-.56-1.25-1.25-1.25H5Zm5.53 4.62a.75.75 0 0 1 0 1.06l-1.59 1.591 1.59 1.591a.75.75 0 0 1-1.06 1.06l-2.122-2.12a.75.75 0 0 1 0-1.061L9.47 9.37a.75.75 0 0 1 1.06 0Zm2.94 1.06a.75.75 0 1 1 1.06-1.06l2.122 2.12a.75.75 0 0 1 0 1.062l-2.122 2.12a.75.75 0 1 1-1.06-1.06l1.59-1.59-1.59-1.592Z",clipRule:"evenodd"})}),ei=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 5.55a1.95 1.95 0 1 0 0 3.9 1.95 1.95 0 0 0 0-3.9ZM8.55 7.5a3.45 3.45 0 1 1 6.9 0 3.45 3.45 0 0 1-6.9 0ZM5.7 9.15a1.05 1.05 0 1 0 0 2.1 1.05 1.05 0 0 0 0-2.1ZM3.15 10.2a2.55 2.55 0 1 1 5.1 0 2.55 2.55 0 0 1-5.1 0ZM18.3 9.15a1.05 1.05 0 1 0 0 2.1 1.05 1.05 0 0 0 0-2.1Zm-2.55 1.05a2.55 2.55 0 1 1 5.1 0 2.55 2.55 0 0 1-5.1 0ZM12 13.65a3.752 3.752 0 0 0-3.75 3.75v1.05h7.5V17.4A3.752 3.752 0 0 0 12 13.65Zm5.25 4.8h2.85a.15.15 0 0 0 .15-.15v-.9a1.95 1.95 0 0 0-3.213-1.485c.139.471.213.97.213 1.485v1.05Zm-.857-3.925A5.245 5.245 0 0 0 12 12.15a5.245 5.245 0 0 0-4.393 2.375A3.45 3.45 0 0 0 2.25 17.4v.9c0 .911.739 1.65 1.65 1.65h16.2a1.65 1.65 0 0 0 1.65-1.65v-.9a3.45 3.45 0 0 0-5.357-2.875Zm-9.43 1.39A1.95 1.95 0 0 0 3.75 17.4v.9c0 .083.067.15.15.15h2.85V17.4c0-.515.074-1.014.213-1.485Z",clipRule:"evenodd"})}),es=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7.53 3.47a.75.75 0 0 0-1.06 1.06l5 5a.75.75 0 0 0 1.06 0l5-5a.75.75 0 0 0-1.06-1.06L12 7.94 7.53 3.47Zm0 17.06a.75.75 0 0 1-1.06-1.06l5-5a.75.75 0 0 1 1.06 0l5 5a.75.75 0 1 1-1.06 1.06L12 16.06l-4.47 4.47Z",clipRule:"evenodd"})}),eo=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.607 3.637a2.571 2.571 0 0 0-3.636 0l-1.667 1.666a2.572 2.572 0 0 1-3.251.318c-.23-.154-.544-.16-.74.036l-.656.656a.5.5 0 0 0 0 .708l1.394 1.393-7.39 7.39a2.751 2.751 0 0 0-.456 3.285l-1.043 1.043a.75.75 0 0 0 1.06 1.06l1.043-1.043a2.751 2.751 0 0 0 3.286-.457l7.389-7.389 1.283 1.284a.5.5 0 0 0 .707 0l.657-.657c.195-.195.19-.51.036-.739-.672-1-.567-2.367.317-3.251l1.667-1.667a2.571 2.571 0 0 0 0-3.636ZM5.722 16.864l7.39-7.389 1.767 1.768-7.389 7.389a1.25 1.25 0 1 1-1.768-1.768Z",clipRule:"evenodd"})}),er=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.5 3.75a7.75 7.75 0 0 0-7.022 11.033.85.85 0 0 1 .068.5l-.634 3.805 3.804-.634a.851.851 0 0 1 .5.068A7.75 7.75 0 1 0 12.5 3.75ZM3.25 11.5a9.25 9.25 0 1 1 5.517 8.466l-4.506.75a.85.85 0 0 1-.978-.977l.751-4.506A9.22 9.22 0 0 1 3.25 11.5Z",clipRule:"evenodd"})}),ea=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M21.302 8.649A9.25 9.25 0 0 1 8.767 19.966l-4.506.75a.85.85 0 0 1-.978-.977l.751-4.506A9.25 9.25 0 0 1 15.351 2.698a4.236 4.236 0 0 0-.682 1.36 7.75 7.75 0 0 0-9.192 10.725.85.85 0 0 1 .07.5l-.635 3.805 3.804-.634a.851.851 0 0 1 .5.068A7.75 7.75 0 0 0 19.942 9.33a4.235 4.235 0 0 0 1.361-.681Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",d:"M21.75 5.25a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})]}),en=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsxs)("g",{clipPath:"url(#a)",children:[(0,s.jsx)("g",{filter:"url(#b)",children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.5 2.25a9.25 9.25 0 0 0-8.466 12.983l-.75 4.506a.85.85 0 0 0 .977.978l4.506-.751A9.25 9.25 0 1 0 12.5 2.25Z",clipRule:"evenodd"})}),(0,s.jsx)("rect",{width:16,height:16,x:4.5,y:3.5,fill:"url(#c)",rx:8}),(0,s.jsx)("rect",{width:16,height:16,x:4.5,y:3.5,stroke:"currentColor",rx:8})]}),(0,s.jsxs)("defs",{children:[(0,s.jsxs)("filter",{id:"b",width:26.5,height:26.5,x:-.75,y:.25,colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",children:[(0,s.jsx)("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),(0,s.jsx)("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),(0,s.jsx)("feOffset",{dy:2}),(0,s.jsx)("feGaussianBlur",{stdDeviation:2}),(0,s.jsx)("feColorMatrix",{values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.28 0"}),(0,s.jsx)("feBlend",{in2:"BackgroundImageFix",result:"effect1_dropShadow_18870_71976"}),(0,s.jsx)("feBlend",{in:"SourceGraphic",in2:"effect1_dropShadow_18870_71976",result:"shape"})]}),(0,s.jsx)("pattern",{id:"c",width:1,height:1,patternContentUnits:"objectBoundingBox",children:(0,s.jsx)("use",{xlinkHref:"#d",transform:"scale(.00424)"})}),(0,s.jsx)("clipPath",{id:"a",children:(0,s.jsx)("path",{fill:"currentColor",d:"M0 0H24V24H0z"})})]})]}),el=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.989 9.742a.75.75 0 0 1-.75-.75V4.978a.75.75 0 0 1 1.5 0v2.203l3.736-3.736a.75.75 0 1 1 1.06 1.06L16.8 8.242h2.203a.75.75 0 1 1 0 1.5h-4.013Zm0 4.491a.75.75 0 0 0-.75.75v4.014a.75.75 0 1 0 1.5 0v-2.203l3.736 3.736a.75.75 0 1 0 1.06-1.06L16.8 15.733h2.203a.75.75 0 1 0 0-1.5h-4.013Zm-5.328.75a.75.75 0 0 0-.75-.75H4.898a.75.75 0 0 0 0 1.5H7.1L3.364 19.47a.75.75 0 1 0 1.06 1.06l3.737-3.736v2.203a.75.75 0 1 0 1.5 0v-4.014Zm-.75-5.241a.75.75 0 0 0 .75-.75V4.978a.75.75 0 1 0-1.5 0v2.203L4.425 3.445a.75.75 0 1 0-1.06 1.06L7.1 8.242H4.898a.75.75 0 0 0 0 1.5H8.91Z",clipRule:"evenodd"})}),ec=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.25 6.5a3.25 3.25 0 1 1 1.582 2.79L9.29 15.832a3.25 3.25 0 1 1-1.046-1.075l6.513-6.514A3.235 3.235 0 0 1 14.25 6.5Zm3.25-1.75a1.75 1.75 0 1 0 0 3.5 1.75 1.75 0 0 0 0-3.5Zm-11 11a1.75 1.75 0 1 0 0 3.5 1.75 1.75 0 0 0 0-3.5Z",clipRule:"evenodd"})}),ed=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.97 2.02a.75.75 0 0 1 1.06 0l4.88 4.879a.85.85 0 0 1 0 1.202l-4.88 4.88a.75.75 0 1 1-1.06-1.062l3.67-3.669H18c-3.151 0-4.552.758-5.25 1.662-.745.963-.873 2.28-1.002 3.898l-.008.101c-.119 1.486-.259 3.245-1.303 4.595C9.323 19.946 7.349 20.75 4 20.75a.75.75 0 1 1 0-1.5c3.151 0 4.552-.758 5.25-1.662.745-.963.873-2.28 1.002-3.898l.008-.1c.119-1.487.259-3.246 1.303-4.596C12.677 7.554 14.651 6.75 18 6.75h1.64l-3.67-3.67a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),eh=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M17.03 2.02a.75.75 0 1 0-1.06 1.06l3.67 3.67H14a2.75 2.75 0 0 0-2.75 2.75V18c0 .69-.56 1.25-1.25 1.25H3a.75.75 0 0 0 0 1.5h7A2.75 2.75 0 0 0 12.75 18V9.5c0-.69.56-1.25 1.25-1.25h5.64l-3.67 3.67a.75.75 0 1 0 1.06 1.06l4.88-4.879a.85.85 0 0 0 0-1.202L17.03 2.02Z"})}),eu=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M13 3.25a.75.75 0 0 0 0 1.5h5.19L3.47 19.47a.75.75 0 1 0 1.06 1.06L19.25 5.81V11a.75.75 0 0 0 1.5 0V4.1a.85.85 0 0 0-.85-.85H13Z"})}),ep=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.286 2.964A3.036 3.036 0 0 0 3.25 6v7.5a3.036 3.036 0 0 0 3.036 3.036H7.82v3.821a.75.75 0 0 0 1.28.53l4.352-4.351h4.261A3.036 3.036 0 0 0 20.75 13.5V6a3.036 3.036 0 0 0-3.036-3.036H6.286ZM4.75 6c0-.848.688-1.536 1.536-1.536h11.428c.848 0 1.536.688 1.536 1.536v7.5c0 .848-.688 1.536-1.536 1.536h-4.571a.75.75 0 0 0-.53.22l-3.292 3.29v-2.76a.75.75 0 0 0-.75-.75H6.286A1.536 1.536 0 0 1 4.75 13.5V6Zm3.75 4.8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm4.5-1a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm2.5 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"})}),ef=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.192 4.25a.75.75 0 1 0 0 1.5h8.539c.69 0 1.25.56 1.25 1.25v7.728l-1.605-1.604a.75.75 0 0 0-1.06 1.06L18.2 17.07a.75.75 0 0 0 1.06 0l2.885-2.885a.75.75 0 0 0-1.06-1.06l-1.605 1.604V7a2.75 2.75 0 0 0-2.75-2.75H8.192Zm7.231 15.5a.75.75 0 0 0 0-1.5H6.885c-.69 0-1.25-.56-1.25-1.25V9.272l1.604 1.604a.75.75 0 1 0 1.06-1.06L5.416 6.93a.75.75 0 0 0-1.06 0L1.47 9.816a.75.75 0 0 0 1.06 1.06l1.605-1.604V17a2.75 2.75 0 0 0 2.75 2.75h8.538Z",clipRule:"evenodd"})}),eg=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 6A2.75 2.75 0 0 1 6 3.25h8A2.75 2.75 0 0 1 16.75 6v1.25H18A2.75 2.75 0 0 1 20.75 10v8A2.75 2.75 0 0 1 18 20.75h-8A2.75 2.75 0 0 1 7.25 18v-1.25H6A2.75 2.75 0 0 1 3.25 14V6Zm5.5 12c0 .69.56 1.25 1.25 1.25h8c.69 0 1.25-.56 1.25-1.25v-8c0-.69-.56-1.25-1.25-1.25h-8c-.69 0-1.25.56-1.25 1.25v8Zm6.5-10.75H10A2.75 2.75 0 0 0 7.25 10v5.25H6c-.69 0-1.25-.56-1.25-1.25V6c0-.69.56-1.25 1.25-1.25h8c.69 0 1.25.56 1.25 1.25v1.25Z",clipRule:"evenodd"})}),em=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M4.8 3.25H3.25V4.8h1.5v-.05h.05v-1.5ZM8 3.25H6.4v1.5H8v-1.5ZM9.6 3.25v1.5H16A3.25 3.25 0 0 1 19.25 8v6.4h1.5V8A4.75 4.75 0 0 0 16 3.25H9.6ZM3.25 6.4V8h1.5V6.4h-1.5ZM3.25 9.6v1.6h1.5V9.6h-1.5ZM3.25 12.8v1.6h1.5v-1.6h-1.5ZM20.75 17.6V16h-1.5v1.6h1.5ZM3.25 16v1.6h1.5V16h-1.5ZM20.75 20.75V19.2h-1.5v.05h-.05v1.5h1.55ZM4.75 19.2h-1.5v1.55H4.8v-1.5h-.05v-.05ZM6.4 20.75H8v-1.5H6.4v1.5ZM9.6 20.75h1.6v-1.5H9.6v1.5ZM12.8 20.75h1.6v-1.5h-1.6v1.5ZM16 20.75h1.6v-1.5H16v1.5Z"})}),ev=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.75 3.5a.75.75 0 0 0-1.5 0v.75H5A2.75 2.75 0 0 0 2.25 7v12A2.75 2.75 0 0 0 5 21.75h6.5a.75.75 0 0 0 0-1.5H5c-.69 0-1.25-.56-1.25-1.25v-8.75h16.5v1.25a.75.75 0 0 0 1.5 0V7A2.75 2.75 0 0 0 19 4.25h-2.25V3.5a.75.75 0 0 0-1.5 0v.75h-6.5V3.5Zm6.5 3v-.75h-6.5v.75a.75.75 0 0 1-1.5 0v-.75H5c-.69 0-1.25.56-1.25 1.25v1.75h16.5V7c0-.69-.56-1.25-1.25-1.25h-2.25v.75a.75.75 0 0 1-1.5 0Zm4.78 6.97a.75.75 0 0 0-1.06 0l-5.098 5.098a.75.75 0 0 0-.22.531l.004 2.224a.75.75 0 0 0 .748.75l2.225.003c.2 0 .39-.079.531-.22l5.098-5.098a.75.75 0 0 0 0-1.06L20.03 13.47Zm-4.878 5.938 4.348-4.347 1.167 1.167-4.347 4.347-1.165-.002-.002-1.165Z",clipRule:"evenodd"})}),ey=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.95 6.066C14.2 4.301 16.352 3.25 20 3.25a.75.75 0 0 1 0 1.5c-3.352 0-4.95.949-5.825 2.184-.933 1.317-1.175 3.11-1.43 5.159l-.013.098c-.24 1.927-.51 4.088-1.682 5.742C9.8 19.7 7.647 20.75 4 20.75a.75.75 0 0 1 0-1.5c3.352 0 4.95-.949 5.825-2.183.933-1.318 1.175-3.11 1.43-5.16l.013-.098c.24-1.927.51-4.088 1.682-5.743Z",clipRule:"evenodd"})}),eb=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 6A2.75 2.75 0 0 1 6 3.25h2.5a.75.75 0 0 1 0 1.5H6c-.69 0-1.25.56-1.25 1.25v2.5a.75.75 0 0 1-1.5 0V6Zm11.5-2a.75.75 0 0 1 .75-.75H18A2.75 2.75 0 0 1 20.75 6v2.5a.75.75 0 0 1-1.5 0V6c0-.69-.56-1.25-1.25-1.25h-2.5a.75.75 0 0 1-.75-.75ZM4 14.75a.75.75 0 0 1 .75.75V18c0 .69.56 1.25 1.25 1.25h3a.75.75 0 0 1 0 1.5H6A2.75 2.75 0 0 1 3.25 18v-2.5a.75.75 0 0 1 .75-.75Zm16 0a.75.75 0 0 1 .75.75V18A2.75 2.75 0 0 1 18 20.75h-3a.75.75 0 0 1 0-1.5h3c.69 0 1.25-.56 1.25-1.25v-2.5a.75.75 0 0 1 .75-.75ZM7.25 9c0-.966.784-1.75 1.75-1.75h6c.966 0 1.75.784 1.75 1.75v6A1.75 1.75 0 0 1 15 16.75H9A1.75 1.75 0 0 1 7.25 15V9ZM9 8.75a.25.25 0 0 0-.25.25v6c0 .138.112.25.25.25h6a.25.25 0 0 0 .25-.25V9a.25.25 0 0 0-.25-.25H9Z",clipRule:"evenodd"})}),ew=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 12a.75.75 0 0 1 .75-.75h16a.75.75 0 0 1 0 1.5H4a.75.75 0 0 1-.75-.75ZM12.53 10.53a.75.75 0 0 1-1.06 0l-3-3a.75.75 0 0 1 1.06-1.06L12 8.94l2.47-2.47a.75.75 0 1 1 1.06 1.06l-3 3ZM15.53 17.53a.75.75 0 0 1-1.06 0L12 15.06l-2.47 2.47a.75.75 0 0 1-1.06-1.06l3-3a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1 0 1.06Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 2.25a.75.75 0 0 1 .75.75v6a.75.75 0 0 1-1.5 0V3a.75.75 0 0 1 .75-.75ZM11.25 21v-7h1.5v7a.75.75 0 0 1-1.5 0Z",clipRule:"evenodd"})]}),ex=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.33 3.47a.75.75 0 0 1 .187.748 7.425 7.425 0 0 0 9.265 9.265.75.75 0 0 1 .936.934A8.925 8.925 0 1 1 9.582 3.282a.75.75 0 0 1 .747.188ZM8.772 5.223a7.425 7.425 0 1 0 10.005 10.004A8.925 8.925 0 0 1 8.772 5.223Z",clipRule:"evenodd"})}),e_=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.53 3.53a.75.75 0 0 1 0 1.061l-3.189 3.19a.75.75 0 0 1-1.06-1.061l3.189-3.19a.75.75 0 0 1 1.06 0Zm-6.375 6.375a.75.75 0 0 1 0 1.061l-3.189 3.19a.75.75 0 0 1-1.06-1.061l3.189-3.19a.75.75 0 0 1 1.06 0ZM7.78 17.341a.75.75 0 0 0-1.06-1.06L3.53 19.47a.75.75 0 1 0 1.061 1.06l3.19-3.189Z",clipRule:"evenodd"})}),eC=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5.5 3.75A1.75 1.75 0 0 0 3.75 5.5V18c0 .966.784 1.75 1.75 1.75h4A1.75 1.75 0 0 0 11.25 18V5.5A1.75 1.75 0 0 0 9.5 3.75h-4ZM5.25 5.5a.25.25 0 0 1 .25-.25h4a.25.25 0 0 1 .25.25V18a.25.25 0 0 1-.25.25h-4a.25.25 0 0 1-.25-.25V5.5Zm9.25-1.75a1.75 1.75 0 0 0-1.75 1.75v7c0 .966.784 1.75 1.75 1.75h4a1.75 1.75 0 0 0 1.75-1.75v-7a1.75 1.75 0 0 0-1.75-1.75h-4Zm-.25 1.75a.25.25 0 0 1 .25-.25h4a.25.25 0 0 1 .25.25v7a.25.25 0 0 1-.25.25h-4a.25.25 0 0 1-.25-.25v-7Z",clipRule:"evenodd"})}),ek=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 3.25A2.75 2.75 0 0 0 2.25 6v12A2.75 2.75 0 0 0 5 20.75h14A2.75 2.75 0 0 0 21.75 18V6A2.75 2.75 0 0 0 19 3.25H5ZM3.75 6c0-.69.56-1.25 1.25-1.25h2.25v3.5h-3.5V6Zm3.5 3.75h-3.5v3.5h3.5v-3.5Zm1.5 3.5v-3.5h11.5v3.5H8.75Zm-1.5 1.5h-3.5V18c0 .69.56 1.25 1.25 1.25h2.25v-4.5Zm1.5 4.5v-4.5h11.5V18c0 .69-.56 1.25-1.25 1.25H8.75Zm0-11v-3.5H19c.69 0 1.25.56 1.25 1.25v2.25H8.75Z",clipRule:"evenodd"})}),eS=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 6A2.75 2.75 0 0 1 6 3.25h12A2.75 2.75 0 0 1 20.75 6v12A2.75 2.75 0 0 1 18 20.75H6A2.75 2.75 0 0 1 3.25 18V6ZM6 4.75c-.69 0-1.25.56-1.25 1.25v2.25h14.5V6c0-.69-.56-1.25-1.25-1.25H6ZM4.75 18V9.75h3v9.5H6c-.69 0-1.25-.56-1.25-1.25Zm4.5 1.25H18c.69 0 1.25-.56 1.25-1.25V9.75h-10v9.5Z",clipRule:"evenodd"})}),eM=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.205 2.787c.393 0 .712.319.712.712v.711h6.166V3.5a.712.712 0 0 1 1.423 0v.711h2.135a2.609 2.609 0 0 1 2.609 2.61v11.384a2.609 2.609 0 0 1-2.609 2.609H5.359a2.609 2.609 0 0 1-2.609-2.61V6.82A2.609 2.609 0 0 1 5.359 4.21h2.135V3.5c0-.393.318-.712.711-.712Zm6.878 2.846v.712a.712.712 0 0 0 1.423 0v-.712h2.135c.655 0 1.186.531 1.186 1.186v1.66H4.173V6.82c0-.655.531-1.186 1.186-1.186h2.135v.712a.712.712 0 1 0 1.423 0v-.712h6.166Zm-10.91 4.27h15.654v8.3c0 .656-.531 1.187-1.186 1.187H5.359c-.655 0-1.186-.531-1.186-1.186V9.903Z",clipRule:"evenodd"})}),eE=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11 2.25A2.75 2.75 0 0 0 8.25 5v1.15H4a.85.85 0 0 0 0 1.7h.309l.81 11.346a2.75 2.75 0 0 0 2.743 2.554h8.276a2.75 2.75 0 0 0 2.743-2.554l.81-11.346H20a.85.85 0 0 0 0-1.7h-4.25V5A2.75 2.75 0 0 0 13 2.25h-2Zm3.25 3.9V5c0-.69-.56-1.25-1.25-1.25h-2c-.69 0-1.25.56-1.25 1.25v1.15h4.5Zm3.937 1.7H5.813l.802 11.24a1.25 1.25 0 0 0 1.247 1.16h8.276c.656 0 1.2-.507 1.247-1.16l.802-11.24ZM10.75 11a.75.75 0 0 0-1.5 0v6a.75.75 0 0 0 1.5 0v-6Zm3.25-.75a.75.75 0 0 1 .75.75v6a.75.75 0 0 1-1.5 0v-6a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),eI=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.25 5A2.75 2.75 0 0 1 11 2.25h2A2.75 2.75 0 0 1 15.75 5v1.25H20a.75.75 0 0 1 0 1.5h-.302l-.817 11.446a2.75 2.75 0 0 1-2.743 2.554H7.862a2.75 2.75 0 0 1-2.743-2.554L4.302 7.75H4a.75.75 0 0 1 0-1.5h4.25V5Zm6 0v1.25h-4.5V5c0-.69.56-1.25 1.25-1.25h2c.69 0 1.25.56 1.25 1.25ZM5.805 7.75h12.39l-.81 11.34a1.25 1.25 0 0 1-1.247 1.16H7.862a1.25 1.25 0 0 1-1.247-1.16l-.81-11.34Zm4.725 3.22a.75.75 0 1 0-1.06 1.06l1.47 1.47-1.47 1.47a.75.75 0 1 0 1.06 1.06L12 14.56l1.47 1.47a.75.75 0 1 0 1.06-1.06l-1.47-1.47 1.47-1.47a.75.75 0 1 0-1.06-1.06L12 12.44l-1.47-1.47Z",clipRule:"evenodd"})}),eB=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11 2.25A2.75 2.75 0 0 0 8.25 5v1.25H4a.75.75 0 0 0 0 1.5h.302l.817 11.446a2.75 2.75 0 0 0 2.743 2.554H10.5a.75.75 0 0 0 0-1.5H7.862a1.25 1.25 0 0 1-1.247-1.16l-.81-11.34h12.39l-.229 3.197a.75.75 0 1 0 1.496.106l.236-3.303H20a.75.75 0 0 0 0-1.5h-4.25V5A2.75 2.75 0 0 0 13 2.25h-2Zm3.25 4V5c0-.69-.56-1.25-1.25-1.25h-2c-.69 0-1.25.56-1.25 1.25v1.25h4.5ZM10.75 11a.75.75 0 0 0-1.5 0v6a.75.75 0 0 0 1.5 0v-6Zm3.25-.75a.75.75 0 0 1 .75.75v1a.75.75 0 0 1-1.5 0v-1a.75.75 0 0 1 .75-.75Zm3 4.5a3.25 3.25 0 1 0 0 6.5 3.25 3.25 0 0 0 0-6.5ZM12.25 18a4.75 4.75 0 1 1 9.5 0 4.75 4.75 0 0 1-9.5 0Zm5.5-1.5a.75.75 0 0 0-1.5 0V18c0 .199.079.39.22.53l1 1a.75.75 0 1 0 1.06-1.06l-.78-.78V16.5Z",clipRule:"evenodd"})}),e$=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 1.94 22.06 12 12 22.06 1.94 12 12 1.94ZM4.06 12 12 19.94 19.94 12 12 4.06 4.06 12Z",clipRule:"evenodd"})}),eT=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M18.922 5.647a16.174 16.174 0 0 0-4.066-1.267.086.086 0 0 0-.067.029c-.171.314-.371.723-.505 1.038a15.325 15.325 0 0 0-4.571 0 9.55 9.55 0 0 0-.515-1.038c-.01-.02-.038-.029-.066-.029-1.429.248-2.79.676-4.067 1.267-.01 0-.02.01-.029.019-2.59 3.876-3.304 7.648-2.952 11.381 0 .02.01.038.029.048a16.545 16.545 0 0 0 4.99 2.524c.029.01.057 0 .067-.02.38-.523.724-1.076 1.019-1.657.019-.038 0-.076-.038-.085a11.711 11.711 0 0 1-1.562-.743c-.038-.02-.038-.076-.01-.105.105-.076.21-.162.315-.238.019-.02.047-.02.066-.01 3.277 1.496 6.81 1.496 10.048 0a.059.059 0 0 1 .067.01c.105.086.21.162.314.247.038.03.038.086-.01.105a10.21 10.21 0 0 1-1.561.743c-.038.01-.048.057-.038.086.304.58.647 1.133 1.019 1.657.028.01.057.02.085.01a16.479 16.479 0 0 0 5-2.524.052.052 0 0 0 .03-.048c.418-4.314-.696-8.057-2.953-11.381-.01-.01-.02-.02-.038-.02ZM8.684 14.77c-.98 0-1.8-.905-1.8-2.02 0-1.114.8-2.018 1.8-2.018 1.01 0 1.81.914 1.8 2.019 0 1.114-.8 2.019-1.8 2.019Zm6.638 0c-.98 0-1.8-.905-1.8-2.02 0-1.114.8-2.018 1.8-2.018 1.01 0 1.81.914 1.8 2.019 0 1.114-.79 2.019-1.8 2.019Z"})}),eO=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 3.25a.75.75 0 0 1 .75.75v16a.75.75 0 0 1-1.5 0V4A.75.75 0 0 1 5 3.25Zm14 0a.75.75 0 0 1 .75.75v16a.75.75 0 0 1-1.5 0V4a.75.75 0 0 1 .75-.75ZM10.5 16a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1h-1a1 1 0 0 0-1 1v9Z",clipRule:"evenodd"})}),eP=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.75 5a.75.75 0 0 1-.75.75H4a.75.75 0 0 1 0-1.5h16a.75.75 0 0 1 .75.75Zm0 14a.75.75 0 0 1-.75.75H4a.75.75 0 0 1 0-1.5h16a.75.75 0 0 1 .75.75ZM7.5 10.5a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1h9a1 1 0 0 0 1-1v-1a1 1 0 0 0-1-1h-9Z",clipRule:"evenodd"})}),eH=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4 4.25a.75.75 0 0 1 .75.75v1c0 .69.56 1.25 1.25 1.25h12c.69 0 1.25-.56 1.25-1.25V5a.75.75 0 0 1 1.5 0v1A2.75 2.75 0 0 1 18 8.75H6A2.75 2.75 0 0 1 3.25 6V5A.75.75 0 0 1 4 4.25Zm0 15.5a.75.75 0 0 0 .75-.75v-1c0-.69.56-1.25 1.25-1.25h12c.69 0 1.25.56 1.25 1.25v1a.75.75 0 0 0 1.5 0v-1A2.75 2.75 0 0 0 18 15.25H6A2.75 2.75 0 0 0 3.25 18v1c0 .414.336.75.75.75Zm-1-8.5a.75.75 0 0 0 0 1.5h1.2a.75.75 0 0 0 0-1.5H3Zm3.45.75a.75.75 0 0 1 .75-.75h1.2a.75.75 0 0 1 0 1.5H7.2a.75.75 0 0 1-.75-.75Zm4.95-.75a.75.75 0 0 0 0 1.5h1.2a.75.75 0 0 0 0-1.5h-1.2Zm3.45.75a.75.75 0 0 1 .75-.75h1.2a.75.75 0 0 1 0 1.5h-1.2a.75.75 0 0 1-.75-.75Zm4.95-.75a.75.75 0 0 0 0 1.5H21a.75.75 0 0 0 0-1.5h-1.2Z",clipRule:"evenodd"})}),eA=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4 17.593V6.407c0-.903.353-1.77.98-2.409A3.32 3.32 0 0 1 7.35 3h9.302c.448 0 .812.37.812.826v11.185a.829.829 0 0 1-.256.602.802.802 0 0 1-.556.225H7.35c-.16 0-.318.022-.469.066a1.748 1.748 0 0 0-1.256 1.689c0 .465.181.912.505 1.24.324.33.762.515 1.22.515h11.027V4.686c0-.456.364-.826.812-.826.449 0 .812.37.812.826v15.488a.819.819 0 0 1-.812.826H7.348a3.32 3.32 0 0 1-2.367-.998A3.437 3.437 0 0 1 4 17.592Zm3.772-.826a.819.819 0 0 0-.812.826c0 .456.363.826.812.826h8.456c.449 0 .812-.37.812-.826a.819.819 0 0 0-.812-.826H7.772Z",clipRule:"evenodd"})}),eL=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M19.53 6.47a.75.75 0 0 1 0 1.06l-10 10a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06L9 15.94l9.47-9.47a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})}),eD=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.75 4.75a.75.75 0 0 0-1.5 0v8.69l-2.22-2.22a.75.75 0 0 0-1.06 1.06l3.5 3.5a.75.75 0 0 0 1.06 0l3.5-3.5a.75.75 0 1 0-1.06-1.06l-2.22 2.22V4.75Zm-8 6A.25.25 0 0 1 5 10.5h1A.75.75 0 0 0 6 9H5a1.75 1.75 0 0 0-1.75 1.75v7A2.75 2.75 0 0 0 6 20.5h12a2.75 2.75 0 0 0 2.75-2.75v-7A1.75 1.75 0 0 0 19 9h-1a.75.75 0 0 0 0 1.5h1a.25.25 0 0 1 .25.25v7c0 .69-.56 1.25-1.25 1.25H6c-.69 0-1.25-.56-1.25-1.25v-7Z",clipRule:"evenodd"})}),eZ=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.694 3.62c.271-.661.934-1.12 1.693-1.12.993 0 1.823.786 1.823 1.786v.12c.248-.123.528-.192.822-.192.993 0 1.823.786 1.823 1.786v.978c.248-.123.528-.192.822-.192.994 0 1.823.786 1.823 1.785v6c0 3.84-3.198 6.929-7.113 6.929-.96 0-1.884-.131-2.777-.547-.893-.415-1.717-1.098-2.505-2.146l-3.208-4.001a1.755 1.755 0 0 1 .14-2.376 1.845 1.845 0 0 1 2.592.031l.563.653c.308.376.54.631.714.795v-.01c.015-.235.014-.525.013-.875V5.142c0-.999.83-1.785 1.823-1.785.347 0 .674.096.952.264Zm.87 7.523a.5.5 0 1 1-1 0v-6c0-.42-.354-.786-.822-.786-.468 0-.823.365-.823.786v7.865c.001.352.002.683-.015.952-.01.164-.027.329-.062.475a.989.989 0 0 1-.236.467.691.691 0 0 1-.64.196 1.227 1.227 0 0 1-.497-.246c-.28-.214-.623-.582-1.046-1.099l-.535-.62a.845.845 0 0 0-1.153.014.756.756 0 0 0-.062 1.028l.003.003 3.214 4.01.01.012c.71.948 1.415 1.513 2.132 1.847.719.334 1.488.453 2.355.453 3.39 0 6.113-2.668 6.113-5.929v-6c0-.42-.355-.785-.823-.785-.467 0-.822.365-.822.785V12a.5.5 0 0 1-1 0V6c0-.42-.355-.786-.823-.786-.468 0-.822.365-.822.786v5.143a.5.5 0 0 1-1 0V4.286c0-.421-.355-.786-.823-.786-.468 0-.823.365-.823.786v6.857Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",d:"M11.064 11.643a.5.5 0 0 0 .5-.5V4.286c0-.421.355-.786.823-.786.468 0 .823.365.823.786v6.857a.5.5 0 1 0 1 0V6c0-.42.354-.786.822-.786.468 0 .823.365.823.786v6a.5.5 0 1 0 1 0V8.571c0-.42.355-.785.822-.785.468 0 .823.365.823.785v6c0 3.261-2.724 5.929-6.113 5.929-.867 0-1.636-.119-2.355-.453-.717-.334-1.421-.9-2.132-1.847l-.01-.013-3.214-4.009-.003-.003a.756.756 0 0 1 .062-1.028.845.845 0 0 1 1.153-.014l.535.62c.423.517.766.885 1.046 1.099.138.104.306.209.496.246a.691.691 0 0 0 .641-.196.989.989 0 0 0 .236-.467c.035-.146.052-.31.062-.475.017-.27.016-.6.015-.952V5.143c0-.42.355-.785.823-.785.467 0 .822.365.822.786v6a.5.5 0 0 0 .5.5Z"})]}),ej=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.694 8.335c.271-.662.934-1.12 1.693-1.12.748 0 1.402.445 1.68 1.091.282-.172.613-.27.965-.27.993 0 1.823.786 1.823 1.785v.086c.248-.124.528-.193.822-.193.994 0 1.823.786 1.823 1.786v3.071c0 3.84-3.198 6.929-7.113 6.929-.96 0-1.884-.131-2.777-.547-.894-.416-1.72-1.1-2.509-2.151l-2.015-2.634a1.755 1.755 0 0 1 .144-2.371 1.845 1.845 0 0 1 2.561 0l.009.008.118.122a84.012 84.012 0 0 0 .001-1.145V9.857c0-1 .83-1.786 1.823-1.786.347 0 .674.096.952.264Zm-.13 1.522c0-.42-.354-.786-.822-.786-.468 0-.823.365-.823.786V13.191c.001.471.001.842-.007 1.116-.006.174-.015.33-.035.457a.882.882 0 0 1-.176.442.578.578 0 0 1-.359.2.614.614 0 0 1-.337-.048 1.166 1.166 0 0 1-.317-.228 9.468 9.468 0 0 1-.31-.32c-.093-.097-.19-.201-.287-.3a.845.845 0 0 0-1.164.004.756.756 0 0 0-.061 1.028l.01.013L7.9 18.2c.71.948 1.415 1.513 2.132 1.847.719.334 1.488.453 2.355.453 3.39 0 6.113-2.668 6.113-5.929V11.5c0-.42-.355-.786-.823-.786-.467 0-.822.365-.822.786v.5a.5.5 0 0 1-1 0V9.821c0-.42-.355-.785-.823-.785-.468 0-.822.365-.822.785v1.322a.5.5 0 1 1-1 0V9c0-.42-.355-.786-.823-.786-.468 0-.823.365-.823.786v2.143a.5.5 0 1 1-1 0V9.857Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",d:"M9.742 9.071c.467 0 .822.365.822.786v1.286a.5.5 0 1 0 1 0V9c0-.42.355-.786.823-.786.468 0 .822.365.822.786v2.143a.5.5 0 1 0 1 0V9.82c0-.42.355-.785.823-.785.468 0 .823.365.823.785V12a.5.5 0 1 0 1 0v-.5c0-.42.355-.786.822-.786.468 0 .823.365.823.786v3.071c0 3.261-2.724 5.929-6.113 5.929-.867 0-1.636-.119-2.355-.453-.717-.334-1.421-.9-2.132-1.847l-2.025-2.645-.01-.013a.756.756 0 0 1 .062-1.028.845.845 0 0 1 1.164-.003c.096.098.194.202.286.299.121.128.23.244.31.32.072.067.184.169.318.228.075.033.194.07.337.049a.578.578 0 0 0 .359-.2.882.882 0 0 0 .176-.443c.02-.128.03-.283.035-.457.008-.274.008-.645.007-1.116V9.857c0-.42.355-.786.823-.786Z"})]}),eV=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.667 6.2a.75.75 0 0 1 0-1.5H19a.75.75 0 0 1 .75.75v8.333a.75.75 0 0 1-1.5 0V7.261L6.53 18.98a.75.75 0 1 1-1.06-1.061L17.19 6.2h-6.523Z",clipRule:"evenodd"})}),ez=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 3.25A2.75 2.75 0 0 0 3.25 6v8A2.75 2.75 0 0 0 6 16.75h1.25V18A2.75 2.75 0 0 0 10 20.75h8A2.75 2.75 0 0 0 20.75 18v-8A2.75 2.75 0 0 0 18 7.25h-1.25V6A2.75 2.75 0 0 0 14 3.25H6Zm4 4h5.25V6c0-.69-.56-1.25-1.25-1.25H6c-.69 0-1.25.56-1.25 1.25v8c0 .69.56 1.25 1.25 1.25h2a.75.75 0 0 1 .75.75v2c0 .69.56 1.25 1.25 1.25h8c.69 0 1.25-.56 1.25-1.25v-8c0-.69-.56-1.25-1.25-1.25h-8a1.25 1.25 0 0 0-1.17.81.75.75 0 0 1-1.405-.528A2.75 2.75 0 0 1 10 7.25Zm2.887 3.239a.75.75 0 1 0-1.098 1.022l.688.739H7.8a.75.75 0 0 0 0 1.5h4.677l-.688.739a.75.75 0 0 0 1.098 1.022l1.862-2a.75.75 0 0 0 0-1.022l-1.862-2Z",clipRule:"evenodd"})}),eR=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7.168 4.75a1.868 1.868 0 1 0 0 3.736 1.868 1.868 0 0 0 0-3.736ZM3.8 6.618a3.368 3.368 0 0 1 6.729-.226c.842 0 1.651.014 2.493.217.933.226 1.865.672 2.975 1.504l.02.015.02.017c1.566 1.35 2.35 3.533 2.354 5.578h1.66a.75.75 0 0 1 .75.75v4.713a.75.75 0 0 1-.75.75h-4.714a.75.75 0 0 1-.75-.75v-4.713a.75.75 0 0 1 .75-.75h1.554c-.004-1.705-.663-3.42-1.815-4.426-.975-.728-1.719-1.064-2.406-1.23-.712-.172-1.407-.175-2.36-.175v-.057a3.375 3.375 0 0 1-2.392 2.068v3.904a3.37 3.37 0 0 1-.75 6.652 3.368 3.368 0 0 1-.75-6.652V9.903A3.37 3.37 0 0 1 3.8 6.618Zm3.368 8.605a1.868 1.868 0 1 0 0 3.736 1.868 1.868 0 0 0 0-3.736Zm8.92 3.213v-3.213H19.3v3.213h-3.213Z",clipRule:"evenodd"})}),eF=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M18.303 4.498a.85.85 0 0 1 1.2 0c.33.33.33.863 0 1.192l-.43.428-1.196-1.195.426-.425Zm-1.488 1.485 1.197 1.195-7.086 7.072H9.75v-1.216l7.065-7.051Zm3.747-2.547a2.35 2.35 0 0 0-3.318 0L8.47 12.192a.75.75 0 0 0-.22.531V15c0 .414.336.75.75.75h2.236a.75.75 0 0 0 .53-.22l8.796-8.778c.917-.915.917-2.4 0-3.316ZM4.75 6c0-.69.56-1.25 1.25-1.25h6a.75.75 0 0 0 0-1.5H6A2.75 2.75 0 0 0 3.25 6v12A2.75 2.75 0 0 0 6 20.75h12A2.75 2.75 0 0 0 20.75 18v-6a.75.75 0 0 0-1.5 0v6c0 .69-.56 1.25-1.25 1.25H6c-.69 0-1.25-.56-1.25-1.25V6Z",clipRule:"evenodd"})}),eN=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.25 7A2.75 2.75 0 0 1 14 4.25h7a.75.75 0 0 1 0 1.5h-7c-.69 0-1.25.56-1.25 1.25v10A2.75 2.75 0 0 1 10 19.75H3a.75.75 0 0 1 0-1.5h7c.69 0 1.25-.56 1.25-1.25V7Z",clipRule:"evenodd"})}),eq=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.75a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5ZM2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Z",clipRule:"evenodd"})}),eU=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("circle",{cx:6,cy:20,r:1,fill:"currentColor"}),(0,s.jsx)("circle",{cx:12,cy:20,r:1,fill:"currentColor"}),(0,s.jsx)("circle",{cx:18,cy:20,r:1,fill:"currentColor"})]}),eW=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.25 7A2.75 2.75 0 0 1 5 4.25h14A2.75 2.75 0 0 1 21.75 7v10A2.75 2.75 0 0 1 19 19.75H5A2.75 2.75 0 0 1 2.25 17V7Zm1.5 2.401V17c0 .69.56 1.25 1.25 1.25h14c.69 0 1.25-.56 1.25-1.25V9.401l-6.725 4.483a2.75 2.75 0 0 1-3.05 0L3.75 9.401ZM20.25 7.6l-7.557 5.037c-.42.28-.966.28-1.386 0L3.75 7.6V7c0-.69.56-1.25 1.25-1.25h14c.69 0 1.25.56 1.25 1.25v.599Z",clipRule:"evenodd"})}),eG=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 3.25A2.75 2.75 0 0 0 2.25 6v12A2.75 2.75 0 0 0 5 20.75h14A2.75 2.75 0 0 0 21.75 18V6A2.75 2.75 0 0 0 19 3.25H5Zm15.25 5V6c0-.69-.56-1.25-1.25-1.25H5c-.69 0-1.25.56-1.25 1.25v2.25h16.5Zm-16.5 1.5h16.5V18c0 .69-.56 1.25-1.25 1.25H5c-.69 0-1.25-.56-1.25-1.25V9.75Zm6.78 3.28a.75.75 0 1 0-1.06-1.06L7.348 14.09a.75.75 0 0 0 0 1.06l2.122 2.122a.75.75 0 1 0 1.06-1.06L8.94 14.62l1.59-1.59Zm2.94-1.06a.75.75 0 0 0 0 1.06l1.59 1.591-1.59 1.591a.75.75 0 0 0 1.06 1.061l2.122-2.121a.75.75 0 0 0 0-1.06L14.53 11.97a.75.75 0 0 0-1.06 0ZM6.5 6.55a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Zm1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",clipRule:"evenodd"})}),eY=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.016-10.995a.75.75 0 0 1 0 1.06L13.07 12.01l1.945 1.945a.75.75 0 1 1-1.061 1.06l-1.945-1.944-1.944 1.945a.75.75 0 1 1-1.06-1.061l1.944-1.945-1.945-1.944a.75.75 0 0 1 1.06-1.06l1.945 1.944 1.945-1.945a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})}),eK=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M16.47 7.47a.75.75 0 0 1 1.06 0l4 4a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 1 1-1.06-1.06l2.72-2.72H3a.75.75 0 0 1 0-1.5h16.19l-2.72-2.72a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),eX=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M18 8.25a3.751 3.751 0 0 0-3.675 3H3a.75.75 0 0 0 0 1.5h11.325A3.751 3.751 0 0 0 21.75 12 3.75 3.75 0 0 0 18 8.25Z"})}),eQ=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M17.47 8.47a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1 0 1.06l-3 3a.75.75 0 0 1-1.06 0l-2.78-2.78H3a.75.75 0 0 1 0-1.5h11.69l2.78-2.78Z"})}),eJ=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M17.53 7.47a.75.75 0 0 0-1.28.53v3.25H3a.75.75 0 0 0 0 1.5h13.25V16a.75.75 0 0 0 1.28.53l4-4a.75.75 0 0 0 0-1.06l-4-4Z"})}),e1=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.5 5a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 .75.75v8.5a.75.75 0 0 1-.75.75H6.547l3.352 3.39a.75.75 0 1 1-1.067 1.054l-4.615-4.667a.75.75 0 0 1 0-1.054l4.615-4.667A.75.75 0 0 1 9.9 9.36L6.547 12.75H18v-7h-3.75A.75.75 0 0 1 13.5 5Z",clipRule:"evenodd"})}),e0=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.5 10.25h11v-1.5h-11v1.5Zm0 5.5h11v-1.5h-11v1.5Z",clipRule:"evenodd"})}),e2=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.806 4.95a1.234 1.234 0 0 0-.873.362L12.36 6.885l5.954 5.956 1.575-1.575a1.234 1.234 0 0 0 0-1.745l-4.21-4.209a1.235 1.235 0 0 0-.873-.362Zm2.448 8.952-5.955-5.956-7.188 7.188a1.235 1.235 0 0 0 0 1.745l1.524 1.524c.231.23.546.36.873.36h5.883l4.863-4.861Zm-2.741 4.862h5.113a.75.75 0 0 1 0 1.5H6.508c-.725 0-1.42-.288-1.933-.8L3.05 17.94a2.734 2.734 0 0 1 0-3.867l9.82-9.821a2.734 2.734 0 0 1 3.87 0l4.208 4.208a2.734 2.734 0 0 1 0 3.867l-6.436 6.437Z",clipRule:"evenodd"})}),e5=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7.53 9.53a.75.75 0 0 1-1.06-1.06l5-5a.75.75 0 0 1 1.06 0l5 5a.75.75 0 0 1-1.06 1.06L12 5.06 7.53 9.53Zm0 4.94a.75.75 0 0 0-1.06 1.06l5 5a.75.75 0 0 0 1.06 0l5-5a.75.75 0 1 0-1.06-1.06L12 18.94l-4.47-4.47Z",clipRule:"evenodd"})}),e7=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.53 3.47a.75.75 0 0 1 0 1.06l-4.22 4.22h2.19a.75.75 0 0 1 0 1.5h-4a.75.75 0 0 1-.75-.75v-4a.75.75 0 0 1 1.5 0v2.19l4.22-4.22a.75.75 0 0 1 1.06 0ZM5.5 15.25a.75.75 0 0 1 0-1.5h4a.75.75 0 0 1 .75.75v4a.75.75 0 0 1-1.5 0v-2.19l-4.22 4.22a.75.75 0 0 1-1.06-1.06l4.22-4.22H5.5Z",clipRule:"evenodd"})}),e3=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.25 4a.75.75 0 0 1 .75-.75h4a.75.75 0 0 1 .75.75v4a.75.75 0 0 1-1.5 0V5.81l-4.22 4.22a.75.75 0 1 1-1.06-1.06l4.22-4.22H16a.75.75 0 0 1-.75-.75Zm-5.22 9.97a.75.75 0 0 1 0 1.06l-4.22 4.22H8a.75.75 0 0 1 0 1.5H4a.75.75 0 0 1-.75-.75v-4a.75.75 0 0 1 1.5 0v2.19l4.22-4.22a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})}),e4=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.25 5A.75.75 0 0 1 5 4.25h3.5a.75.75 0 0 1 0 1.5H6.81l3.095 3.095a.75.75 0 0 1-1.06 1.06L5.75 6.811V8.5a.75.75 0 0 1-1.5 0V5Zm10.5 0a.75.75 0 0 1 .75-.75H19a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0V6.81l-3.095 3.095a.75.75 0 1 1-1.06-1.06l3.094-3.095H15.5a.75.75 0 0 1-.75-.75Zm-4.845 9.095a.75.75 0 0 1 0 1.06L6.811 18.25H8.5a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75v-3.5a.75.75 0 0 1 1.5 0v1.69l3.095-3.095a.75.75 0 0 1 1.06 0Zm4.19 0a.75.75 0 0 1 1.06 0l3.095 3.094V15.5a.75.75 0 0 1 1.5 0V19a.75.75 0 0 1-.75.75h-3.5a.75.75 0 0 1 0-1.5h1.69l-3.095-3.095a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),e6=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.624 3.584a.75.75 0 0 1-.208 1.04l-.745.497a8.75 8.75 0 0 1-6.92 12.93v1.199h3.693a.75.75 0 0 1 0 1.5H7.556a.75.75 0 0 1 0-1.5h3.694v-1.198a8.737 8.737 0 0 1-6.088-3.259l-.746.498a.75.75 0 1 1-.832-1.248l1.333-.89a.746.746 0 0 1 .423-.125.75.75 0 0 1 .63.333 7.25 7.25 0 0 0 12.072-8.036.747.747 0 0 1-.125-.428.75.75 0 0 1 .334-.632l1.333-.889a.75.75 0 0 1 1.04.208ZM12 5.639a3.694 3.694 0 1 0 0 7.389 3.694 3.694 0 0 0 0-7.39ZM6.806 9.333a5.194 5.194 0 1 1 10.388 0 5.194 5.194 0 0 1-10.388 0Z",clipRule:"evenodd"})}),e8=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 5.25a.75.75 0 0 0-.75.75v12c0 .414.336.75.75.75h2a.75.75 0 0 0 0-1.5H5.75V6.75H7a.75.75 0 0 0 0-1.5H5Zm14 0a.75.75 0 0 1 .75.75v12a.75.75 0 0 1-.75.75h-2a.75.75 0 0 1 0-1.5h1.25V6.75H17a.75.75 0 0 1 0-1.5h2Z",clipRule:"evenodd"})}),e9=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.47 3.47a.75.75 0 0 1 1.06 0l4 4a.75.75 0 0 1-1.06 1.06l-2.72-2.72V16a.75.75 0 0 1-1.5 0V5.81L8.53 8.53a.75.75 0 0 1-1.06-1.06l4-4ZM4 15.25a.75.75 0 0 1 .75.75v1A2.25 2.25 0 0 0 7 19.25h10A2.25 2.25 0 0 0 19.25 17v-1a.75.75 0 0 1 1.5 0v1A3.75 3.75 0 0 1 17 20.75H7A3.75 3.75 0 0 1 3.25 17v-1a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),te=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 2.25A2.75 2.75 0 0 0 5.25 5v3a.75.75 0 0 0 1.5 0V5c0-.69.56-1.25 1.25-1.25h7.522c.386 0 .75.178.987.483l2.478 3.186c.17.22.263.49.263.767V18c0 .69-.56 1.25-1.25 1.25H8c-.69 0-1.25-.56-1.25-1.25v-1.5a.75.75 0 0 0-1.5 0V18A2.75 2.75 0 0 0 8 20.75h10A2.75 2.75 0 0 0 20.75 18V8.186a2.75 2.75 0 0 0-.58-1.688l-2.477-3.186a2.75 2.75 0 0 0-2.171-1.062H8ZM2.769 13.771c0 .381.206.596.569.596.362 0 .57-.215.57-.596v-.97H5.27v.97c0 .381.207.596.57.596.362 0 .57-.215.57-.596v-2.817c0-.382-.208-.596-.57-.596-.363 0-.57.214-.57.596v.942H3.907v-.942c0-.382-.207-.596-.57-.596-.362 0-.568.214-.568.596v2.817Zm5.051 0c0 .381.207.596.57.596.362 0 .569-.215.569-.596v-2.439h.572c.3 0 .502-.163.502-.453 0-.29-.196-.454-.502-.454H7.248c-.306 0-.502.164-.502.454 0 .29.201.454.502.454h.572v2.438Zm3.046.596c-.317 0-.497-.19-.497-.526v-2.737c0-.478.263-.746.738-.746.4 0 .613.158.774.58l.671 1.748h.021l.67-1.748c.16-.422.373-.58.773-.58.475 0 .738.268.738.746v2.737c0 .336-.18.526-.497.526s-.496-.19-.496-.526v-1.786h-.022l-.77 1.942c-.079.196-.202.284-.404.284-.204 0-.335-.091-.41-.284l-.771-1.942h-.022v1.786c0 .336-.18.526-.496.526Zm4.428-.663c0 .381.207.596.57.596h1.64c.306 0 .502-.164.502-.454 0-.29-.201-.454-.502-.454h-1.071v-2.438c0-.382-.207-.596-.57-.596-.362 0-.57.214-.57.596v2.75Z",clipRule:"evenodd"})}),tt=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 2.25A2.75 2.75 0 0 0 5.25 5v3a.75.75 0 0 0 1.5 0V5c0-.69.56-1.25 1.25-1.25h7.522c.386 0 .75.178.987.483l2.478 3.186c.17.22.263.49.263.767V18c0 .69-.56 1.25-1.25 1.25H8c-.69 0-1.25-.56-1.25-1.25v-1.5a.75.75 0 0 0-1.5 0V18A2.75 2.75 0 0 0 8 20.75h10A2.75 2.75 0 0 0 20.75 18V8.186a2.75 2.75 0 0 0-.58-1.688l-2.477-3.186a2.75 2.75 0 0 0-2.171-1.062H8ZM2.769 13.84c0 .337.18.527.496.527.317 0 .497-.19.497-.526v-1.786h.022l.77 1.942c.076.193.207.284.411.284.202 0 .325-.088.403-.284l.77-1.942h.022v1.786c0 .336.18.526.497.526s.497-.19.497-.526v-2.737c0-.478-.263-.746-.738-.746-.4 0-.613.158-.774.58l-.669 1.748h-.021l-.671-1.748c-.162-.422-.374-.58-.774-.58-.475 0-.738.268-.738.746v2.737Zm4.925-.136c0 .381.207.596.57.596H9.35c1.173 0 1.866-.725 1.866-1.966 0-1.24-.69-1.91-1.866-1.91H8.263c-.362 0-.57.216-.57.597v2.683Zm1.496-.309h-.357V11.33h.357c.545 0 .867.352.867 1.004 0 .715-.298 1.061-.867 1.061Z",clipRule:"evenodd"})}),ti=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 2.25A2.75 2.75 0 0 0 5.25 5v3a.75.75 0 0 0 1.5 0V5c0-.69.56-1.25 1.25-1.25h7.522c.386 0 .75.178.987.483l2.478 3.186c.17.22.263.49.263.767V18c0 .69-.56 1.25-1.25 1.25H8c-.69 0-1.25-.56-1.25-1.25v-1.5a.75.75 0 0 0-1.5 0V18A2.75 2.75 0 0 0 8 20.75h10A2.75 2.75 0 0 0 20.75 18V8.186a2.75 2.75 0 0 0-.58-1.688l-2.477-3.186a2.75 2.75 0 0 0-2.171-1.062H8ZM2.793 13.923c0 .416.226.65.621.65.396 0 .621-.234.621-.65v-.577h.604c.987 0 1.658-.6 1.658-1.533 0-.94-.633-1.54-1.573-1.54h-1.31c-.395 0-.621.234-.621.65v3Zm1.59-1.494h-.348v-1.222h.358c.404 0 .65.208.65.61 0 .404-.246.612-.66.612Zm2.353 1.42c0 .417.226.651.621.651h1.187c1.28 0 2.036-.791 2.036-2.145 0-1.353-.753-2.082-2.036-2.082H7.357c-.395 0-.62.234-.62.65v2.927Zm1.632-.336h-.39V11.26h.39c.595 0 .946.384.946 1.095 0 .78-.325 1.158-.946 1.158Zm2.698.41c0 .416.226.65.621.65.396 0 .622-.234.622-.65v-.92h1.113c.316 0 .51-.17.51-.466 0-.296-.2-.466-.51-.466h-1.113v-.808h1.239c.328 0 .548-.179.548-.495 0-.317-.214-.495-.548-.495h-1.86c-.396 0-.622.234-.622.65v3Z",clipRule:"evenodd"})}),ts=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 2.25A2.75 2.75 0 0 0 5.25 5v3a.75.75 0 0 0 1.5 0V5c0-.69.56-1.25 1.25-1.25h7.522c.386 0 .75.178.987.483l2.478 3.186c.17.22.263.49.263.767V18c0 .69-.56 1.25-1.25 1.25H8c-.69 0-1.25-.56-1.25-1.25v-1.5a.75.75 0 0 0-1.5 0V18A2.75 2.75 0 0 0 8 20.75h10A2.75 2.75 0 0 0 20.75 18V8.186a2.75 2.75 0 0 0-.58-1.688l-2.477-3.186a2.75 2.75 0 0 0-2.171-1.062H8ZM2.793 13.923c0 .416.226.65.621.65.396 0 .621-.234.621-.65v-.577h.604c.987 0 1.658-.6 1.658-1.533 0-.94-.633-1.54-1.573-1.54h-1.31c-.395 0-.621.234-.621.65v3Zm1.59-1.494h-.348v-1.222h.358c.404 0 .65.208.65.61 0 .404-.246.612-.66.612Zm2.353 1.529c0 .398.214.615.586.615.37 0 .586-.217.586-.615v-1.685h.024l1.444 1.96c.176.24.343.34.58.34.37 0 .571-.202.571-.574v-3.184c0-.399-.213-.616-.586-.616-.369 0-.586.217-.586.616v1.649h-.023l-1.433-1.925c-.178-.237-.351-.34-.577-.34-.38 0-.586.2-.586.574v3.185Zm4.275-1.576c0 1.403.794 2.191 2.136 2.191 1.26 0 1.957-.773 1.957-1.778 0-.416-.226-.65-.622-.65h-.817c-.281 0-.46.146-.46.413 0 .266.182.413.46.413h.243l-.006.058c-.035.34-.322.566-.726.566-.545 0-.9-.46-.9-1.23 0-.754.31-1.187.838-1.187.3 0 .501.111.7.378a.68.68 0 0 0 .58.296c.317 0 .534-.214.534-.525a.646.646 0 0 0-.085-.32c-.25-.444-.888-.808-1.735-.808-1.303 0-2.097.797-2.097 2.183Z",clipRule:"evenodd"})}),to=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 2.25A2.75 2.75 0 0 0 5.25 5v3a.75.75 0 0 0 1.5 0V5c0-.69.56-1.25 1.25-1.25h7.522c.386 0 .75.178.987.483l2.478 3.186c.17.22.263.49.263.767V18c0 .69-.56 1.25-1.25 1.25H8c-.69 0-1.25-.56-1.25-1.25v-1.5a.75.75 0 0 0-1.5 0V18A2.75 2.75 0 0 0 8 20.75h10A2.75 2.75 0 0 0 20.75 18V8.186a2.75 2.75 0 0 0-.58-1.688l-2.477-3.186a2.75 2.75 0 0 0-2.171-1.062H8ZM2.787 13.674c.167.379.672.693 1.545.693 1.068 0 1.691-.507 1.691-1.305 0-.628-.392-.97-1.224-1.12l-.39-.07c-.386-.07-.553-.153-.553-.327 0-.175.161-.315.478-.315.245 0 .425.073.55.266.138.207.29.29.532.29.285-.002.473-.177.473-.435a.594.594 0 0 0-.048-.239c-.202-.483-.752-.754-1.52-.754-.921 0-1.593.491-1.593 1.27 0 .601.422.99 1.193 1.128l.39.07c.434.077.585.155.585.338 0 .19-.21.33-.551.33-.255 0-.48-.078-.615-.268-.153-.215-.298-.282-.513-.282-.282 0-.489.188-.489.462 0 .088.02.18.06.268Zm4.354-.024c.177.497.467.717.948.717.478 0 .773-.223.948-.717l.867-2.455a.864.864 0 0 0 .051-.3c0-.32-.236-.537-.588-.537-.309 0-.486.14-.572.448l-.663 2.414H8.11l-.671-2.398c-.089-.32-.274-.464-.596-.464-.363 0-.61.228-.61.558 0 .118.019.226.05.32l.858 2.414Zm3.015-1.292c0 1.287.728 2.01 1.958 2.01 1.155 0 1.794-.71 1.794-1.631 0-.381-.207-.596-.57-.596h-.748c-.258 0-.422.134-.422.379 0 .244.167.378.422.378h.223l-.006.054c-.032.311-.295.518-.666.518-.5 0-.824-.421-.824-1.128 0-.69.284-1.087.768-1.087.274 0 .459.102.642.346.14.185.308.271.531.271.29 0 .49-.196.49-.48a.592.592 0 0 0-.079-.293c-.228-.408-.814-.741-1.59-.741-1.195 0-1.923.73-1.923 2Z",clipRule:"evenodd"})}),tr=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.362 3.22c.57-1.51 2.707-1.51 3.276 0l1.56 4.144a.25.25 0 0 0 .223.162l4.423.203c1.613.075 2.273 2.107 1.012 3.115l-3.459 2.765a.25.25 0 0 0-.085.262l1.173 4.27c.428 1.556-1.3 2.812-2.65 1.924l-3.698-2.435a.25.25 0 0 0-.274 0l-3.699 2.435c-1.348.888-3.077-.368-2.65-1.925l1.174-4.27a.25.25 0 0 0-.085-.26l-3.459-2.766c-1.261-1.008-.6-3.04 1.012-3.115l4.423-.203a.25.25 0 0 0 .223-.162l1.56-4.144Zm1.872.529a.25.25 0 0 0-.468 0l-1.56 4.144a1.75 1.75 0 0 1-1.558 1.131l-4.423.204a.25.25 0 0 0-.144.445l3.458 2.764a1.75 1.75 0 0 1 .595 1.831l-1.173 4.27a.25.25 0 0 0 .378.275l3.699-2.435a1.75 1.75 0 0 1 1.924 0l3.698 2.435a.25.25 0 0 0 .379-.275l-1.173-4.27a1.75 1.75 0 0 1 .595-1.83l3.458-2.765a.25.25 0 0 0-.144-.445l-4.423-.204a1.75 1.75 0 0 1-1.558-1.131l-1.56-4.144Z",clipRule:"evenodd"})}),ta=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.638 3.22c-.57-1.51-2.707-1.51-3.276 0l-1.56 4.144a.25.25 0 0 1-.223.162l-4.423.203c-1.613.075-2.273 2.107-1.012 3.115l3.459 2.765a.25.25 0 0 1 .085.262l-1.173 4.27c-.428 1.556 1.3 2.812 2.65 1.924l3.698-2.435a.25.25 0 0 1 .274 0l3.699 2.435c1.348.888 3.077-.368 2.65-1.925l-1.174-4.27a.25.25 0 0 1 .085-.26l3.459-2.766c1.261-1.008.6-3.04-1.012-3.115l-4.423-.203a.25.25 0 0 1-.223-.162l-1.56-4.144Z",clipRule:"evenodd"})}),tn=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",d:"M8.418 22.503a3.418 3.418 0 0 0 3.418-3.417v-3.417H8.418a3.418 3.418 0 0 0 0 6.834Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M5.001 12.251a3.418 3.418 0 0 1 3.417-3.417h3.418v6.835H8.418a3.418 3.418 0 0 1-3.417-3.418Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M5.001 5.417A3.418 3.418 0 0 1 8.42 2h3.417v6.834H8.419A3.418 3.418 0 0 1 5 5.417Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M11.836 2h3.417a3.418 3.418 0 0 1 0 6.834h-3.417V2Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M18.67 12.251a3.418 3.418 0 0 1-6.834 0 3.418 3.418 0 0 1 6.834 0Z"})]}),tl=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.17 2.25H13a.75.75 0 0 1 .53.22l6 6c.141.14.22.331.22.53v8.83c0 .535 0 .98-.03 1.345-.03.38-.098.736-.27 1.073a2.751 2.751 0 0 1-1.201 1.202c-.338.172-.694.24-1.074.27-.365.03-.81.03-1.345.03H8.17c-.535 0-.98 0-1.345-.03-.38-.03-.736-.098-1.073-.27A2.75 2.75 0 0 1 4.55 20.25c-.172-.338-.24-.694-.27-1.074-.03-.365-.03-.81-.03-1.345V6.17c0-.535 0-.98.03-1.345.03-.38.098-.736.27-1.073A2.75 2.75 0 0 1 5.752 2.55c.337-.172.693-.24 1.073-.27.365-.03.81-.03 1.345-.03ZM6.947 3.775c-.287.023-.424.065-.514.111a1.25 1.25 0 0 0-.547.547c-.046.09-.088.227-.111.514-.024.296-.025.68-.025 1.253v11.6c0 .572 0 .957.025 1.252.023.288.065.425.111.515.12.236.311.427.547.547.09.046.227.088.514.111.296.024.68.025 1.253.025h7.6c.572 0 .957 0 1.252-.025.288-.023.425-.065.515-.111a1.25 1.25 0 0 0 .547-.547c.046-.09.088-.227.111-.515.024-.295.025-.68.025-1.252V9.75H14A1.75 1.75 0 0 1 12.25 8V3.75H8.2c-.572 0-.957 0-1.253.025ZM13.75 4.81l3.44 3.439H14a.25.25 0 0 1-.25-.25V4.81Z",clipRule:"evenodd"})}),tc=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.75 12a8.25 8.25 0 1 1 16.5 0 8.25 8.25 0 0 1-16.5 0ZM12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-4 6.5a.75.75 0 0 0 0 1.5h8a.75.75 0 0 0 0-1.5H8Zm.25 3.75a.75.75 0 0 1 .75-.75h6a.75.75 0 0 1 0 1.5H9a.75.75 0 0 1-.75-.75ZM11 14.75a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 0-1.5h-2Z",clipRule:"evenodd"})}),td=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.75 11.526a7.776 7.776 0 0 1 15.553 0 .75.75 0 0 0 1.5 0c0-.348-.02-.691-.057-1.03-.513-4.638-4.444-8.246-9.22-8.246a9.276 9.276 0 0 0-9.276 9.276c0 4.776 3.608 8.707 8.246 9.22.339.038.682.057 1.03.057a.75.75 0 0 0 0-1.5 7.778 7.778 0 0 1-7.776-7.776Zm3.987-3.118a.75.75 0 1 0 0 1.5h6.847a.75.75 0 0 0 0-1.5H7.737ZM7.934 12a.75.75 0 0 1 .75-.75H13.5a.75.75 0 0 1 0 1.5H8.684a.75.75 0 0 1-.75-.75Zm2.645 2.092a.75.75 0 1 0 0 1.5h.826a.75.75 0 0 0 0-1.5h-.826ZM15.85 17.5a.65.65 0 0 1 .65-.65h1.979a.65.65 0 1 1 0 1.3H16.5a.65.65 0 0 1-.65-.65Zm-1.7 0a3.35 3.35 0 1 1 6.7 0 3.35 3.35 0 0 1-6.7 0Zm3.35-4.65a4.65 4.65 0 1 0 0 9.3 4.65 4.65 0 0 0 0-9.3Z",clipRule:"evenodd"})}),th=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5.575 2.018a.75.75 0 0 0-1.15.964l15.5 18.5a.75.75 0 0 0 1.15-.964l-15.5-18.5ZM21.75 12a9.705 9.705 0 0 1-1.634 5.404L19.11 16.19a8.25 8.25 0 0 0-9.91-11.951L8.189 3.023A9.719 9.719 0 0 1 12 2.25c5.385 0 9.75 4.365 9.75 9.75Zm-8.1 3.873-.931-1.123H11a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 .65-.377ZM9 13.25h2.475l-1.244-1.5H9a.75.75 0 0 0 0 1.5Zm7-3h-1.816l-1.244-1.5H16a.75.75 0 0 1 0 1.5Zm-7.013 0L7.772 8.785A.75.75 0 0 0 8 10.25h.987ZM3.75 12c0-2.12.8-4.054 2.115-5.515l-.967-1.166A9.716 9.716 0 0 0 2.25 12c0 5.385 4.365 9.75 9.75 9.75a9.705 9.705 0 0 0 5.252-1.534l-.966-1.165A8.25 8.25 0 0 1 3.75 12Z",clipRule:"evenodd"})}),tu=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM8 8.75a.75.75 0 0 0 0 1.5h8a.75.75 0 0 0 0-1.5H8Zm1 3a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5H9Zm1.25 3.75a.75.75 0 0 1 .75-.75h2a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"})}),tp=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"m5.208 11.106.694-.617a.75.75 0 0 1 .996 1.122l-1.96 1.74a.75.75 0 0 1-1.012-.014L2.08 11.596a.75.75 0 1 1 1.03-1.091l.592.558a8.351 8.351 0 0 1 14.203-4.967.75.75 0 1 1-1.06 1.06 6.851 6.851 0 0 0-11.636 3.95Zm14.397-.525a.75.75 0 0 1 .531.257l1.826 2.094a.75.75 0 0 1-1.13.986l-.576-.66A8.352 8.352 0 0 1 5.97 17.776a.75.75 0 0 1 1.083-1.038 6.852 6.852 0 0 0 11.702-3.593l-.863.823a.75.75 0 0 1-1.035-1.086l2.196-2.094a.75.75 0 0 1 .552-.207Z",clipRule:"evenodd"})}),tf=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 5.25c-.69 0-1.25.56-1.25 1.25V17c0 .69.56 1.25 1.25 1.25h14c.69 0 1.25-.56 1.25-1.25V8.5c0-.69-.56-1.25-1.25-1.25h-6.5a.75.75 0 0 1-.53-.22l-1.415-1.414a1.25 1.25 0 0 0-.883-.366H5ZM2.25 6.5A2.75 2.75 0 0 1 5 3.75h4.672c.729 0 1.428.29 1.944.805l1.195 1.195H19a2.75 2.75 0 0 1 2.75 2.75V17A2.75 2.75 0 0 1 19 19.75H5A2.75 2.75 0 0 1 2.25 17V6.5Z",clipRule:"evenodd"})}),tg=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M1 18.161c0 .468.387.804.916.804.457 0 .722-.214.895-.702l1.292-3.642h5.809l1.302 3.642c.173.488.437.702.895.702.53 0 .916-.336.916-.804 0-.132-.03-.285-.112-.509L8.183 4.875c-.225-.6-.59-.875-1.15-.875-.6 0-.977.285-1.2.885L1.111 17.652c-.081.224-.112.377-.112.509Zm8.393-5.097H4.632l2.35-6.694h.06l2.35 6.694Zm4.26 2.767c0 1.903 1.414 3.174 3.52 3.174 1.425 0 2.778-.793 3.408-2.004h.04v1.11c0 .528.347.894.845.894.489 0 .834-.366.834-.895v-6.602c0-2.106-1.566-3.449-4.048-3.449-1.72 0-3.266.763-3.866 1.923a1.531 1.531 0 0 0-.214.732c0 .478.326.794.784.794.335 0 .57-.132.732-.427.59-1.048 1.373-1.465 2.523-1.465 1.465 0 2.32.773 2.32 2.065v.885l-3.042.173c-2.442.142-3.836 1.281-3.836 3.092Zm6.877-1.027c0 1.526-1.292 2.696-2.96 2.696-1.272 0-2.116-.662-2.116-1.669 0-.997.814-1.627 2.238-1.719l2.838-.173v.865Z",clipRule:"evenodd"})}),tm=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7 20.75a.75.75 0 0 1-.75-.75v-2.25H4a.75.75 0 0 1 0-1.5h2.25v-8.5H4a.75.75 0 0 1 0-1.5h2.25V4a.75.75 0 0 1 1.5 0v2.25h8.5V4a.75.75 0 0 1 1.5 0v2.25H20a.75.75 0 0 1 0 1.5h-2.25v8.5H20a.75.75 0 0 1 0 1.5h-2.25V20a.75.75 0 0 1-1.5 0v-2.25h-8.5V20a.75.75 0 0 1-.75.75Zm9.25-4.5v-8.5h-8.5v8.5h8.5Z",clipRule:"evenodd"})}),tv=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 2C6.475 2 2 6.588 2 12.253c0 4.537 2.862 8.369 6.838 9.727.5.09.687-.218.687-.487 0-.243-.013-1.05-.013-1.91C7 20.059 6.35 18.957 6.15 18.38c-.113-.295-.6-1.205-1.025-1.448-.35-.192-.85-.667-.013-.68.788-.012 1.35.744 1.538 1.051.9 1.551 2.338 1.116 2.912.846.088-.666.35-1.115.638-1.371-2.225-.256-4.55-1.14-4.55-5.062 0-1.115.387-2.038 1.025-2.756-.1-.256-.45-1.307.1-2.717 0 0 .837-.269 2.75 1.051.8-.23 1.65-.346 2.5-.346.85 0 1.7.115 2.5.346 1.912-1.333 2.75-1.05 2.75-1.05.55 1.409.2 2.46.1 2.716.637.718 1.025 1.628 1.025 2.756 0 3.934-2.337 4.806-4.562 5.062.362.32.675.936.675 1.897 0 1.371-.013 2.473-.013 2.82 0 .268.188.589.688.486a10.04 10.04 0 0 0 4.932-3.74A10.447 10.447 0 0 0 22 12.253C22 6.588 17.525 2 12 2Z",clipRule:"evenodd"})}),ty=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",d:"m11.856 20.423 3.367-10.363H8.488l3.368 10.363Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M11.856 20.423 8.488 10.06H3.77l8.087 10.363Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"m3.77 10.06-1.024 3.149a.697.697 0 0 0 .253.78l8.857 6.434L3.769 10.06Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M3.77 10.06h4.718L6.46 3.818a.349.349 0 0 0-.663 0L3.77 10.06Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"m11.856 20.423 3.367-10.363h4.72l-8.087 10.363Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"m19.942 10.06 1.024 3.149a.697.697 0 0 1-.253.78l-8.857 6.434 8.086-10.363Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M19.943 10.06h-4.72l2.028-6.242a.349.349 0 0 1 .663 0l2.029 6.242Z"})]}),tb=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.473 3.104c.24-.527.768-.854 1.337-.854 1.584 0 2.9 1.257 2.9 2.846V8.1c0 .038.036.1.121.1h3.054c2.04 0 3.644 1.783 3.325 3.805l-.939 5.95c-.256 1.622-1.68 2.795-3.325 2.795H5.243c-1.359 0-2.493-1.08-2.493-2.45v-5.95c0-1.37 1.134-2.45 2.493-2.45h2.049c.058 0 .099-.033.114-.066l3.067-6.73ZM8.608 19.25h8.338c.935 0 1.707-.663 1.843-1.53l.94-5.95c.168-1.067-.68-2.07-1.844-2.07H14.83c-.878 0-1.621-.699-1.621-1.6V5.096c0-.72-.6-1.337-1.383-1.346l-3.056 6.706c-.046.1-.1.193-.163.279v8.515Zm-1.5-7.85v7.85H5.243c-.566 0-.993-.443-.993-.95v-5.95c0-.507.427-.95.993-.95h1.865Z",clipRule:"evenodd"})}),tw=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M21.56 10.05H12v3.9h5.51A5.848 5.848 0 0 1 6.15 12 5.85 5.85 0 0 1 12 6.15c1.491 0 2.848.563 3.881 1.482l2.758-2.758A9.705 9.705 0 0 0 12 2.25c-5.384 0-9.75 4.366-9.75 9.75s4.366 9.75 9.75 9.75 9.75-4.366 9.75-9.75c0-.654-.067-1.332-.19-1.95Z"})}),tx=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",d:"M21.56 10.05H12v3.9h5.51A5.848 5.848 0 0 1 6.15 12 5.85 5.85 0 0 1 12 6.15c1.491 0 2.848.563 3.881 1.482l2.758-2.758A9.705 9.705 0 0 0 12 2.25c-5.384 0-9.75 4.366-9.75 9.75s4.366 9.75 9.75 9.75 9.75-4.366 9.75-9.75c0-.654-.067-1.332-.19-1.95Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"m3.374 7.462 3.203 2.35A5.848 5.848 0 0 1 12 6.15c1.491 0 2.848.563 3.881 1.482l2.758-2.758A9.705 9.705 0 0 0 12 2.25a9.745 9.745 0 0 0-8.626 5.212Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M12 21.75a9.705 9.705 0 0 0 6.537-2.531l-3.018-2.554A5.807 5.807 0 0 1 12 17.85a5.847 5.847 0 0 1-5.5-3.874l-3.18 2.45C4.934 19.584 8.21 21.75 12 21.75Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M21.56 10.05H12v3.9h5.51a5.87 5.87 0 0 1-1.992 2.716h.001l3.018 2.553c-.213.194 3.213-2.344 3.213-7.219 0-.654-.067-1.332-.19-1.95Z"})]}),t_=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",d:"m10 15 5-3-5-3v6Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M9.084 17.075c.54.7 1.03 1.438 1.469 2.207.374.724.53 1.215.804 2.087.168.482.32.626.646.626.355 0 .516-.245.64-.623.26-.824.462-1.452.782-2.046.629-1.147 1.41-2.166 2.177-3.145.208-.278 1.55-1.892 2.155-3.167 0 0 .743-1.4.743-3.354 0-1.828-.733-3.096-.733-3.096l-2.11.576-1.28 3.44-.318.474-.063.086-.084.108-.148.171-.212.216-1.14.948-2.853 1.679-.475 2.813Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M6.14 12.78c.697 1.62 2.04 3.045 2.948 4.296l4.824-5.826s-.68.906-1.913.906c-1.373 0-2.482-1.118-2.482-2.528 0-.966.57-1.63.57-1.63l-3.275.894-.671 3.887Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M13.966 3.3a6.491 6.491 0 0 1 3.803 3.262l-3.856 4.684s.57-.676.57-1.636c0-1.443-1.19-2.52-2.478-2.52-1.217 0-1.916.904-1.916.904v-2.95L13.966 3.3Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M7.024 5.37C7.981 4.201 9.665 3 11.987 3c1.126 0 1.975.301 1.975.301l-3.877 4.696H7.34l-.315-2.628Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M6.14 12.78S5.5 11.5 5.5 9.647c0-1.75.668-3.28 1.524-4.279l3.063 2.628L6.14 12.78Z"})]}),tC=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.5 5.5a1 1 0 0 1 1-1H7a1 1 0 0 1 1 1V7a1 1 0 0 1-1 1H5.5a1 1 0 0 1-1-1V5.5Zm0 12a1 1 0 0 1 1-1H7a1 1 0 0 1 1 1V19a1 1 0 0 1-1 1H5.5a1 1 0 0 1-1-1v-1.5Zm6 0a1 1 0 0 1 1-1H13a1 1 0 0 1 1 1V19a1 1 0 0 1-1 1h-1.5a1 1 0 0 1-1-1v-1.5Zm7-1a1 1 0 0 0-1 1V19a1 1 0 0 0 1 1H19a1 1 0 0 0 1-1v-1.5a1 1 0 0 0-1-1h-1.5Zm-6-12a1 1 0 0 0-1 1V7a1 1 0 0 0 1 1H13a1 1 0 0 0 1-1V5.5a1 1 0 0 0-1-1h-1.5Zm5 1a1 1 0 0 1 1-1H19a1 1 0 0 1 1 1V7a1 1 0 0 1-1 1h-1.5a1 1 0 0 1-1-1V5.5Zm-11 5a1 1 0 0 0-1 1V13a1 1 0 0 0 1 1H7a1 1 0 0 0 1-1v-1.5a1 1 0 0 0-1-1H5.5Zm5 1a1 1 0 0 1 1-1H13a1 1 0 0 1 1 1V13a1 1 0 0 1-1 1h-1.5a1 1 0 0 1-1-1v-1.5Zm7-1a1 1 0 0 0-1 1V13a1 1 0 0 0 1 1H19a1 1 0 0 0 1-1v-1.5a1 1 0 0 0-1-1h-1.5Z",clipRule:"evenodd"})}),tk=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",d:"M5.778 4.75c-.564 0-1.028.464-1.028 1.028v1.778a.75.75 0 0 1-1.5 0V5.778A2.533 2.533 0 0 1 5.778 3.25h1.778a.75.75 0 0 1 0 1.5H5.778ZM15.694 4a.75.75 0 0 1 .75-.75h1.778a2.533 2.533 0 0 1 2.528 2.528v1.778a.75.75 0 0 1-1.5 0V5.778c0-.564-.464-1.028-1.028-1.028h-1.778a.75.75 0 0 1-.75-.75ZM4 15.694a.75.75 0 0 1 .75.75v1.778c0 .564.464 1.028 1.028 1.028h1.778a.75.75 0 0 1 0 1.5H5.778a2.533 2.533 0 0 1-2.528-2.528v-1.778a.75.75 0 0 1 .75-.75ZM20 15.694a.75.75 0 0 1 .75.75v1.778a2.533 2.533 0 0 1-2.528 2.528h-1.778a.75.75 0 0 1 0-1.5h1.778c.564 0 1.028-.464 1.028-1.028v-1.778a.75.75 0 0 1 .75-.75Z"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.75 11.25V8.8c0-.904-.77-1.55-1.607-1.55H8.857c-.838 0-1.607.646-1.607 1.55v2.4c0 .904.77 1.55 1.607 1.55h.394l-.001.05v2.4c0 .904.77 1.55 1.607 1.55h4.286c.838 0 1.607-.646 1.607-1.55v-2.4c0-.904-.77-1.55-1.607-1.55h-.394Zm-6-2.45V11.202c.001.002.005.008.013.015a.138.138 0 0 0 .094.033h4.286a.137.137 0 0 0 .094-.033.05.05 0 0 0 .012-.015l.001-.002V8.798a.051.051 0 0 0-.013-.015.137.137 0 0 0-.094-.033H8.857a.137.137 0 0 0-.094.033.053.053 0 0 0-.013.015V8.8Zm2.107 3.95a.137.137 0 0 0-.094.033.05.05 0 0 0-.012.015l-.001.002V15.202a.05.05 0 0 0 .013.015.137.137 0 0 0 .094.033h4.286a.137.137 0 0 0 .094-.033.05.05 0 0 0 .012-.015l.001-.002V12.798a.05.05 0 0 0-.013-.015.137.137 0 0 0-.094-.033h-4.286Z",clipRule:"evenodd"})]}),tS=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M3.99 3.116 1.33 5.302 0 3.725 4.2.342h2.07v13.454H3.99V3.116ZM481.948 13.796l3.458-4.998-.019-.019a2.45 2.45 0 0 1-.703.19 5.26 5.26 0 0 1-.741.057 4.321 4.321 0 0 1-1.672-.323 4.6 4.6 0 0 1-1.368-.912 4.434 4.434 0 0 1-.931-1.368 4.503 4.503 0 0 1-.324-1.71 4.8 4.8 0 0 1 .381-1.939 4.425 4.425 0 0 1 1.026-1.482 4.44 4.44 0 0 1 1.558-.95A5.473 5.473 0 0 1 484.551 0c.697 0 1.343.12 1.938.361a4.66 4.66 0 0 1 1.578.97c.443.417.785.911 1.026 1.481.253.558.38 1.16.38 1.806 0 .38-.032.74-.095 1.083-.064.33-.159.652-.285.969-.114.304-.26.614-.437.931-.165.317-.355.646-.57.988l-3.364 5.207h-2.774Zm5.207-9.235c0-.355-.064-.69-.191-1.008a2.368 2.368 0 0 0-.513-.836c-.228-.253-.5-.45-.817-.589a2.424 2.424 0 0 0-1.064-.228c-.773 0-1.4.254-1.881.76-.469.494-.703 1.14-.703 1.939 0 .38.057.734.171 1.064.126.316.304.589.532.817.228.228.494.412.798.551.317.127.665.19 1.045.19.38 0 .729-.063 1.045-.19.33-.127.608-.304.836-.532a2.41 2.41 0 0 0 .551-.855c.127-.33.191-.69.191-1.083ZM1134.16 11.706l5.18-5.093c.42-.405.75-.81.99-1.216.26-.418.38-.893.38-1.425 0-.634-.21-1.134-.62-1.502-.41-.38-.92-.57-1.52-.57-.65 0-1.17.222-1.56.665-.4.431-.64.976-.72 1.635l-2.23-.342c.07-.558.22-1.071.48-1.54.25-.468.57-.874.97-1.216.39-.342.84-.608 1.36-.798A4.856 4.856 0 0 1 1138.6 0c.59 0 1.14.082 1.68.247.54.165 1.02.418 1.44.76.42.33.75.741.99 1.235.25.482.38 1.045.38 1.692 0 .43-.06.836-.17 1.216-.12.367-.28.715-.48 1.045-.19.33-.42.646-.68.95-.26.291-.53.576-.84.855l-3.87 3.706h6.06v2.09h-8.95v-2.09ZM1154.99 7.069c0 1.09-.11 2.071-.32 2.945-.21.875-.51 1.616-.91 2.224-.4.608-.89 1.077-1.49 1.406-.58.33-1.25.494-2.01.494-.76 0-1.44-.165-2.03-.494-.6-.33-1.1-.798-1.51-1.406-.4-.608-.71-1.35-.93-2.224-.2-.874-.3-1.856-.3-2.945 0-1.09.1-2.071.3-2.945.22-.875.53-1.616.93-2.224.41-.608.91-1.077 1.51-1.406.59-.33 1.27-.494 2.03-.494.76 0 1.43.165 2.01.494.6.33 1.09.798 1.49 1.406.4.608.7 1.35.91 2.224.21.874.32 1.855.32 2.945Zm-2.34 0c0-.469-.03-1-.09-1.596a7.645 7.645 0 0 0-.34-1.691c-.17-.533-.41-.976-.73-1.33-.31-.368-.72-.552-1.23-.552-.52 0-.94.184-1.26.551-.31.355-.56.798-.74 1.33a8.993 8.993 0 0 0-.34 1.692c-.06.595-.09 1.127-.09 1.596 0 .469.03 1 .09 1.596.06.596.18 1.153.34 1.672.18.52.43.963.74 1.33.32.355.74.533 1.26.533.51 0 .92-.178 1.23-.532.32-.368.56-.811.73-1.33.17-.52.29-1.077.34-1.673.06-.595.09-1.127.09-1.596ZM248.318 2.394h-5.491l-.133 2.908c.215-.064.468-.108.76-.133a9.93 9.93 0 0 1 .817-.038c.659 0 1.267.095 1.824.285.57.19 1.064.469 1.482.836.418.355.741.798.969 1.33.241.52.361 1.121.361 1.805 0 .748-.133 1.42-.399 2.015a4.292 4.292 0 0 1-1.045 1.482 4.6 4.6 0 0 1-1.558.931 5.544 5.544 0 0 1-1.9.323c-1.128 0-2.078-.26-2.851-.78-.772-.531-1.336-1.253-1.691-2.165l2.071-.76c.19.532.507.962.951 1.292.443.316.969.475 1.577.475.342 0 .665-.057.969-.171a2.35 2.35 0 0 0 .798-.494c.228-.216.405-.482.532-.799.139-.329.209-.696.209-1.102 0-.519-.089-.95-.266-1.292a2.217 2.217 0 0 0-.703-.817 2.331 2.331 0 0 0-.95-.437 4.452 4.452 0 0 0-1.083-.133 6.326 6.326 0 0 0-1.654.228c-.266.063-.532.14-.798.228a5.914 5.914 0 0 0-.684.285l.228-7.354h7.658v2.052ZM718.089 3.116l-2.66 2.186-1.33-1.577 4.199-3.383h2.072v13.454h-2.281V3.116ZM728.415 5.872h.608c.342 0 .677-.026 1.007-.076.342-.064.652-.171.931-.323s.5-.355.665-.608c.177-.266.266-.608.266-1.026 0-.305-.057-.577-.171-.818a1.72 1.72 0 0 0-.475-.608 1.993 1.993 0 0 0-.684-.38 2.403 2.403 0 0 0-.798-.133c-.558 0-1.02.159-1.387.475-.368.317-.621.735-.761 1.255l-2.147-.552c.114-.456.304-.867.57-1.235.279-.38.608-.703.988-.969.393-.279.83-.494 1.312-.646a5.016 5.016 0 0 1 1.52-.228c.583 0 1.134.082 1.653.247a3.88 3.88 0 0 1 1.387.703c.406.304.722.684.95 1.14.228.456.342.988.342 1.597a3.07 3.07 0 0 1-.665 1.938c-.43.557-1.013.925-1.748 1.102v.038c.823.165 1.489.538 1.995 1.121.52.57.779 1.273.779 2.11 0 .696-.139 1.304-.418 1.824-.266.519-.627.95-1.083 1.292a4.537 4.537 0 0 1-1.501.76 5.543 5.543 0 0 1-1.691.266c-.57 0-1.109-.063-1.615-.19a4.864 4.864 0 0 1-1.407-.551 4.354 4.354 0 0 1-1.121-.988 4.56 4.56 0 0 1-.741-1.445l2.128-.665c.165.533.469.982.913 1.35.456.367 1.045.55 1.767.55.291 0 .582-.037.874-.113.304-.089.57-.222.798-.4.241-.177.431-.405.57-.684.152-.278.228-.62.228-1.026 0-.43-.108-.791-.323-1.083a2.075 2.075 0 0 0-.779-.703 3.537 3.537 0 0 0-1.064-.38 5.62 5.62 0 0 0-1.102-.114h-.57V5.872ZM1374.19 11.706l5.19-5.093c.42-.405.75-.81.99-1.216.25-.418.38-.893.38-1.425 0-.634-.21-1.134-.63-1.502-.41-.38-.91-.57-1.52-.57-.65 0-1.17.222-1.56.665-.39.431-.63.976-.72 1.635l-2.22-.342c.06-.558.22-1.071.47-1.54.25-.468.58-.874.97-1.216.39-.342.85-.608 1.37-.798a4.817 4.817 0 0 1 1.73-.304c.58 0 1.14.082 1.67.247.54.165 1.03.418 1.44.76.42.33.75.741.99 1.235.25.482.38 1.045.38 1.692 0 .43-.06.836-.17 1.216a4.5 4.5 0 0 1-.47 1.045c-.19.33-.42.646-.69.95-.25.291-.53.576-.83.855l-3.88 3.706h6.06v2.09h-8.95v-2.09ZM1391.09 11.002h-6.21V8.989l5.72-8.646h2.73v8.703h1.88v1.957h-1.88v2.794h-2.24v-2.793Zm0-7.98h-.04l-3.82 6.023h3.86V3.021ZM1434.2 11.706l5.19-5.093c.41-.405.74-.81.98-1.216.26-.418.38-.893.38-1.425 0-.634-.2-1.134-.62-1.502-.41-.38-.91-.57-1.52-.57-.65 0-1.17.222-1.56.665-.39.431-.63.976-.72 1.635l-2.23-.342c.07-.558.23-1.071.48-1.54.25-.468.58-.874.97-1.216.39-.342.85-.608 1.37-.798.53-.203 1.1-.304 1.73-.304.58 0 1.14.082 1.67.247.54.165 1.02.418 1.44.76.42.33.75.741.99 1.235.25.482.38 1.045.38 1.692 0 .43-.06.836-.17 1.216-.12.367-.27.715-.48 1.045-.19.33-.41.646-.68.95-.25.291-.53.576-.84.855l-3.87 3.706h6.06v2.09h-8.95v-2.09ZM1454.08 2.394h-5.49l-.13 2.908c.21-.064.47-.108.76-.133.3-.026.57-.038.81-.038.66 0 1.27.095 1.83.285.57.19 1.06.468 1.48.836.42.355.74.798.97 1.33.24.52.36 1.121.36 1.805 0 .748-.13 1.42-.4 2.015-.25.582-.6 1.076-1.04 1.482-.45.405-.97.716-1.56.93-.6.216-1.23.324-1.9.324-1.13 0-2.08-.26-2.85-.78a4.56 4.56 0 0 1-1.69-2.165l2.07-.76c.19.531.5.962.95 1.292.44.316.97.475 1.58.475.34 0 .66-.057.96-.171.31-.114.57-.279.8-.494.23-.216.41-.482.53-.799.14-.329.21-.696.21-1.102 0-.52-.08-.95-.26-1.292a2.18 2.18 0 0 0-.71-.817 2.25 2.25 0 0 0-.95-.437 4.38 4.38 0 0 0-1.08-.133c-.25 0-.52.019-.82.057-.27.038-.55.095-.83.171-.27.063-.53.14-.8.228-.25.089-.48.184-.68.285l.22-7.354h7.66v2.052ZM1494.21 11.706l5.18-5.093c.42-.405.75-.81.99-1.216.26-.418.38-.893.38-1.425 0-.634-.21-1.134-.62-1.502-.41-.38-.92-.57-1.52-.57-.65 0-1.17.222-1.56.665-.4.431-.64.976-.72 1.635l-2.23-.342c.07-.558.22-1.071.48-1.54.25-.468.57-.874.97-1.216.39-.342.84-.608 1.36-.798a4.856 4.856 0 0 1 1.73-.304c.59 0 1.14.082 1.68.247.54.165 1.02.418 1.44.76.42.33.75.741.99 1.235.25.482.38 1.045.38 1.692 0 .43-.06.836-.17 1.216-.12.367-.28.715-.48 1.045-.19.33-.42.646-.68.95-.26.291-.53.576-.84.855l-3.87 3.706h6.06v2.09h-8.95v-2.09ZM1512.87.342l-3.44 4.979.02.019c.18-.076.4-.133.67-.171.28-.038.53-.057.76-.057.59 0 1.15.114 1.67.342.52.215.98.52 1.37.912.39.38.7.836.91 1.368.23.52.34 1.083.34 1.691 0 .71-.12 1.356-.38 1.939-.25.582-.6 1.083-1.04 1.5-.43.406-.95.716-1.56.932a5.36 5.36 0 0 1-1.92.342 5.46 5.46 0 0 1-1.96-.342c-.59-.24-1.11-.57-1.55-.988-.45-.418-.8-.906-1.05-1.463a4.653 4.653 0 0 1-.36-1.825c0-.38.03-.734.09-1.064.07-.342.16-.665.27-.969.13-.317.27-.633.44-.95.17-.317.37-.646.59-.988l3.36-5.207h2.77Zm-5.2 9.235c0 .355.05.69.17 1.008.13.316.3.595.53.836.23.24.5.43.82.57.31.139.67.209 1.06.209.77 0 1.4-.241 1.86-.722.49-.495.73-1.14.73-1.939 0-.38-.07-.728-.19-1.045-.12-.33-.29-.608-.52-.836-.23-.228-.5-.405-.81-.532-.31-.14-.65-.209-1.03-.209s-.74.063-1.06.19c-.32.127-.6.31-.84.551-.23.228-.41.507-.53.836-.13.33-.19.69-.19 1.083ZM60.008 11.706l5.188-5.093c.418-.405.748-.81.988-1.216.254-.418.38-.893.38-1.425 0-.634-.209-1.134-.627-1.502-.405-.38-.912-.57-1.52-.57-.646 0-1.166.222-1.558.665-.393.431-.634.976-.722 1.635l-2.224-.342c.064-.558.222-1.071.475-1.54.254-.468.577-.874.97-1.216a4.321 4.321 0 0 1 1.368-.798A4.818 4.818 0 0 1 64.455 0c.583 0 1.14.082 1.672.247a4.152 4.152 0 0 1 1.444.76 3.5 3.5 0 0 1 .989 1.235c.253.482.38 1.045.38 1.692 0 .43-.057.836-.171 1.216a4.576 4.576 0 0 1-.476 1.045c-.19.33-.418.646-.684.95-.253.291-.532.576-.836.855l-3.876 3.706h6.062v2.09h-8.95v-2.09ZM538.065 3.116l-2.661 2.186-1.33-1.577 4.2-3.383h2.071v13.454h-2.28V3.116ZM554.908 7.069c0 1.09-.108 2.071-.324 2.945-.202.875-.506 1.616-.912 2.224a4.124 4.124 0 0 1-1.482 1.406c-.583.33-1.254.494-2.014.494-.76 0-1.438-.165-2.033-.494a4.295 4.295 0 0 1-1.502-1.406c-.405-.608-.715-1.35-.931-2.224-.202-.874-.304-1.856-.304-2.945 0-1.09.102-2.071.304-2.945.216-.875.526-1.616.931-2.224a4.295 4.295 0 0 1 1.502-1.406c.595-.33 1.273-.494 2.033-.494s1.431.165 2.014.494c.596.33 1.09.798 1.482 1.406.406.608.71 1.35.912 2.224.216.874.324 1.855.324 2.945Zm-2.338 0c0-.469-.031-1-.095-1.596a7.215 7.215 0 0 0-.342-1.691c-.165-.533-.405-.976-.722-1.33-.317-.368-.728-.552-1.235-.552-.52 0-.938.184-1.254.551-.317.355-.564.798-.741 1.33a8.837 8.837 0 0 0-.342 1.692 15.077 15.077 0 0 0-.095 1.596c0 .469.031 1 .095 1.596.063.596.177 1.153.342 1.672.177.52.424.963.741 1.33.316.355.734.533 1.254.533.507 0 .918-.178 1.235-.532a3.74 3.74 0 0 0 .722-1.33c.178-.52.292-1.077.342-1.673.064-.595.095-1.127.095-1.596ZM1194.17 11.706l5.18-5.093c.42-.405.75-.81.99-1.216.25-.418.38-.893.38-1.425 0-.634-.21-1.134-.63-1.502-.4-.38-.91-.57-1.52-.57-.64 0-1.16.222-1.55.665-.4.431-.64.976-.73 1.635l-2.22-.342c.06-.558.22-1.071.48-1.54.25-.468.57-.874.96-1.216.4-.342.85-.608 1.37-.798a4.817 4.817 0 0 1 1.73-.304c.58 0 1.14.082 1.67.247.55.165 1.03.418 1.45.76.42.33.75.741.99 1.235.25.482.38 1.045.38 1.692 0 .43-.06.836-.17 1.216-.12.367-.28.715-.48 1.045-.19.33-.42.646-.68.95-.26.291-.54.576-.84.855l-3.88 3.706h6.07v2.09h-8.95v-2.09ZM1209.75 3.116l-2.66 2.186-1.33-1.577 4.2-3.383h2.07v13.454h-2.28V3.116ZM1554.22 11.706l5.18-5.093c.42-.405.75-.81.99-1.216.25-.418.38-.893.38-1.425 0-.634-.21-1.134-.63-1.502-.4-.38-.91-.57-1.52-.57-.64 0-1.16.222-1.55.665-.4.431-.64.976-.73 1.635l-2.22-.342c.06-.558.22-1.071.48-1.54.25-.468.57-.874.96-1.216.4-.342.85-.608 1.37-.798a4.817 4.817 0 0 1 1.73-.304c.58 0 1.14.082 1.67.247.55.165 1.03.418 1.45.76.42.33.75.741.99 1.235.25.482.38 1.045.38 1.692 0 .43-.06.836-.17 1.216-.12.367-.28.715-.48 1.045-.19.33-.42.646-.68.95-.26.291-.54.576-.84.855l-3.88 3.706h6.07v2.09h-8.95v-2.09ZM1565.47.342h9.14v2.09l-5.38 11.364h-2.68l5.67-11.402h-6.75V.342ZM307.11.342l-3.439 4.979.019.019c.177-.076.399-.133.665-.171a5.67 5.67 0 0 1 .76-.057c.596 0 1.153.114 1.672.342.52.215.976.52 1.369.912.392.38.696.836.912 1.368a4.16 4.16 0 0 1 .342 1.691c0 .71-.127 1.356-.38 1.939a4.52 4.52 0 0 1-1.045 1.5 4.375 4.375 0 0 1-1.559.932 5.319 5.319 0 0 1-1.919.342 5.429 5.429 0 0 1-1.957-.342 4.938 4.938 0 0 1-1.558-.988 4.62 4.62 0 0 1-1.046-1.463 4.654 4.654 0 0 1-.361-1.825 5.786 5.786 0 0 1 .361-2.033c.127-.317.273-.633.438-.95.177-.317.373-.646.589-.988l3.363-5.207h2.774Zm-5.206 9.235c0 .355.057.69.171 1.008.126.316.304.595.532.836.228.24.5.43.817.57.317.14.671.209 1.064.209.773 0 1.394-.241 1.862-.722.482-.494.722-1.14.722-1.939 0-.38-.063-.728-.19-1.045a2.163 2.163 0 0 0-.513-.836 2.398 2.398 0 0 0-.817-.532 2.434 2.434 0 0 0-1.026-.209c-.38 0-.735.063-1.064.19-.317.127-.595.31-.836.551a2.356 2.356 0 0 0-.532.836c-.127.33-.19.69-.19 1.083ZM778.098 3.116l-2.661 2.186-1.33-1.577 4.2-3.383h2.071v13.454h-2.28V3.116ZM791.007 11.003h-6.214V8.988l5.72-8.646h2.737v8.703h1.881v1.958h-1.881v2.793h-2.243v-2.793Zm0-7.982h-.038l-3.819 6.024h3.857V3.021ZM122.734 5.872h.608c.342 0 .678-.026 1.007-.076.342-.064.653-.171.931-.323.279-.152.501-.355.665-.608.178-.266.266-.608.266-1.026 0-.305-.057-.577-.171-.818a1.72 1.72 0 0 0-.475-.608 1.993 1.993 0 0 0-.684-.38 2.395 2.395 0 0 0-.798-.133c-.557 0-1.02.159-1.387.475-.367.317-.621.735-.76 1.255l-2.147-.552c.114-.456.304-.867.57-1.235.278-.38.608-.703.988-.969.392-.279.83-.494 1.311-.646a5.016 5.016 0 0 1 1.52-.228c.583 0 1.134.082 1.653.247.532.152.995.386 1.388.703.405.304.722.684.95 1.14.228.456.342.988.342 1.597 0 .722-.222 1.368-.665 1.938-.431.557-1.014.925-1.749 1.102v.038c.824.165 1.489.538 1.996 1.121.519.57.779 1.273.779 2.11 0 .696-.14 1.304-.418 1.824-.266.519-.627.95-1.083 1.292a4.542 4.542 0 0 1-1.502.76 5.543 5.543 0 0 1-1.691.266 6.64 6.64 0 0 1-1.615-.19 4.846 4.846 0 0 1-1.406-.551 4.337 4.337 0 0 1-1.121-.988 4.582 4.582 0 0 1-.742-1.445l2.129-.665c.164.533.469.982.912 1.35.456.367 1.045.55 1.767.55.292 0 .583-.037.874-.113.304-.089.57-.222.798-.4.241-.177.431-.405.57-.684.152-.278.228-.62.228-1.026 0-.43-.107-.791-.323-1.083a2.067 2.067 0 0 0-.779-.703 3.527 3.527 0 0 0-1.064-.38 5.613 5.613 0 0 0-1.102-.114h-.57V5.872ZM598.073 3.116l-2.661 2.186-1.33-1.577 4.2-3.383h2.071v13.454h-2.28V3.116ZM609.671 3.116l-2.66 2.186-1.33-1.577L609.88.342h2.071v13.454h-2.28V3.116ZM1254.17 11.706l5.19-5.093c.42-.405.75-.81.99-1.216.25-.418.38-.893.38-1.425 0-.634-.21-1.134-.63-1.502-.4-.38-.91-.57-1.52-.57-.64 0-1.16.222-1.56.665-.39.431-.63.976-.72 1.635l-2.22-.342c.06-.558.22-1.071.47-1.54a4.5 4.5 0 0 1 .97-1.216c.4-.342.85-.608 1.37-.798a4.817 4.817 0 0 1 1.73-.304c.58 0 1.14.082 1.67.247.55.165 1.03.418 1.45.76.41.33.74.741.98 1.235.26.482.38 1.045.38 1.692 0 .43-.05.836-.17 1.216a4.5 4.5 0 0 1-.47 1.045c-.19.33-.42.646-.69.95-.25.291-.53.576-.83.855l-3.88 3.706h6.06v2.09h-8.95v-2.09ZM1265.77 11.706l5.19-5.093c.42-.405.75-.81.99-1.216.25-.418.38-.893.38-1.425 0-.634-.21-1.134-.63-1.502-.4-.38-.91-.57-1.52-.57-.65 0-1.16.222-1.56.665-.39.431-.63.976-.72 1.635l-2.22-.342c.06-.558.22-1.071.47-1.54a4.5 4.5 0 0 1 .97-1.216c.39-.342.85-.608 1.37-.798a4.817 4.817 0 0 1 1.73-.304c.58 0 1.14.082 1.67.247.55.165 1.03.418 1.44.76.42.33.75.741.99 1.235.26.482.38 1.045.38 1.692 0 .43-.05.836-.17 1.216a4.5 4.5 0 0 1-.47 1.045c-.19.33-.42.646-.69.95-.25.291-.53.576-.83.855l-3.88 3.706h6.06v2.09h-8.95v-2.09ZM1614.22 11.706l5.19-5.093c.42-.405.75-.81.99-1.216.25-.418.38-.893.38-1.425 0-.634-.21-1.134-.63-1.502-.4-.38-.91-.57-1.52-.57-.64 0-1.16.222-1.56.665-.39.431-.63.976-.72 1.635l-2.22-.342c.06-.558.22-1.071.47-1.54a4.5 4.5 0 0 1 .97-1.216c.4-.342.85-.608 1.37-.798a4.817 4.817 0 0 1 1.73-.304c.58 0 1.14.082 1.67.247.55.165 1.03.418 1.45.76.41.33.74.741.98 1.235.26.482.38 1.045.38 1.692 0 .43-.05.836-.17 1.216a4.5 4.5 0 0 1-.47 1.045c-.19.33-.42.646-.69.95-.25.291-.53.576-.83.855l-3.88 3.706h6.06v2.09h-8.95v-2.09ZM1630.31 0c.58 0 1.13.082 1.65.247.52.165.97.405 1.35.722.39.317.7.703.91 1.16.23.443.34.95.34 1.52 0 .785-.19 1.437-.59 1.957-.39.52-.89.88-1.5 1.083v.038c.36.089.69.234.99.437.3.19.57.43.8.722.23.279.4.596.53.95.14.355.21.741.21 1.16 0 .67-.13 1.266-.38 1.786a3.73 3.73 0 0 1-1.01 1.292c-.42.354-.91.62-1.48.798-.57.177-1.18.266-1.82.266-.65 0-1.26-.089-1.83-.266a4.368 4.368 0 0 1-1.5-.798 4.121 4.121 0 0 1-1.01-1.292c-.24-.52-.36-1.115-.36-1.787a3.413 3.413 0 0 1 .76-2.166c.24-.279.52-.507.82-.684.3-.19.62-.33.95-.418v-.038a3.302 3.302 0 0 1-1.5-1.045c-.39-.482-.59-1.115-.59-1.9 0-.57.11-1.084.32-1.54.23-.468.53-.861.91-1.178.4-.33.85-.583 1.35-.76a5.17 5.17 0 0 1 1.68-.266Zm0 1.881c-.57 0-1.04.171-1.41.513-.35.342-.53.805-.53 1.388 0 .544.17 1.007.51 1.387.36.38.83.57 1.43.57.26 0 .52-.05.76-.152s.45-.24.62-.418a1.962 1.962 0 0 0 .57-1.387c0-.292-.05-.552-.17-.78-.1-.24-.24-.443-.43-.608a1.896 1.896 0 0 0-.63-.38 1.984 1.984 0 0 0-.72-.133Zm0 5.796c-.33 0-.64.057-.93.171-.28.114-.53.272-.75.475-.2.19-.36.43-.49.722-.11.279-.17.59-.17.931 0 .71.22 1.26.66 1.654.45.392 1 .589 1.68.589.66 0 1.21-.197 1.65-.59.44-.392.66-.943.66-1.653 0-.329-.06-.633-.19-.912a1.897 1.897 0 0 0-.49-.74c-.2-.204-.45-.362-.74-.476a2.35 2.35 0 0 0-.89-.17ZM359.708.342h9.14v2.09l-5.378 11.364h-2.679l5.663-11.402h-6.746V.342ZM838.106 3.116l-2.66 2.186-1.33-1.577 4.199-3.383h2.071v13.454h-2.28V3.116ZM853.999 2.394h-5.492l-.133 2.908c.216-.064.469-.108.76-.133a9.95 9.95 0 0 1 .817-.038c.659 0 1.267.095 1.825.285.57.19 1.064.469 1.482.836.418.355.741.798.969 1.33.241.52.361 1.121.361 1.805 0 .748-.133 1.42-.399 2.015a4.305 4.305 0 0 1-1.045 1.482 4.61 4.61 0 0 1-1.558.931 5.55 5.55 0 0 1-1.901.323c-1.127 0-2.077-.26-2.85-.78-.773-.531-1.337-1.253-1.691-2.165l2.071-.76c.19.532.507.962.95 1.292.444.316.969.475 1.577.475.342 0 .665-.057.969-.171.305-.114.571-.279.799-.494.228-.216.405-.482.532-.799.139-.329.209-.696.209-1.102 0-.519-.089-.95-.266-1.292a2.226 2.226 0 0 0-.703-.817 2.335 2.335 0 0 0-.951-.437 4.44 4.44 0 0 0-1.083-.133 6.35 6.35 0 0 0-1.653.228c-.266.063-.532.14-.798.228a5.914 5.914 0 0 0-.684.285l.228-7.354h7.658v2.052ZM185.327 11.003h-6.214V8.988l5.72-8.646h2.736v8.703h1.881v1.958h-1.881v2.793h-2.242v-2.793Zm0-7.982h-.038l-3.82 6.024h3.858V3.021ZM658.081 3.116l-2.66 2.186-1.33-1.577L658.29.342h2.071v13.454h-2.28V3.116ZM665.689 11.706l5.188-5.093c.418-.405.747-.81.988-1.216.253-.418.38-.893.38-1.425 0-.634-.209-1.134-.627-1.502-.406-.38-.912-.57-1.521-.57-.646 0-1.165.222-1.558.665-.392.431-.633.976-.722 1.635l-2.223-.342c.063-.558.222-1.071.475-1.54.253-.468.576-.874.969-1.216a4.328 4.328 0 0 1 1.368-.798A4.819 4.819 0 0 1 670.135 0c.583 0 1.141.082 1.673.247a4.156 4.156 0 0 1 1.444.76c.418.33.747.741.988 1.235.253.482.38 1.045.38 1.692 0 .43-.057.836-.171 1.216a4.559 4.559 0 0 1-.475 1.045c-.19.33-.418.646-.684.95-.253.291-.532.576-.836.855l-3.877 3.706h6.062v2.09h-8.95v-2.09ZM1314.18 11.706l5.19-5.093c.42-.405.75-.81.99-1.216.25-.418.38-.893.38-1.425 0-.634-.21-1.134-.63-1.502-.4-.38-.91-.57-1.52-.57-.65 0-1.16.222-1.56.665-.39.431-.63.976-.72 1.635l-2.22-.342c.06-.558.22-1.071.47-1.54a4.5 4.5 0 0 1 .97-1.216c.39-.342.85-.608 1.37-.798a4.817 4.817 0 0 1 1.73-.304c.58 0 1.14.082 1.67.247.55.165 1.03.418 1.44.76.42.33.75.741.99 1.235.26.482.38 1.045.38 1.692 0 .43-.05.836-.17 1.216a4.5 4.5 0 0 1-.47 1.045c-.19.33-.42.646-.69.95-.25.291-.53.576-.83.855l-3.88 3.706h6.06v2.09h-8.95v-2.09ZM1328.5 5.872h.61c.34 0 .67-.026 1-.076.34-.064.66-.171.93-.323.28-.152.5-.355.67-.608.18-.266.27-.608.27-1.026 0-.305-.06-.577-.18-.818-.11-.24-.27-.443-.47-.608a1.984 1.984 0 0 0-.69-.38 2.331 2.331 0 0 0-.79-.133c-.56 0-1.02.159-1.39.475-.37.317-.62.735-.76 1.255l-2.15-.552c.12-.456.31-.867.57-1.235.28-.38.61-.703.99-.969.39-.279.83-.494 1.31-.646a5.02 5.02 0 0 1 1.52-.228c.58 0 1.14.082 1.66.247.53.152.99.386 1.38.703.41.304.72.684.95 1.14.23.456.34.988.34 1.597a3.09 3.09 0 0 1-.66 1.938c-.43.557-1.01.925-1.75 1.102v.038c.82.165 1.49.538 2 1.121.52.57.78 1.273.78 2.11 0 .696-.14 1.304-.42 1.824-.27.519-.63.95-1.09 1.292-.44.342-.94.595-1.5.76-.55.177-1.12.266-1.69.266-.57 0-1.11-.063-1.61-.19a4.838 4.838 0 0 1-1.41-.551 4.317 4.317 0 0 1-1.12-.988c-.32-.406-.56-.887-.74-1.445l2.13-.665c.16.533.47.982.91 1.35.45.367 1.04.55 1.77.55.29 0 .58-.037.87-.113.3-.089.57-.222.8-.4.24-.177.43-.405.57-.684.15-.278.23-.62.23-1.026 0-.43-.11-.791-.33-1.083-.2-.304-.46-.538-.78-.703a3.474 3.474 0 0 0-1.06-.38 5.632 5.632 0 0 0-1.1-.114h-.57V5.872ZM424.543 0c.583 0 1.134.082 1.653.247.519.165.969.405 1.349.722.393.317.697.703.912 1.16.228.443.342.95.342 1.52 0 .785-.196 1.437-.589 1.957-.392.52-.893.88-1.501 1.083v.038c.355.089.684.234.988.437.304.19.57.43.798.722.228.279.406.596.532.95.14.355.209.741.209 1.16 0 .67-.126 1.266-.38 1.786a3.71 3.71 0 0 1-1.007 1.292c-.418.354-.912.62-1.482.798a6.105 6.105 0 0 1-1.824.266 6.105 6.105 0 0 1-1.824-.266 4.377 4.377 0 0 1-1.502-.798 4.056 4.056 0 0 1-1.007-1.292c-.24-.52-.361-1.115-.361-1.787 0-.43.07-.83.209-1.197.14-.367.323-.69.551-.969.241-.279.513-.507.817-.684.304-.19.621-.33.951-.418v-.038a3.33 3.33 0 0 1-1.502-1.045c-.392-.482-.589-1.115-.589-1.9 0-.57.108-1.084.323-1.54a3.51 3.51 0 0 1 .912-1.178c.393-.33.843-.583 1.35-.76A5.135 5.135 0 0 1 424.543 0Zm0 1.881c-.57 0-1.039.171-1.406.513-.355.342-.532.805-.532 1.388 0 .544.171 1.007.513 1.387.354.38.829.57 1.425.57.266 0 .519-.05.76-.152a1.935 1.935 0 0 0 1.197-1.805c0-.292-.057-.552-.171-.78a1.624 1.624 0 0 0-.437-.608 1.843 1.843 0 0 0-.627-.38 1.975 1.975 0 0 0-.722-.133Zm0 5.796c-.33 0-.64.057-.931.171a2.385 2.385 0 0 0-.741.475c-.203.19-.368.43-.494.722a2.42 2.42 0 0 0-.172.931c0 .71.222 1.26.666 1.654.443.392 1 .589 1.672.589.659 0 1.21-.197 1.653-.59.443-.392.665-.943.665-1.653 0-.329-.063-.633-.19-.912a2.01 2.01 0 0 0-.494-.74 2.136 2.136 0 0 0-.741-.476 2.335 2.335 0 0 0-.893-.17ZM1078.14 3.116l-2.66 2.186-1.33-1.577 4.2-3.383h2.07v13.454h-2.28V3.116ZM1087.63 13.796l3.46-4.998-.02-.019c-.19.089-.43.152-.71.19a5.16 5.16 0 0 1-.74.057c-.59 0-1.15-.107-1.67-.323a4.714 4.714 0 0 1-1.37-.912 4.52 4.52 0 0 1-.93-1.368 4.619 4.619 0 0 1-.32-1.71c0-.71.13-1.356.38-1.939.25-.582.59-1.076 1.03-1.482.44-.418.96-.735 1.55-.95a5.508 5.508 0 0 1 1.94-.342c.7 0 1.34.12 1.94.361.61.228 1.13.551 1.58.97.44.417.78.911 1.02 1.481.26.558.38 1.16.38 1.806 0 .38-.03.74-.09 1.083-.07.33-.16.652-.29.969-.11.304-.26.614-.43.931-.17.317-.36.646-.57.988l-3.37 5.207h-2.77Zm5.21-9.235c0-.355-.07-.69-.19-1.008a2.445 2.445 0 0 0-.52-.836c-.23-.253-.5-.45-.82-.589a2.397 2.397 0 0 0-1.06-.228c-.77 0-1.4.254-1.88.76-.47.494-.7 1.14-.7 1.939 0 .38.05.734.17 1.064.12.316.3.589.53.817.23.228.49.412.8.551.31.127.66.19 1.04.19s.73-.063 1.05-.19c.33-.127.61-.304.83-.532.24-.24.43-.526.56-.855.12-.33.19-.69.19-1.083ZM898.114 3.116l-2.66 2.186-1.33-1.577 4.199-3.383h2.072v13.454h-2.281V3.116ZM912.791.342l-3.439 4.979.019.019c.177-.076.399-.133.665-.171.278-.038.532-.057.76-.057.595 0 1.153.114 1.672.342.519.215.976.52 1.368.912.393.38.697.836.912 1.368a4.16 4.16 0 0 1 .342 1.691c0 .71-.126 1.356-.38 1.939a4.491 4.491 0 0 1-1.045 1.5 4.37 4.37 0 0 1-1.558.932 5.319 5.319 0 0 1-1.919.342c-.71 0-1.362-.114-1.958-.342a4.96 4.96 0 0 1-1.558-.988 4.618 4.618 0 0 1-1.045-1.463 4.636 4.636 0 0 1-.361-1.825c0-.38.032-.734.095-1.064.063-.342.152-.665.266-.969.127-.317.272-.633.437-.95.178-.317.374-.646.589-.988l3.364-5.207h2.774Zm-5.207 9.235c0 .355.057.69.171 1.008.127.316.304.595.532.836.229.24.501.43.818.57.316.14.671.209 1.064.209.773 0 1.393-.241 1.862-.722.481-.494.722-1.14.722-1.939 0-.38-.063-.728-.19-1.045a2.163 2.163 0 0 0-.513-.836 2.398 2.398 0 0 0-.817-.532 2.434 2.434 0 0 0-1.026-.209c-.38 0-.735.063-1.064.19a2.37 2.37 0 0 0-1.369 1.387c-.126.33-.19.69-.19 1.083ZM958.123 3.116l-2.661 2.186-1.33-1.577 4.2-3.383h2.071v13.454h-2.28V3.116ZM965.388.342h9.141v2.09l-5.378 11.364h-2.679l5.662-11.402h-6.746V.342ZM1018.13 3.116l-2.66 2.186-1.33-1.577 4.2-3.383h2.07v13.454h-2.28V3.116ZM1030.22 0c.59 0 1.14.082 1.66.247.52.165.97.405 1.35.722.39.317.69.703.91 1.16.23.443.34.95.34 1.52 0 .785-.2 1.437-.59 1.957-.39.52-.89.88-1.5 1.083v.038c.35.089.68.234.99.437.3.19.57.43.8.722.22.279.4.596.53.95.14.355.21.741.21 1.16 0 .67-.13 1.266-.38 1.786a3.73 3.73 0 0 1-1.01 1.292c-.42.354-.91.62-1.48.798-.57.177-1.18.266-1.83.266-.64 0-1.25-.089-1.82-.266a4.368 4.368 0 0 1-1.5-.798 3.982 3.982 0 0 1-1.01-1.292c-.24-.52-.36-1.115-.36-1.787a3.413 3.413 0 0 1 .76-2.166c.24-.279.51-.507.82-.684.3-.19.62-.33.95-.418v-.038a3.302 3.302 0 0 1-1.5-1.045c-.4-.482-.59-1.115-.59-1.9 0-.57.1-1.084.32-1.54.23-.468.53-.861.91-1.178.39-.33.84-.583 1.35-.76a5.154 5.154 0 0 1 1.67-.266Zm0 1.881c-.57 0-1.04.171-1.4.513-.36.342-.53.805-.53 1.388 0 .544.17 1.007.51 1.387.35.38.83.57 1.42.57a1.992 1.992 0 0 0 1.39-.57 1.962 1.962 0 0 0 .57-1.387c0-.292-.06-.552-.17-.78a1.62 1.62 0 0 0-.44-.608 1.757 1.757 0 0 0-.62-.38 1.999 1.999 0 0 0-.73-.133Zm0 5.796c-.33 0-.64.057-.93.171-.28.114-.52.272-.74.475-.2.19-.37.43-.49.722-.12.279-.17.59-.17.931 0 .71.22 1.26.66 1.654.44.392 1 .589 1.67.589.66 0 1.21-.197 1.66-.59.44-.392.66-.943.66-1.653 0-.329-.06-.633-.19-.912a2.013 2.013 0 0 0-.49-.74 2.209 2.209 0 0 0-.74-.476 2.363 2.363 0 0 0-.9-.17Z"})}),tM=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M8.662 8.227h-.057c-.228.406-.595.742-1.102 1.008-.506.253-1.083.38-1.729.38-.367 0-.753-.051-1.159-.152a3.501 3.501 0 0 1-1.102-.456 3.062 3.062 0 0 1-.836-.875c-.215-.367-.323-.817-.323-1.349 0-.684.19-1.228.57-1.634.393-.405.893-.715 1.501-.93A8.103 8.103 0 0 1 6.44 3.8a21.6 21.6 0 0 1 2.185-.114v-.228c0-.57-.209-.988-.627-1.254-.405-.279-.893-.418-1.463-.418a3.3 3.3 0 0 0-1.387.304c-.443.203-.81.45-1.102.741L2.867 1.444A5.163 5.163 0 0 1 4.653.361 6.201 6.201 0 0 1 6.724 0C7.535 0 8.2.114 8.72.342c.533.228.95.526 1.255.893.304.367.513.78.627 1.235.126.456.19.912.19 1.368v5.549H8.662v-1.16Zm-.038-3.002h-.513c-.367 0-.753.02-1.159.057a4.404 4.404 0 0 0-1.12.21 2.211 2.211 0 0 0-.856.455c-.228.19-.342.456-.342.798 0 .216.045.4.133.551.102.14.228.254.38.342.152.09.323.152.513.19.19.038.38.057.57.057.786 0 1.381-.209 1.786-.627.406-.418.608-.988.608-1.71v-.323ZM5.038 480.293h2.28v9.12h-2.28v-9.12Zm-.323-3.098c0-.367.133-.684.4-.95a1.42 1.42 0 0 1 1.044-.418c.418 0 .767.133 1.045.399.292.254.437.577.437.969 0 .393-.145.722-.437.989-.278.253-.627.38-1.045.38-.418 0-.766-.133-1.045-.399a1.362 1.362 0 0 1-.399-.97ZM9.423 243.928a2.63 2.63 0 0 0-.133-.837 1.81 1.81 0 0 0-.38-.703 1.8 1.8 0 0 0-.685-.475 2.201 2.201 0 0 0-.95-.19c-.684 0-1.266.209-1.748.627-.468.406-.728.931-.779 1.578h4.675Zm2.28 1.026v.304c0 .101-.007.202-.02.304H4.749c.026.329.108.633.247.912.152.266.349.5.59.703.24.19.512.342.816.456.304.114.621.171.95.171.57 0 1.052-.102 1.445-.304.392-.216.715-.507.969-.874l1.52 1.216c-.9 1.216-2.204 1.824-3.915 1.824-.709 0-1.361-.108-1.957-.323a4.863 4.863 0 0 1-1.558-.95c-.43-.406-.772-.9-1.026-1.482-.24-.596-.36-1.267-.36-2.014 0-.735.12-1.4.36-1.996a4.553 4.553 0 0 1 1.026-1.539c.43-.43.938-.76 1.52-.988a5.085 5.085 0 0 1 1.92-.361c.633 0 1.215.108 1.748.323a3.651 3.651 0 0 1 1.406.931c.392.406.696.919.912 1.539.228.608.342 1.324.342 2.148ZM10.888 720.04c.595 0 1.102.108 1.52.323.43.203.779.475 1.045.817.278.342.481.735.608 1.178.127.443.19.899.19 1.368v5.7h-2.28v-5.054c0-.266-.02-.545-.057-.836a2.166 2.166 0 0 0-.247-.779 1.582 1.582 0 0 0-.532-.589c-.216-.152-.507-.228-.874-.228-.355 0-.66.076-.912.228a1.988 1.988 0 0 0-.628.589 2.515 2.515 0 0 0-.36.817 3.45 3.45 0 0 0-.115.874v4.978h-2.28v-5.51c0-.57-.139-1.039-.418-1.406-.266-.38-.69-.57-1.273-.57-.342 0-.64.076-.893.228a1.876 1.876 0 0 0-.627.551 2.885 2.885 0 0 0-.36.798 3.521 3.521 0 0 0-.115.893v5.016H0v-9.12h2.166v1.463h.038a2.88 2.88 0 0 1 .4-.646 3.62 3.62 0 0 1 .607-.551c.24-.165.513-.291.817-.38a3.18 3.18 0 0 1 1.007-.152c.71 0 1.299.158 1.767.475.47.317.83.735 1.083 1.254.304-.557.71-.982 1.216-1.273.507-.304 1.103-.456 1.787-.456ZM11.273 974h-2.28v-5.776h-.039c-.29.456-.709.817-1.254 1.083a3.896 3.896 0 0 1-1.767.399c-.696 0-1.323-.127-1.88-.38a4.643 4.643 0 0 1-1.407-1.045 5.024 5.024 0 0 1-.893-1.539 5.862 5.862 0 0 1-.304-1.901c0-.671.108-1.298.323-1.881a4.6 4.6 0 0 1 .912-1.52c.393-.43.861-.766 1.406-1.007a4.188 4.188 0 0 1 1.786-.38c.418 0 .792.051 1.121.152.342.089.646.209.912.361.266.14.488.304.665.494.19.178.342.355.456.532h.057v-1.273h2.186V974Zm-7.506-9.159c0 .355.05.71.152 1.065.114.354.279.671.494.95.216.278.488.506.817.684.33.177.716.266 1.16.266.417 0 .791-.083 1.12-.247.33-.178.608-.406.836-.684a2.74 2.74 0 0 0 .532-.931c.127-.355.19-.71.19-1.065a3.15 3.15 0 0 0-.19-1.064 2.713 2.713 0 0 0-.532-.95 2.774 2.774 0 0 0-.836-.684 2.33 2.33 0 0 0-1.12-.266c-.444 0-.83.089-1.16.266-.33.165-.601.387-.817.665-.215.279-.38.596-.494.95a3.663 3.663 0 0 0-.152 1.045ZM4.318 55.025v6.403h.057c.114-.152.26-.31.437-.475.178-.164.387-.316.627-.456.254-.139.545-.253.874-.342.33-.101.703-.152 1.121-.152.646 0 1.242.127 1.786.38a4.15 4.15 0 0 1 1.407 1.007c.392.431.696.938.912 1.52.215.583.323 1.21.323 1.882 0 .67-.108 1.304-.323 1.9a4.55 4.55 0 0 1-.893 1.539c-.38.43-.85.779-1.407 1.045-.544.253-1.165.38-1.862.38-.646 0-1.254-.14-1.824-.418a3.116 3.116 0 0 1-1.31-1.216h-.039v1.368H2.038V55.025h2.28Zm5.225 9.767c0-.355-.057-.704-.17-1.046a2.79 2.79 0 0 0-.476-.95 2.337 2.337 0 0 0-.817-.665c-.329-.177-.715-.266-1.159-.266-.418 0-.791.09-1.12.266-.33.178-.615.406-.856.684a3.17 3.17 0 0 0-.532.95 3.46 3.46 0 0 0-.17 1.065c0 .354.056.709.17 1.064.127.342.304.652.532.93.24.28.526.507.855.685.33.164.703.247 1.121.247.444 0 .83-.089 1.16-.266.329-.178.601-.406.816-.684.216-.279.374-.596.475-.95a3.46 3.46 0 0 0 .171-1.064ZM7.318 540.296v9.671c0 .545-.044 1.058-.133 1.54-.088.494-.26.918-.513 1.273-.24.367-.576.658-1.007.874-.418.215-.969.323-1.653.323-.19 0-.38-.013-.57-.038a6.1 6.1 0 0 1-.456-.076l.19-1.938a2.965 2.965 0 0 0 .627.076c.266 0 .482-.051.646-.152.165-.102.292-.241.38-.418.089-.178.146-.387.171-.628.026-.228.038-.475.038-.741v-9.766h2.28Zm-2.603-3.097c0-.368.133-.684.4-.95a1.417 1.417 0 0 1 1.044-.418c.418 0 .767.133 1.045.399.292.253.437.576.437.969 0 .392-.145.722-.437.988-.278.253-.627.38-1.045.38-.418 0-.766-.133-1.045-.399a1.362 1.362 0 0 1-.399-.969ZM5.361 302.107H3.632v-1.824h1.73v-1.349c0-.545.056-1.065.17-1.559.127-.506.33-.95.608-1.33.292-.38.672-.677 1.14-.893.47-.228 1.058-.342 1.767-.342.254 0 .463.013.627.038.178.013.355.045.533.095l-.152 1.938a3.535 3.535 0 0 0-.419-.095 2.585 2.585 0 0 0-.456-.038c-.329 0-.595.064-.798.19a1.372 1.372 0 0 0-.475.494 2.278 2.278 0 0 0-.209.665 4.508 4.508 0 0 0-.057.703v1.483h2.11v1.824H7.64v7.296h-2.28v-7.296ZM2 780.309h2.166v1.463h.038c.203-.456.551-.855 1.045-1.197.507-.354 1.102-.532 1.786-.532.596 0 1.102.108 1.52.323.431.203.78.475 1.046.817.278.342.48.735.608 1.178.126.444.19.9.19 1.368v5.701h-2.28v-5.055c0-.266-.02-.544-.058-.836a2.167 2.167 0 0 0-.247-.779 1.59 1.59 0 0 0-.532-.589c-.215-.152-.506-.228-.874-.228-.367 0-.684.076-.95.228-.266.14-.487.323-.665.551a2.587 2.587 0 0 0-.38.798 3.054 3.054 0 0 0-.133.893v5.017H2v-9.121ZM9.233 122.8c-.178-.254-.444-.463-.799-.627a2.39 2.39 0 0 0-1.083-.266 2.21 2.21 0 0 0-1.102.266 2.376 2.376 0 0 0-.798.665 2.991 2.991 0 0 0-.456.95c-.101.342-.152.69-.152 1.045s.051.709.152 1.064c.114.342.279.652.494.931.216.279.482.507.798.684.33.165.71.247 1.14.247.355 0 .71-.07 1.064-.209.355-.139.64-.342.856-.608l1.425 1.444c-.38.405-.868.722-1.463.95a5.425 5.425 0 0 1-1.9.323 5.69 5.69 0 0 1-1.92-.323 4.643 4.643 0 0 1-1.577-.95 4.695 4.695 0 0 1-1.064-1.52c-.253-.595-.38-1.273-.38-2.033 0-.735.127-1.4.38-1.995a4.684 4.684 0 0 1 1.064-1.52 4.735 4.735 0 0 1 1.54-.969 5.267 5.267 0 0 1 1.9-.342c.67 0 1.317.126 1.938.38.633.253 1.133.601 1.5 1.045L9.234 122.8ZM3.038 595.055h2.28v9.082h.057l3.458-3.838h2.927l-3.953 4.123 4.2 4.998H8.985l-3.61-4.675h-.057v4.675h-2.28v-14.365ZM1.468 844.835c0-.722.127-1.375.38-1.957a4.684 4.684 0 0 1 1.064-1.52 4.649 4.649 0 0 1 1.577-.969 5.474 5.474 0 0 1 1.938-.342c.684 0 1.33.114 1.938.342a4.649 4.649 0 0 1 1.578.969c.443.418.791.924 1.045 1.52.266.582.399 1.235.399 1.957s-.133 1.381-.4 1.976a4.672 4.672 0 0 1-1.044 1.539 4.905 4.905 0 0 1-1.578.988 5.211 5.211 0 0 1-1.938.361c-.684 0-1.33-.12-1.938-.361a4.905 4.905 0 0 1-1.577-.988 4.923 4.923 0 0 1-1.064-1.539 4.995 4.995 0 0 1-.38-1.976Zm2.318 0c0 .354.05.709.152 1.064.114.355.279.671.494.95.216.279.488.507.817.684.33.177.722.266 1.178.266.456 0 .85-.089 1.178-.266.33-.177.602-.405.817-.684.216-.279.374-.595.476-.95.114-.355.17-.71.17-1.064 0-.355-.056-.703-.17-1.045a2.782 2.782 0 0 0-.476-.95 2.325 2.325 0 0 0-.817-.665c-.329-.178-.722-.266-1.178-.266-.456 0-.848.088-1.178.266-.329.164-.601.386-.817.665a3.07 3.07 0 0 0-.494.95c-.101.342-.152.69-.152 1.045ZM11.273 360.286v8.303c0 .824-.102 1.565-.304 2.224-.203.671-.52 1.235-.95 1.691-.418.468-.95.829-1.597 1.083-.646.253-1.412.38-2.299.38a7.93 7.93 0 0 1-1.178-.095 8.626 8.626 0 0 1-1.216-.285 7.501 7.501 0 0 1-1.14-.475 5.58 5.58 0 0 1-.988-.646l1.311-1.767c.444.418.944.734 1.501.95a4.432 4.432 0 0 0 1.691.342c.545 0 1.001-.083 1.368-.247.38-.152.678-.368.893-.646.228-.279.387-.608.476-.988.1-.381.152-.799.152-1.255v-.665h-.038c-.33.444-.754.786-1.274 1.026-.506.228-1.076.342-1.71.342-.684 0-1.304-.126-1.862-.38a4.315 4.315 0 0 1-1.425-1.026 4.81 4.81 0 0 1-.893-1.501 5.27 5.27 0 0 1-.323-1.843c0-.658.101-1.279.304-1.862a4.77 4.77 0 0 1 .893-1.52 4.37 4.37 0 0 1 1.406-1.026 4.454 4.454 0 0 1 1.862-.38c.646 0 1.248.133 1.805.399.558.266 1.001.678 1.33 1.235h.039v-1.368h2.166Zm-4.865 1.596c-.418 0-.791.076-1.12.228a2.475 2.475 0 0 0-.818.627 2.888 2.888 0 0 0-.513.912 3.707 3.707 0 0 0-.17 1.14c0 .368.056.722.17 1.064.127.342.298.653.513.931.228.266.5.482.817.646.33.165.697.247 1.102.247.418 0 .792-.076 1.121-.228.342-.164.627-.38.855-.646.241-.266.425-.57.552-.912a3.25 3.25 0 0 0 .19-1.102c0-.392-.064-.766-.19-1.121a2.746 2.746 0 0 0-.552-.931 2.423 2.423 0 0 0-.836-.627 2.646 2.646 0 0 0-1.12-.228ZM11.273 189.396H9.106v-1.368h-.038c-.316.532-.76.938-1.33 1.216a3.976 3.976 0 0 1-1.805.418c-.696 0-1.323-.126-1.88-.38a4.627 4.627 0 0 1-1.407-1.045 5 5 0 0 1-.893-1.539 5.851 5.851 0 0 1-.304-1.9c0-.671.108-1.298.323-1.881a4.59 4.59 0 0 1 .912-1.52 4.149 4.149 0 0 1 1.406-1.007 4.188 4.188 0 0 1 1.786-.38c.418 0 .792.051 1.121.152.33.089.615.203.855.342.254.139.47.291.646.456.178.165.323.323.437.475h.057v-6.403h2.28v14.364Zm-7.506-4.598c0 .355.05.71.152 1.064.114.355.279.672.494.95.216.279.488.507.817.684.33.178.716.266 1.16.266.417 0 .791-.082 1.12-.247.33-.177.608-.405.836-.684a2.73 2.73 0 0 0 .532-.931c.127-.354.19-.709.19-1.064a3.15 3.15 0 0 0-.19-1.064 2.704 2.704 0 0 0-.532-.95 2.744 2.744 0 0 0-.836-.684 2.33 2.33 0 0 0-1.12-.266c-.444 0-.83.089-1.16.266-.33.165-.601.386-.817.665a3.08 3.08 0 0 0-.494.95 3.663 3.663 0 0 0-.152 1.045ZM5.038 655.058h2.28v14.365h-2.28v-14.365ZM4.185 900.316v1.273h.057c.114-.177.26-.355.437-.532.19-.19.418-.355.684-.494.266-.152.564-.272.893-.361a4.017 4.017 0 0 1 1.14-.152c.646 0 1.242.127 1.787.38a4.149 4.149 0 0 1 1.406 1.007c.392.431.696.937.912 1.52.215.583.323 1.21.323 1.881s-.108 1.305-.323 1.9a4.54 4.54 0 0 1-.893 1.539c-.38.431-.85.779-1.406 1.045-.545.254-1.166.38-1.863.38a4.015 4.015 0 0 1-1.786-.399c-.532-.266-.943-.627-1.235-1.083H4.28v5.777H2v-13.681h2.185Zm5.32 4.522c0-.355-.056-.703-.17-1.045a2.791 2.791 0 0 0-.476-.95 2.336 2.336 0 0 0-.817-.665c-.329-.177-.715-.266-1.159-.266a2.33 2.33 0 0 0-1.12.266c-.33.177-.615.405-.856.684a3.17 3.17 0 0 0-.532.95 3.46 3.46 0 0 0-.17 1.064c0 .355.056.709.17 1.064.127.342.304.653.532.931.24.279.526.507.855.684.33.165.703.247 1.121.247.444 0 .83-.088 1.16-.266.329-.177.601-.405.816-.684.216-.278.374-.595.476-.95a3.46 3.46 0 0 0 .17-1.064ZM7.073 420.023c.596 0 1.102.108 1.52.323.431.203.78.475 1.046.817.278.342.48.735.607 1.178.127.444.19.9.19 1.368v5.701h-2.28v-5.017c0-.266-.019-.538-.057-.817a2.167 2.167 0 0 0-.247-.779 1.442 1.442 0 0 0-.513-.589c-.215-.152-.506-.228-.874-.228-.367 0-.684.07-.95.209-.266.14-.487.33-.665.57-.177.228-.31.488-.399.779a3.054 3.054 0 0 0-.133.893v4.979h-2.28v-14.365h2.28v6.517h.038c.089-.19.216-.373.38-.551.178-.19.38-.354.608-.494.228-.152.488-.272.78-.361.29-.088.607-.133.95-.133Z"})}),tE=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.75 6A2.75 2.75 0 0 1 5.5 3.25h13A2.75 2.75 0 0 1 21.25 6v12a2.75 2.75 0 0 1-2.75 2.75h-13A2.75 2.75 0 0 1 2.75 18V6Zm11.5-1.25h-4.5v14.5h4.5V4.75Zm1.5 14.5V4.75h2.75c.69 0 1.25.56 1.25 1.25v12c0 .69-.56 1.25-1.25 1.25h-2.75ZM5.5 4.75h2.75v14.5H5.5c-.69 0-1.25-.56-1.25-1.25V6c0-.69.56-1.25 1.25-1.25Z",clipRule:"evenodd"})}),tI=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.25 12a.75.75 0 0 1-.442.684l-10 4.5-.616-1.368L14.672 12l-8.48-3.816.616-1.368 10 4.5a.75.75 0 0 1 .442.684Z",clipRule:"evenodd"})}),tB=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M14.733 20.75a11.328 11.328 0 0 1-4.415-.993l-5.44-2.56a2.238 2.238 0 0 1-1.06-2.967c.251-.533.703-.944 1.256-1.144a2.21 2.21 0 0 1 1.694.081l1.016.479c-.477-1.621-1.431-4.305-2.862-5.873l-.883-.717a2.145 2.145 0 0 1 1.014-3.78 2.14 2.14 0 0 1 1.565.36A12.125 12.125 0 0 1 9.39 6.4c.26-.389.637-.684 1.077-.841a2.149 2.149 0 0 1 1.687.08c.235.11.45.26.636.442.238-.27.542-.475.883-.593a2.016 2.016 0 0 1 1.572.08c.279.126.524.318.715.558.099-.064.205-.115.318-.15a1.55 1.55 0 0 1 1.987.938l2.11 5.881a6.511 6.511 0 0 1 0 4.35 5.317 5.317 0 0 1-3.223 3.232c-.78.26-1.598.385-2.42.372Zm-8.802-6.414c-.128-.027-.32-.035-.417 0a.883.883 0 0 0-.512.461.888.888 0 0 0 .433 1.196l5.404 2.613s3.197 1.488 5.828.54a3.902 3.902 0 0 0 2.438-2.41 5.134 5.134 0 0 0 0-3.445l-2.12-5.881a.223.223 0 0 0-.202-.157.23.23 0 0 0-.222.307l.3.886a.664.664 0 0 1-.397.886.661.661 0 0 1-.883-.399l-.583-1.63a.796.796 0 0 0-.38-.416.713.713 0 0 0-.556 0 .725.725 0 0 0-.468.886l.247.93a.657.657 0 0 1-.45.797.652.652 0 0 1-.812-.407l-.583-1.612a.885.885 0 0 0-1.122-.523.884.884 0 0 0-.52 1.125l.423 1.187a.668.668 0 0 1-.397.886.66.66 0 0 1-.883-.399A10.226 10.226 0 0 0 5.77 4.921a.793.793 0 0 0-1.104.177c-.127.168-.116.326-.091.536.024.21.13.402.293.536l.883.744.061.062C8.223 9.57 9.345 14.637 9.39 14.85a.666.666 0 0 1-.239.664.67.67 0 0 1-.688.08l-1.54-.797c-.385-.21-.466-.282-.991-.46Z"})}),t$=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.926 6.578v10.898c0 .602.33.963.862.963.541 0 .862-.351.862-.963V5.726c0-.682-.451-1.153-1.093-1.153-.39 0-.742.15-1.373.622l-2.026 1.504c-.4.29-.591.561-.591.852 0 .38.3.692.672.692.22 0 .43-.08.721-.291l1.885-1.374h.08ZM4.42 4.903a.77.77 0 0 1 .77.77v5.35h6.168v-5.35a.77.77 0 1 1 1.54 0v12.242a.77.77 0 1 1-1.54 0v-5.351H5.19v5.351a.77.77 0 0 1-1.54 0V5.673a.77.77 0 0 1 .77-.77Z",clipRule:"evenodd"})}),tT=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.159 16c-.562.638-.724.905-.724 1.248 0 .553.438.886 1.134.886h6.289c.524 0 .829-.276.829-.724 0-.457-.324-.734-.83-.734H15.57v-.114l3.526-4.031c1.715-1.954 2.201-2.859 2.201-4.098 0-2.096-1.648-3.583-3.992-3.583-2.516 0-4.089 1.697-4.089 3.317 0 .514.305.867.772.867.391 0 .658-.258.791-.763.286-1.238 1.191-1.972 2.42-1.972 1.45 0 2.412.896 2.412 2.24 0 .895-.41 1.696-1.487 2.925L14.159 16ZM3.419 5.364c.404 0 .732.327.732.731v5.087h5.862V6.095a.732.732 0 1 1 1.464 0v11.637a.732.732 0 0 1-1.464 0v-5.087H4.151v5.087a.732.732 0 1 1-1.464 0V6.095c0-.404.328-.731.732-.731Z",clipRule:"evenodd"})}),tO=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.05 5.856a.75.75 0 1 0-1.5 0v11.922a.75.75 0 1 0 1.5 0v-5.211h6.006v5.21a.75.75 0 0 0 1.5 0V5.857a.75.75 0 0 0-1.5 0v5.21H4.05v-5.21Zm9.479 9.234c-.418 0-.713.304-.713.732 0 1.454 1.796 2.937 4.248 2.937 2.642 0 4.486-1.56 4.486-3.783 0-1.635-1.226-3.041-2.832-3.222v-.095c1.32-.228 2.395-1.596 2.395-3.031 0-1.977-1.692-3.393-4.068-3.393-2.338 0-3.925 1.425-3.925 2.898 0 .476.285.79.723.79.37 0 .608-.2.798-.723.38-.979 1.235-1.54 2.366-1.54 1.454 0 2.433.875 2.433 2.177s-1.007 2.242-2.395 2.242h-1.121c-.456 0-.76.295-.76.713 0 .409.323.723.76.723h1.188c1.653 0 2.765.978 2.765 2.432 0 1.455-1.083 2.386-2.784 2.386-1.293 0-2.281-.57-2.775-1.587-.247-.485-.456-.656-.79-.656Z",clipRule:"evenodd"})}),tP=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M18.793 15.755v1.931c0 .552.286.866.79.866.514 0 .8-.314.8-.866v-1.931h.989c.542 0 .847-.267.847-.723 0-.467-.314-.733-.847-.733h-.99V6.696c0-.885-.485-1.38-1.35-1.38-.657 0-1.095.286-1.657 1.114-2.16 3.235-3.016 4.605-4.377 7.013-.333.609-.447.942-.447 1.294 0 .628.495 1.018 1.237 1.018h5.005Zm0-1.456H14.15v-.095c1.246-2.16 2.94-4.882 4.558-7.27h.085V14.3ZM2.95 5.705a.73.73 0 0 1 .73.731v5.079h5.855V6.436a.73.73 0 1 1 1.461 0v11.62a.73.73 0 0 1-1.461 0v-5.08H3.68v5.08a.73.73 0 0 1-1.461 0V6.435a.73.73 0 0 1 .73-.73Z",clipRule:"evenodd"})}),tH=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.615 15.053c-.409 0-.678.316-.678.78 0 1.302 1.534 2.799 3.988 2.799 2.593 0 4.443-1.822 4.443-4.388 0-2.408-1.664-4.1-4.025-4.1-1.07 0-2.157.447-2.575 1.07h-.093l.353-4.137h5.01c.55 0 .856-.251.856-.698 0-.455-.316-.725-.855-.725h-5.215c-.8 0-1.2.326-1.255 1.014l-.41 5.205c-.046.716.224 1.135.754 1.135.297 0 .483-.112 1.162-.744a2.773 2.773 0 0 1 1.905-.725c1.609 0 2.752 1.152 2.752 2.789 0 1.71-1.18 2.9-2.872 2.9-1.116 0-1.971-.54-2.482-1.534-.242-.474-.447-.641-.763-.641ZM3.082 5.903c.394 0 .714.32.714.715v4.962h5.72V6.618a.714.714 0 1 1 1.427 0V17.969a.714.714 0 1 1-1.428 0v-4.961H3.796v4.962a.714.714 0 0 1-1.428 0V6.617c0-.394.32-.714.714-.714Z",clipRule:"evenodd"})}),tA=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.65 5.517c-3.098 0-4.825 2.492-4.825 6.98 0 1.932.318 3.379.962 4.405.765 1.204 2.025 1.858 3.602 1.858 2.594 0 4.349-1.745 4.349-4.312 0-2.436-1.661-4.144-4.032-4.144-1.456 0-2.79.803-3.22 1.941h-.074c.028-3.49 1.13-5.319 3.21-5.319.83 0 1.53.299 2.203.961.336.327.532.43.793.43.401 0 .69-.3.69-.7 0-.43-.373-.943-.989-1.344-.709-.486-1.67-.756-2.669-.756Zm-.196 11.843c-1.652 0-2.809-1.185-2.809-2.856 0-1.652 1.13-2.81 2.744-2.81 1.661 0 2.744 1.12 2.744 2.82 0 1.717-1.074 2.846-2.679 2.846Zm-14-11.369c.396 0 .717.321.717.717v4.981h5.742V6.708a.717.717 0 0 1 1.434 0v11.396a.717.717 0 1 1-1.434 0v-4.981H4.171v4.981a.717.717 0 0 1-1.433 0V6.708c0-.396.32-.717.717-.717Z",clipRule:"evenodd"})}),tL=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7.416 4c.506 0 .916.4.916.894v6.212h7.336V4.894c0-.494.41-.894.916-.894s.916.4.916.894v14.212c0 .494-.41.894-.916.894a.905.905 0 0 1-.916-.894v-6.212H8.332v6.212c0 .494-.41.894-.916.894a.905.905 0 0 1-.916-.894V4.894C6.5 4.4 6.91 4 7.416 4Z",clipRule:"evenodd"})}),tD=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 4.924c-2.048-1.87-5.144-2.367-7.547-.32-2.557 2.178-2.927 5.843-.907 8.434.777.997 2.302 2.503 3.776 3.89a166.33 166.33 0 0 0 3.706 3.371l.013.012c.07.061.152.134.23.191.09.069.215.15.38.198.223.067.463.067.685 0 .165-.049.29-.13.381-.198.078-.057.16-.13.23-.191l.012-.012c.733-.647 2.218-1.97 3.707-3.371 1.474-1.387 2.998-2.893 3.775-3.89 2.014-2.583 1.7-6.275-.914-8.44-2.433-2.016-5.484-1.545-7.527.326Zm1.053 1.068L14.53 7.47a.75.75 0 0 1-.195 1.2l-3.069 1.536 2.264 2.264a.75.75 0 0 1-1.06 1.06l-3-3a.75.75 0 0 1 .195-1.2l3.069-1.535L11.47 6.53a.774.774 0 0 1-.04-.042c-1.593-1.857-4.134-2.335-6.004-.742-1.953 1.663-2.217 4.42-.697 6.37.695.891 2.134 2.321 3.62 3.72a164.559 164.559 0 0 0 3.645 3.314c.736-.65 2.19-1.947 3.644-3.314 1.486-1.399 2.926-2.829 3.62-3.72 1.528-1.96 1.285-4.728-.688-6.363-1.732-1.435-3.936-1.188-5.517.239Z",clipRule:"evenodd"})}),tZ=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.75 12a8.25 8.25 0 1 1 16.5 0 8.25 8.25 0 0 1-16.5 0ZM12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm.239 8.733c-.923.725-1.245 1.183-1.245 1.99 0 .437.274.765.773.765.478 0 .656-.273.827-.676.157-.575.383-.814 1.046-1.32.875-.65 1.456-1.23 1.456-2.29 0-1.524-1.251-2.46-3.049-2.46-.97 0-1.716.252-2.215.676-.41.362-.676.84-.676 1.292 0 .376.239.684.67.684.287 0 .45-.13.662-.41.329-.561.78-.814 1.436-.814.752 0 1.347.444 1.347 1.114 0 .602-.37.93-1.033 1.45Zm-.472 3.726c-.567 0-1.032.396-1.032.964 0 .567.465.964 1.032.964s1.039-.397 1.039-.964c0-.568-.472-.964-1.04-.964Z",clipRule:"evenodd"})}),tj=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.004 3.8a8.2 8.2 0 0 0-7.348 11.845c.265.533.257 1.202.196 1.755-.065.59-.215 1.224-.376 1.79-.104.363-.215.708-.319 1.01h7.847a8.2 8.2 0 0 0 0-16.4ZM2.266 20.692l.003-.007.012-.029a13.79 13.79 0 0 0 .207-.537c.132-.358.3-.846.449-1.367.15-.526.273-1.064.325-1.529.055-.502.009-.771-.039-.866A9.763 9.763 0 0 1 2.203 12c0-5.412 4.389-9.8 9.8-9.8 5.413 0 9.8 4.388 9.8 9.8 0 5.412-4.387 9.8-9.8 9.8H3.006a.8.8 0 0 1-.739-1.108ZM11.967 9.05a1.2 1.2 0 0 0-1.162.9.8.8 0 0 1-1.55-.4 2.8 2.8 0 0 1 5.512.7c0 .855-.414 1.425-.87 1.865-.186.18-.4.357-.597.521l-.087.072a9.82 9.82 0 0 0-.68.608.8.8 0 1 1-1.132-1.132c.278-.277.551-.509.789-.706l.091-.076c.204-.17.365-.303.505-.438.295-.284.381-.465.381-.714a1.2 1.2 0 0 0-1.2-1.2Zm.01 7.5h-.01a.8.8 0 0 1 0-1.6h.01a.8.8 0 1 1 0 1.6Z",clipRule:"evenodd"})}),tV=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",d:"m5.83 16.32 2.088 2.088-1.34 1.34a.2.2 0 0 1-.18.055L3.37 19.22a.2.2 0 0 1-.103-.338l2.562-2.562Z"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M19.01 3.516a2.86 2.86 0 0 0-3.885-.148l-7.804 6.694a2.86 2.86 0 0 0-.74 3.358l.154.336-1.058 1.058a.961.961 0 0 0 0 1.36l2.387 2.386a.96.96 0 0 0 1.359 0l1.058-1.058.336.154a2.86 2.86 0 0 0 3.358-.74l6.694-7.804a2.86 2.86 0 0 0-.148-3.884l-1.712-1.712Zm-2.908.99a1.36 1.36 0 0 1 1.847.07l1.711 1.712a1.36 1.36 0 0 1 .07 1.847l-5.088 5.932-4.471-4.472 5.931-5.089ZM9.03 10.574l-.731.627a1.36 1.36 0 0 0-.352 1.596l.352.77c.137.3.082.666-.164.912l-1.015 1.015 1.624 1.624 1.015-1.015a.812.812 0 0 1 .911-.164l.77.352a1.36 1.36 0 0 0 1.597-.352l.627-.73-4.634-4.635Z",clipRule:"evenodd"})]}),tz=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M18.336 5.522a.917.917 0 0 0-1.297 0l-1.062 1.062 1.296 1.296 1.063-1.062a.917.917 0 0 0 0-1.296Zm1.06 2.357A2.417 2.417 0 1 0 15.98 4.46l-1.592 1.592-8.115 8.115-.056.056c-.646.646-1.044 1.044-1.356 1.506a5.75 5.75 0 0 0-.66 1.32c-.183.527-.263 1.084-.392 1.989l-.05.355a.75.75 0 0 0 .89.841l.477-.096c.813-.164 1.314-.265 1.786-.45a5.75 5.75 0 0 0 1.186-.636c.416-.291.777-.652 1.364-1.239l9.935-9.935ZM16.213 8.94l-1.297-1.296-7.583 7.583c-.72.72-1.008 1.012-1.228 1.34a4.25 4.25 0 0 0-.488.976c-.09.258-.147.531-.221 1.009.467-.099.724-.165.966-.26.31-.122.604-.28.876-.47.295-.206.56-.467 1.213-1.12l7.762-7.762ZM12.083 19.5a.75.75 0 0 1 .75-.75H19.5a.75.75 0 0 1 0 1.5h-6.667a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"})}),tR=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7.168 6.595h-.001l-1.217 1.1H7.5a.75.75 0 0 1 0 1.5H4a.75.75 0 0 1-.75-.75V5a.75.75 0 0 1 1.5 0v1.757l1.416-1.279a8.75 8.75 0 1 1-2.7 8.466.75.75 0 1 1 1.464-.332 7.25 7.25 0 1 0 2.238-7.017Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 6.75a.75.75 0 0 1 .75.75v4.19l2.78 2.78a.75.75 0 1 1-1.06 1.06l-2.971-2.97a.85.85 0 0 1-.249-.601V7.5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})]}),tF=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 3.25A2.75 2.75 0 0 0 3.25 6v12A2.75 2.75 0 0 0 6 20.75h12A2.75 2.75 0 0 0 20.75 18V6A2.75 2.75 0 0 0 18 3.25H6ZM4.75 18v-1.69l4.366-4.365a1.25 1.25 0 0 1 1.768 0l2.586 2.585 2 2a.75.75 0 1 0 1.06-1.06L15.06 14l1.056-1.056a1.25 1.25 0 0 1 1.768 0l1.366 1.367V18c0 .69-.56 1.25-1.25 1.25H6c-.69 0-1.25-.56-1.25-1.25Zm7.194-7.116L14 12.939l1.056-1.055a2.75 2.75 0 0 1 3.889 0l.305.305V6c0-.69-.56-1.25-1.25-1.25H6c-.69 0-1.25.56-1.25 1.25v8.19l3.305-3.306a2.75 2.75 0 0 1 3.89 0ZM14 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"})}),tN=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.25a.75.75 0 0 1 .75.75v10.19l2.72-2.72a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06l2.72 2.72V4a.75.75 0 0 1 .75-.75Zm-8 12a.75.75 0 0 1 .75.75v1A2.25 2.25 0 0 0 7 19.25h10A2.25 2.25 0 0 0 19.25 17v-1a.75.75 0 0 1 1.5 0v1A3.75 3.75 0 0 1 17 20.75H7A3.75 3.75 0 0 1 3.25 17v-1a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),tq=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.25 3a.75.75 0 0 0-1.5 0v3a.75.75 0 0 0 1.5 0V3Zm0 10a.75.75 0 0 0-1.5 0v3a.75.75 0 0 0 1.5 0v-3Zm-3.5-3.5a.75.75 0 0 1-.75.75H3a.75.75 0 0 1 0-1.5h3a.75.75 0 0 1 .75.75Zm9.25.75a.75.75 0 0 0 0-1.5h-3a.75.75 0 0 0 0 1.5h3ZM7.555 7.555a.75.75 0 0 1-1.06 0l-2.122-2.12a.75.75 0 1 1 1.061-1.061l2.121 2.12a.75.75 0 0 1 0 1.061ZM18.97 20.03a.75.75 0 1 0 1.06-1.06l-7.525-7.525a.75.75 0 0 0-1.06 1.06l7.525 7.525ZM7.555 11.444a.75.75 0 0 1 0 1.061l-2.12 2.121a.75.75 0 1 1-1.061-1.06l2.12-2.122a.75.75 0 0 1 1.061 0Zm7.072-6.01a.75.75 0 0 0-1.061-1.06l-2.122 2.12a.75.75 0 1 0 1.061 1.061l2.121-2.12Z",clipRule:"evenodd"})}),tU=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 3.25A2.75 2.75 0 0 0 3.25 6v12A2.75 2.75 0 0 0 6 20.75h12A2.75 2.75 0 0 0 20.75 18V6A2.75 2.75 0 0 0 18 3.25H6Zm13.25 9V6c0-.69-.56-1.25-1.25-1.25H6c-.69 0-1.25.56-1.25 1.25v6.25h1.836c.464 0 .909.184 1.237.513l2.414 2.414a.25.25 0 0 0 .177.073h3.172a.25.25 0 0 0 .177-.073l2.414-2.414a1.75 1.75 0 0 1 1.237-.513h1.836Zm-14.5 1.5h1.836a.25.25 0 0 1 .177.073l2.414 2.414a1.75 1.75 0 0 0 1.237.513h3.172c.464 0 .909-.184 1.237-.513l2.414-2.414a.25.25 0 0 1 .177-.073h1.836V18c0 .69-.56 1.25-1.25 1.25H6c-.69 0-1.25-.56-1.25-1.25v-4.25Z",clipRule:"evenodd"})}),tW=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.75 6a.75.75 0 0 1-.75.75h-9.354a2.751 2.751 0 0 1-5.292 0H4a.75.75 0 0 1 0-1.5h1.354a2.751 2.751 0 0 1 5.292 0H20a.75.75 0 0 1 .75.75Zm0 6a.75.75 0 0 1-.75.75h-1.354a2.751 2.751 0 0 1-5.293 0H4a.75.75 0 0 1 0-1.5h9.354a2.751 2.751 0 0 1 5.293 0H20a.75.75 0 0 1 .75.75Zm0 6a.75.75 0 0 1-.75.75h-9.354a2.751 2.751 0 0 1-5.292 0H4a.75.75 0 0 1 0-1.5h1.354a2.751 2.751 0 0 1 5.292 0H20a.75.75 0 0 1 .75.75Zm-3.5-6a1.25 1.25 0 1 0-2.5 0 1.25 1.25 0 0 0 2.5 0Zm-8-6a1.25 1.25 0 1 0-2.5 0 1.25 1.25 0 0 0 2.5 0Zm0 12a1.25 1.25 0 1 0-2.5 0 1.25 1.25 0 0 0 2.5 0Z",clipRule:"evenodd"})}),tG=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.75 12a8.25 8.25 0 1 1 16.5 0 8.25 8.25 0 0 1-16.5 0ZM12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25ZM13 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-1 2.75a.75.75 0 0 1 .75.75v5a.75.75 0 0 1-1.5 0v-5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),tY=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm1-13a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm-1 2.75a.75.75 0 0 1 .75.75v5a.75.75 0 0 1-1.5 0v-5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),tK=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.25 6.5A.75.75 0 0 1 5 5.75h14a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75Zm0 3.5A.75.75 0 0 1 5 9.25h14a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75ZM13 12.75a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5h-6ZM12.25 17a.75.75 0 0 1 .75-.75h6a.75.75 0 0 1 0 1.5h-6a.75.75 0 0 1-.75-.75Zm-6-4a.75.75 0 0 0-1.5 0v3c0 .414.336.75.75.75h2.75v.75a.75.75 0 0 0 1.28.53l1.5-1.5a.75.75 0 0 0 0-1.06l-1.5-1.5a.75.75 0 0 0-1.28.53v.75h-2V13Z",clipRule:"evenodd"})}),tX=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.333 4A2.833 2.833 0 0 0 3.5 6.833v2.06a2.833 2.833 0 0 0 2.833 2.834h2.06a2.833 2.833 0 0 0 2.834-2.833v-2.06A2.833 2.833 0 0 0 8.394 4h-2.06ZM5.045 6.833c0-.71.577-1.288 1.288-1.288h2.06c.712 0 1.289.577 1.289 1.288v2.06c0 .712-.577 1.289-1.288 1.289h-2.06a1.288 1.288 0 0 1-1.289-1.288v-2.06Zm1.288 6.44A2.833 2.833 0 0 0 3.5 16.106v2.06A2.833 2.833 0 0 0 6.333 21h2.06a2.833 2.833 0 0 0 2.834-2.833v-2.06a2.833 2.833 0 0 0-2.833-2.834h-2.06Zm-1.288 2.833c0-.711.577-1.288 1.288-1.288h2.06c.712 0 1.289.577 1.289 1.288v2.06c0 .712-.577 1.288-1.288 1.288h-2.06a1.288 1.288 0 0 1-1.289-1.287v-2.06Zm7.728-9.273A2.833 2.833 0 0 1 15.606 4h2.06A2.833 2.833 0 0 1 20.5 6.833v2.06a2.833 2.833 0 0 1-2.833 2.834h-2.06a2.833 2.833 0 0 1-2.834-2.833v-2.06Zm2.833-1.288c-.711 0-1.288.577-1.288 1.288v2.06c0 .712.577 1.289 1.288 1.289h2.06c.712 0 1.288-.577 1.288-1.288v-2.06c0-.712-.576-1.289-1.287-1.289h-2.06Zm1.803 8.5a.773.773 0 1 0-1.545 0v2.319h-2.319a.773.773 0 0 0 0 1.545h2.319v2.318a.773.773 0 0 0 1.545 0V17.91h2.318a.773.773 0 0 0 0-1.545H17.41v-2.319Z",clipRule:"evenodd"})}),tQ=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14 3.75a1.75 1.75 0 0 0-1.75 1.75v13c0 .966.784 1.75 1.75 1.75h4a1.75 1.75 0 0 0 1.75-1.75v-13A1.75 1.75 0 0 0 18 3.75h-4Zm-.25 1.75a.25.25 0 0 1 .25-.25h4a.25.25 0 0 1 .25.25v13a.25.25 0 0 1-.25.25h-4a.25.25 0 0 1-.25-.25v-13Zm-5.5 4a.75.75 0 0 0-1.5 0v1.75H5a.75.75 0 0 0 0 1.5h1.75v1.75a.75.75 0 0 0 1.5 0v-1.75H10a.75.75 0 0 0 0-1.5H8.25V9.5Z",clipRule:"evenodd"})}),tJ=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 3.75A1.75 1.75 0 0 0 4.25 5.5v13c0 .966.784 1.75 1.75 1.75h4a1.75 1.75 0 0 0 1.75-1.75v-13A1.75 1.75 0 0 0 10 3.75H6ZM5.75 5.5A.25.25 0 0 1 6 5.25h4a.25.25 0 0 1 .25.25v13a.25.25 0 0 1-.25.25H6a.25.25 0 0 1-.25-.25v-13Zm11.5 4a.75.75 0 0 0-1.5 0v1.75H14a.75.75 0 0 0 0 1.5h1.75v1.75a.75.75 0 0 0 1.5 0v-1.75H19a.75.75 0 0 0 0-1.5h-1.75V9.5Z",clipRule:"evenodd"})}),t1=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.25 11a.75.75 0 0 1-1.5 0V8a.75.75 0 0 1 .75-.75h2.75V6.5a.75.75 0 0 1 1.28-.53l1.5 1.5a.75.75 0 0 1 0 1.06l-1.5 1.5a.75.75 0 0 1-1.28-.53v-.75h-2V11Zm6-4a.75.75 0 0 1 .75-.75h6a.75.75 0 0 1 0 1.5h-6a.75.75 0 0 1-.75-.75Zm0 3.5a.75.75 0 0 1 .75-.75h6a.75.75 0 0 1 0 1.5h-6a.75.75 0 0 1-.75-.75ZM5 13.25a.75.75 0 0 0 0 1.5h14a.75.75 0 0 0 0-1.5H5Zm-.75 4.25a.75.75 0 0 1 .75-.75h14a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"})}),t0=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"url(#a)",d:"M16.648 3.25H7.352A4.102 4.102 0 0 0 3.25 7.352v9.296a4.102 4.102 0 0 0 4.102 4.102h9.296a4.102 4.102 0 0 0 4.102-4.102V7.352a4.102 4.102 0 0 0-4.102-4.102Z"}),(0,s.jsx)("path",{fill:"url(#b)",d:"M16.648 3.25H7.352A4.102 4.102 0 0 0 3.25 7.352v9.296a4.102 4.102 0 0 0 4.102 4.102h9.296a4.102 4.102 0 0 0 4.102-4.102V7.352a4.102 4.102 0 0 0-4.102-4.102Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M11.837 5c-1.857 0-2.09.008-2.82.041-.727.034-1.224.149-1.658.318-.45.174-.831.408-1.211.788-.38.38-.614.762-.79 1.211-.169.435-.284.932-.317 1.66C5.01 9.745 5 9.978 5 11.835c0 1.857.008 2.089.041 2.818.034.728.149 1.225.318 1.66.175.449.408.83.788 1.21.38.38.762.614 1.21.79.436.168.933.283 1.66.317.73.033.962.041 2.819.041 1.856 0 2.089-.008 2.818-.041.728-.034 1.225-.149 1.66-.318.45-.174.83-.409 1.21-.789.38-.38.614-.761.789-1.21.168-.435.283-.932.318-1.66.032-.729.04-.961.04-2.818 0-1.857-.008-2.09-.04-2.819-.035-.727-.15-1.224-.318-1.659a3.355 3.355 0 0 0-.789-1.21 3.34 3.34 0 0 0-1.21-.789c-.436-.17-.933-.284-1.661-.318-.73-.033-.961-.041-2.819-.041h.003Zm-.614 1.232h.614c1.825 0 2.041.006 2.762.04.666.03 1.028.141 1.27.235.318.124.546.272.785.511.239.24.387.467.511.786.094.24.205.602.236 1.269.032.72.04.937.04 2.761 0 1.825-.008 2.041-.04 2.762-.03.666-.142 1.028-.236 1.269-.124.319-.272.546-.511.785-.24.24-.467.388-.786.511-.24.094-.603.205-1.27.236-.72.033-.936.04-2.761.04-1.826 0-2.042-.007-2.763-.04-.666-.03-1.028-.142-1.27-.236a2.118 2.118 0 0 1-.785-.511 2.118 2.118 0 0 1-.512-.786c-.093-.24-.205-.602-.235-1.269-.033-.72-.04-.937-.04-2.762 0-1.826.007-2.041.04-2.762.03-.666.142-1.028.235-1.269.124-.319.272-.547.512-.786.239-.24.467-.387.786-.512.24-.094.603-.205 1.27-.235.63-.029.874-.037 2.148-.039v.002Zm4.263 1.135a.82.82 0 1 0 0 1.64.82.82 0 0 0 0-1.64Zm-3.65.958a3.51 3.51 0 1 0 .001 7.022 3.51 3.51 0 0 0 0-7.022Zm0 1.232a2.279 2.279 0 1 1 0 4.557 2.279 2.279 0 0 1 0-4.557Z"}),(0,s.jsxs)("defs",{children:[(0,s.jsxs)("radialGradient",{id:"a",cx:0,cy:0,r:1,gradientTransform:"matrix(0 -17.3438 16.1311 0 7.898 22.098)",gradientUnits:"userSpaceOnUse",children:[(0,s.jsx)("stop",{stopColor:"#FD5"}),(0,s.jsx)("stop",{offset:.1,stopColor:"#FD5"}),(0,s.jsx)("stop",{offset:.5,stopColor:"#FF543E"}),(0,s.jsx)("stop",{offset:1,stopColor:"#C837AB"})]}),(0,s.jsxs)("radialGradient",{id:"b",cx:0,cy:0,r:1,gradientTransform:"rotate(78.681 -2.592 2.45) scale(7.75277 31.9572)",gradientUnits:"userSpaceOnUse",children:[(0,s.jsx)("stop",{stopColor:"#3771C8"}),(0,s.jsx)("stop",{offset:.128,stopColor:"#3771C8"}),(0,s.jsx)("stop",{offset:1,stopColor:"#60F",stopOpacity:0})]})]})]}),t2=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11 4.75a4.25 4.25 0 0 0-4.147 5.183.75.75 0 0 1-.568.896 3.252 3.252 0 0 0-1.435 5.609.75.75 0 1 1-.992 1.124 4.751 4.751 0 0 1 1.42-7.99A5.75 5.75 0 0 1 16.485 7.27a5.75 5.75 0 0 1 2.966 10.33.75.75 0 1 1-.901-1.2 4.25 4.25 0 0 0-2.635-7.65.75.75 0 0 1-.75-.6A4.252 4.252 0 0 0 11 4.75Zm-1.29 8.311a2.978 2.978 0 0 1 5.161 1.17.75.75 0 1 0 1.453-.373 4.478 4.478 0 0 0-8.036-1.4l-.57-.242a.3.3 0 0 0-.411.338l.474 2.283a.3.3 0 0 0 .454.192l1.971-1.246a.3.3 0 0 0-.043-.53l-.452-.192Zm2.063 5.327a2.97 2.97 0 0 0 2.278-1.062l-.453-.191a.3.3 0 0 1-.043-.53l1.971-1.247a.3.3 0 0 1 .454.193l.475 2.283a.3.3 0 0 1-.41.337l-.571-.241a4.472 4.472 0 0 1-3.701 1.958 4.473 4.473 0 0 1-4.336-3.358.75.75 0 1 1 1.453-.374 2.973 2.973 0 0 0 2.883 2.232Z",clipRule:"evenodd"})}),t5=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.6 7.55a.75.75 0 1 0-1.2.9 10.805 10.805 0 0 0 2.939 2.69l-1.963 2.944a.75.75 0 0 0 1.248.832l2-3a.755.755 0 0 0 .044-.075c1.108.489 2.315.796 3.582.883V17.5a.75.75 0 1 0 1.5 0v-4.776a10.69 10.69 0 0 0 3.582-.883c.013.026.028.05.044.075l2 3a.75.75 0 0 0 1.248-.832l-1.962-2.944A10.807 10.807 0 0 0 20.6 8.45a.75.75 0 0 0-1.2-.9 9.235 9.235 0 0 1-7.4 3.7 9.235 9.235 0 0 1-7.402-3.7Z",clipRule:"evenodd"})}),t7=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.75a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5ZM2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",d:"M14 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"})]}),t3=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.607 3.25H10.25a.75.75 0 0 0 0 1.5h3.34l-4.758 14.5H5a.75.75 0 1 0 0 1.5h8.75a.75.75 0 0 0 0-1.5h-3.34l4.758-14.5H19a.75.75 0 0 0 0-1.5H14.608Z",clipRule:"evenodd"})}),t4=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M16.25 4.5H18a.5.5 0 0 1 .5.5v14a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V5a.5.5 0 0 1 .5-.5h4.25V11a.75.75 0 0 0 1.166.624l1.834-1.223 1.834 1.223A.75.75 0 0 0 16.25 11V4.5ZM4 5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V5Zm7.75 4.599V4.75h3v4.849l-1.084-.723a.75.75 0 0 0-.832 0l-1.084.723Z",clipRule:"evenodd"})}),t6=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.997 8.92a1 1 0 1 0-1.993.16 1 1 0 0 0 1.993-.16Zm8.508 3.16a1 1 0 1 0 1.993-.16 1 1 0 0 0-1.993.16Zm-1.001-.16a1 1 0 1 0-1.993.16 1 1 0 0 0 1.993-.16ZM7.999 9.08a1 1 0 1 0 1.993-.16 1 1 0 0 0-1.993.16ZM2.25 7A2.75 2.75 0 0 1 5 4.25h14A2.75 2.75 0 0 1 21.75 7v10A2.75 2.75 0 0 1 19 19.75H5A2.75 2.75 0 0 1 2.25 17V7ZM5 5.75c-.69 0-1.25.56-1.25 1.25v10c0 .69.56 1.25 1.25 1.25h14c.69 0 1.25-.56 1.25-1.25V7c0-.69-.56-1.25-1.25-1.25H5Zm1 9.5a.75.75 0 0 1 .75-.75h10.5a.75.75 0 0 1 0 1.5H6.75a.75.75 0 0 1-.75-.75Zm5.213-3.958A1 1 0 1 0 9.8 12.708a1 1 0 0 0 1.414-1.416Zm-3 0a1 1 0 1 0-1.415 1.415 1 1 0 0 0 1.415-1.415Zm4.49-3a1 1 0 1 0-1.414 1.416 1 1 0 0 0 1.415-1.415Zm3.001 0a1 1 0 1 0-1.414 1.415 1 1 0 0 0 1.414-1.414Zm3.001 0a1 1 0 1 0-1.415 1.416 1 1 0 0 0 1.415-1.415Z",clipRule:"evenodd"})}),t8=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M9 2.25a.75.75 0 0 1 .75.75v1.25H15a.75.75 0 1 1 0 1.5h-1.625a18.668 18.668 0 0 1-3.511 7.68c.341.356.704.684 1.086.97a.75.75 0 1 1-.9 1.2c-.405-.304-.79-.645-1.153-1.012A18.813 18.813 0 0 1 3.334 18.8a.75.75 0 0 1-.668-1.344 17.313 17.313 0 0 0 5.238-4.01c-1.05-1.36-1.819-2.9-2.212-4.235a.75.75 0 0 1 1.44-.424c.318 1.085.93 2.332 1.747 3.458A17.168 17.168 0 0 0 11.84 5.75H3.5a.75.75 0 0 1 0-1.5h4.75V3A.75.75 0 0 1 9 2.25Zm7 8a.75.75 0 0 1 .67.415l3.494 6.986a.73.73 0 0 1 .014.028l1.493 2.986a.75.75 0 0 1-1.342.67l-1.293-2.585h-6.072l-1.293 2.585a.75.75 0 0 1-1.342-.67l1.493-2.986a.609.609 0 0 1 .014-.028l3.493-6.986A.75.75 0 0 1 16 10.25Zm-2.286 7h4.572L16 12.677l-2.286 4.573Z",clipRule:"evenodd"})}),t9=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.754 3.802a.75.75 0 0 1 .631-.01l7.92 3.523a.75.75 0 0 1 .021 1.36l-8.08 3.904a.75.75 0 0 1-.631.01l-7.92-3.522a.75.75 0 0 1-.021-1.36l8.08-3.905Zm.34 1.502-6.312 3.05 6.124 2.723 6.312-3.049-6.124-2.724Zm8.581 6.56a.75.75 0 0 1-.349 1.002l-8.08 3.904a.75.75 0 0 1-.631.01l-7.92-3.523a.75.75 0 0 1 .61-1.37l7.601 3.38 7.768-3.752a.75.75 0 0 1 1.001.35Zm0 4.31a.75.75 0 0 1-.349 1.001l-8.08 3.904a.75.75 0 0 1-.631.01l-7.92-3.522a.75.75 0 0 1 .61-1.371l7.601 3.381 7.768-3.752a.75.75 0 0 1 1.001.349Z",clipRule:"evenodd"})}),ie=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 5.74a2.49 2.49 0 0 1 2.49-2.49h3.52a2.49 2.49 0 0 1 2.49 2.49v12.52a2.49 2.49 0 0 1-2.49 2.49H5.74a2.49 2.49 0 0 1-2.49-2.49V5.74Zm2.49-.99a.99.99 0 0 0-.99.99v12.52c0 .547.443.99.99.99h3.52a.99.99 0 0 0 .99-.99V5.74a.99.99 0 0 0-.99-.99H5.74Zm7.51.99a2.49 2.49 0 0 1 2.49-2.49h2.52a2.49 2.49 0 0 1 2.49 2.49v3.52a2.49 2.49 0 0 1-2.49 2.49h-2.52a2.49 2.49 0 0 1-2.49-2.49V5.74Zm2.49-.99a.99.99 0 0 0-.99.99v3.52c0 .547.443.99.99.99h2.52a.99.99 0 0 0 .99-.99V5.74a.99.99 0 0 0-.99-.99h-2.52Zm0 8.5a2.49 2.49 0 0 0-2.49 2.49v2.52a2.49 2.49 0 0 0 2.49 2.49h2.52a2.49 2.49 0 0 0 2.49-2.49v-2.52a2.49 2.49 0 0 0-2.49-2.49h-2.52Zm-.99 2.49a.99.99 0 0 1 .99-.99h2.52a.99.99 0 0 1 .99.99v2.52a.99.99 0 0 1-.99.99h-2.52a.99.99 0 0 1-.99-.99v-2.52Z",clipRule:"evenodd"})}),it=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M9.371 17.75H17a.75.75 0 0 0 0-1.5H9.4c-.432 0-.712 0-.924-.018-.204-.017-.28-.045-.316-.064a.75.75 0 0 1-.328-.327c-.02-.038-.047-.113-.064-.317a12.747 12.747 0 0 1-.018-.924V7a.75.75 0 1 0-1.5 0v7.629c0 .395 0 .736.023 1.017.024.297.078.592.222.875.216.424.56.768.984.984.283.144.578.198.875.222.28.023.622.023 1.017.023Z",clipRule:"evenodd"})}),ii=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.75 2.698a.75.75 0 0 0-1.5 0V3.73a.75.75 0 1 0 1.5 0V2.698ZM5.812 4.75a.75.75 0 0 0-1.06 1.061l.84.842a.75.75 0 0 0 1.061-1.061l-.841-.842Zm13.437 1.061a.75.75 0 1 0-1.061-1.06l-.841.84a.75.75 0 1 0 1.06 1.062l.842-.842ZM2.698 11.25a.75.75 0 0 0 0 1.5H3.73a.75.75 0 0 0 0-1.5H2.698Zm17.57 0a.75.75 0 0 0 0 1.5h1.034a.75.75 0 0 0 0-1.5H20.27ZM6.653 18.413a.75.75 0 0 0-1.058-1.063l-.841.837A.75.75 0 0 0 5.81 19.25l.841-.837Zm11.754-1.063a.75.75 0 0 0-1.058 1.063l.841.837a.75.75 0 1 0 1.058-1.063l-.841-.837Zm-5.656 2.919a.75.75 0 0 0-1.5 0v1.033a.75.75 0 1 0 1.5 0V20.27ZM16.081 12a4.081 4.081 0 1 1-8.162 0 4.081 4.081 0 0 1 8.162 0Zm1.5 0A5.581 5.581 0 1 1 6.42 12a5.581 5.581 0 0 1 11.162 0Z",clipRule:"evenodd"})}),is=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.65 5a.75.75 0 0 1 .75-.75h3a.75.75 0 0 1 0 1.5h-3A.75.75 0 0 1 3.65 5Zm6.1 0a.75.75 0 0 1 .75-.75h3a.75.75 0 0 1 0 1.5h-3A.75.75 0 0 1 9.75 5Zm7.05-.75a.75.75 0 0 0 0 1.5h3a.75.75 0 0 0 0-1.5h-3ZM3.245 12c0-.47.38-.85.85-.85h15.79a.85.85 0 0 1 0 1.7H4.094a.85.85 0 0 1-.85-.85ZM4.5 17.75a1.25 1.25 0 1 0 0 2.5h15a1.25 1.25 0 0 0 0-2.5h-15Z",clipRule:"evenodd"})}),io=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsxs)("g",{clipPath:"url(#a)",children:[(0,s.jsx)("path",{fill:"url(#b)",d:"M24 12c0-6.627-5.373-12-12-12S0 5.373 0 12s5.373 12 12 12 12-5.373 12-12Z"}),(0,s.jsxs)("g",{filter:"url(#c)",children:[(0,s.jsx)("path",{fill:"url(#d)",d:"M6.147 13.383c-.027-.114.109-.186.192-.103l4.381 4.381c.083.083.011.219-.103.192a6.015 6.015 0 0 1-4.47-4.47Z"}),(0,s.jsx)("path",{fill:"url(#e)",d:"M6 11.627a.119.119 0 0 0 .035.091l6.247 6.247a.119.119 0 0 0 .091.035c.285-.018.564-.055.836-.111a.117.117 0 0 0 .057-.198L6.31 10.734a.117.117 0 0 0-.198.057 6.01 6.01 0 0 0-.11.836Z"}),(0,s.jsx)("path",{fill:"url(#f)",d:"M6.505 9.565a.119.119 0 0 0 .025.132l7.773 7.773a.118.118 0 0 0 .132.025c.215-.096.422-.203.623-.322a.118.118 0 0 0 .022-.185L7.012 8.92a.118.118 0 0 0-.185.022c-.119.2-.226.408-.322.623Z"}),(0,s.jsx)("path",{fill:"url(#g)",d:"M7.519 8.169a.118.118 0 0 1-.005-.163 6.006 6.006 0 1 1 8.48 8.48.118.118 0 0 1-.163-.005L7.52 8.169Z"})]})]}),(0,s.jsxs)("defs",{children:[(0,s.jsxs)("filter",{id:"c",width:154.574,height:154.574,x:-65.287,y:-54.148,colorInterpolationFilters:"sRGB",filterUnits:"userSpaceOnUse",children:[(0,s.jsx)("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),(0,s.jsx)("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),(0,s.jsx)("feOffset",{dy:11.139}),(0,s.jsx)("feGaussianBlur",{stdDeviation:35.644}),(0,s.jsx)("feColorMatrix",{values:"0 0 0 0 0.118924 0 0 0 0 0.158031 0 0 0 0 0.570833 0 0 0 0.7 0"}),(0,s.jsx)("feBlend",{in2:"BackgroundImageFix",result:"effect1_dropShadow_13632_16479"}),(0,s.jsx)("feColorMatrix",{in:"SourceAlpha",result:"hardAlpha",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"}),(0,s.jsx)("feOffset",{dy:3.899}),(0,s.jsx)("feGaussianBlur",{stdDeviation:15}),(0,s.jsx)("feColorMatrix",{values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.17 0"}),(0,s.jsx)("feBlend",{in2:"effect1_dropShadow_13632_16479",result:"effect2_dropShadow_13632_16479"}),(0,s.jsx)("feBlend",{in:"SourceGraphic",in2:"effect2_dropShadow_13632_16479",result:"shape"})]}),(0,s.jsxs)("linearGradient",{id:"b",x1:12,x2:12,y1:0,y2:24,gradientUnits:"userSpaceOnUse",children:[(0,s.jsx)("stop",{stopColor:"#5C6BF1"}),(0,s.jsx)("stop",{offset:1,stopColor:"#283188"})]}),(0,s.jsxs)("linearGradient",{id:"d",x1:6.429,x2:12.686,y1:7.114,y2:16.286,gradientUnits:"userSpaceOnUse",children:[(0,s.jsx)("stop",{stopColor:"#fff"}),(0,s.jsx)("stop",{offset:1,stopColor:"#fff",stopOpacity:.65})]}),(0,s.jsxs)("linearGradient",{id:"e",x1:6.429,x2:12.686,y1:7.114,y2:16.286,gradientUnits:"userSpaceOnUse",children:[(0,s.jsx)("stop",{stopColor:"#fff"}),(0,s.jsx)("stop",{offset:1,stopColor:"#fff",stopOpacity:.65})]}),(0,s.jsxs)("linearGradient",{id:"f",x1:6.429,x2:12.686,y1:7.114,y2:16.286,gradientUnits:"userSpaceOnUse",children:[(0,s.jsx)("stop",{stopColor:"#fff"}),(0,s.jsx)("stop",{offset:1,stopColor:"#fff",stopOpacity:.65})]}),(0,s.jsxs)("linearGradient",{id:"g",x1:6.429,x2:12.686,y1:7.114,y2:16.286,gradientUnits:"userSpaceOnUse",children:[(0,s.jsx)("stop",{stopColor:"#fff"}),(0,s.jsx)("stop",{offset:1,stopColor:"#fff",stopOpacity:.65})]}),(0,s.jsx)("clipPath",{id:"a",children:(0,s.jsx)("path",{fill:"currentColor",d:"M0 0H24V24H0z"})})]})]}),ir=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M18.428 5.572a2.806 2.806 0 0 0-3.967 0l-.978.977a.75.75 0 0 1-1.06-1.06l.977-.978a4.305 4.305 0 1 1 6.089 6.089l-3.556 3.556a4.306 4.306 0 0 1-6.089 0 .75.75 0 0 1 1.061-1.061 2.805 2.805 0 0 0 3.968 0l3.555-3.556a2.806 2.806 0 0 0 0-3.967Zm-5.333 5.333a2.805 2.805 0 0 0-3.968 0l-3.555 3.556a2.806 2.806 0 0 0 3.967 3.967l.98-.979a.75.75 0 0 1 1.06 1.06l-.979.98A4.305 4.305 0 1 1 4.511 13.4l3.556-3.556a4.306 4.306 0 0 1 6.089 0 .75.75 0 0 1-1.061 1.061Z",clipRule:"evenodd"})}),ia=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.5 4.75a1.75 1.75 0 1 0 0 3.5 1.75 1.75 0 0 0 0-3.5ZM3.25 6.5a3.25 3.25 0 0 1 6.49-.25c.794.001 1.56.016 2.357.208.897.217 1.79.645 2.853 1.442l.02.015.02.017c.864.745 1.475 1.75 1.841 2.826a.75.75 0 0 1-1.42.484c-.294-.865-.766-1.62-1.382-2.158-.928-.692-1.633-1.01-2.284-1.167-.675-.163-1.334-.167-2.244-.167A3.257 3.257 0 0 1 7.25 9.663v3.674a3.251 3.251 0 1 1-1.5 0V9.663A3.251 3.251 0 0 1 3.25 6.5Zm3.25 8.25a1.75 1.75 0 1 0 0 3.5 1.75 1.75 0 0 0 0-3.5Zm8-1.5a.75.75 0 0 0 0 1.5h2.69l-3.72 3.72a.75.75 0 1 0 1.06 1.06l3.72-3.72v2.69a.75.75 0 0 0 1.5 0V14a.75.75 0 0 0-.75-.75h-4.5Z",clipRule:"evenodd"})}),il=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.25 6A2.75 2.75 0 0 1 7 3.25h10A2.75 2.75 0 0 1 19.75 6v6a.75.75 0 0 1-1.5 0V6c0-.69-.56-1.25-1.25-1.25H7c-.69 0-1.25.56-1.25 1.25v12c0 .69.56 1.25 1.25 1.25h5a.75.75 0 0 1 0 1.5H7A2.75 2.75 0 0 1 4.25 18V6Zm4 2A.75.75 0 0 1 9 7.25h3a.75.75 0 0 1 0 1.5H9A.75.75 0 0 1 8.25 8ZM9 10.75a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5H9ZM8.25 15a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5H9a.75.75 0 0 1-.75-.75Zm7.25-.75a.75.75 0 0 0 0 1.5h2.69l-3.72 3.72a.75.75 0 1 0 1.06 1.06l3.72-3.72v2.69a.75.75 0 0 0 1.5 0V15a.75.75 0 0 0-.75-.75h-4.5Z",clipRule:"evenodd"})}),ic=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.75 6.5c0-.69.56-1.25 1.25-1.25h4.672c.331 0 .649.132.883.366L11.97 7.03c.14.141.331.22.53.22H19c.69 0 1.25.56 1.25 1.25V17c0 .69-.56 1.25-1.25 1.25H5c-.69 0-1.25-.56-1.25-1.25V6.5ZM5 3.75A2.75 2.75 0 0 0 2.25 6.5V17A2.75 2.75 0 0 0 5 19.75h14A2.75 2.75 0 0 0 21.75 17V8.5A2.75 2.75 0 0 0 19 5.75h-6.19l-1.194-1.195a2.75 2.75 0 0 0-1.944-.805H5Zm10.48 10.026-3 2.5a.75.75 0 0 1-.96 0l-3-2.5a.75.75 0 1 1 .96-1.152l1.77 1.475v-4.4a.75.75 0 0 1 1.5 0v4.4l1.77-1.475a.75.75 0 1 1 .96 1.152Z",clipRule:"evenodd"})}),id=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.75 5.389A2.639 2.639 0 0 1 5.389 2.75H18.61a2.639 2.639 0 0 1 2.639 2.639v9.444a2.639 2.639 0 0 1-2.639 2.64h-3.525l.425 1.7.797.797a.75.75 0 0 1-.53 1.28H8.222a.75.75 0 0 1-.53-1.28l.797-.798.425-1.7H5.39a2.639 2.639 0 0 1-2.639-2.639V5.39Zm1.5 8.305v1.14c0 .628.51 1.138 1.139 1.138H18.612c.628 0 1.138-.51 1.138-1.139v-1.139H4.25Zm15.5-1.5H4.25V5.39c0-.63.51-1.139 1.139-1.139H18.61c.63 0 1.139.51 1.139 1.139v6.805Zm-6.21 5.278h-3.08l-.566 2.265a1.064 1.064 0 0 1-.003.013h4.218a2.183 2.183 0 0 0-.003-.012l-.567-2.266Z",clipRule:"evenodd"})}),ih=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 2.25a.75.75 0 0 1 .75.75v1.286a7.752 7.752 0 0 1 6.964 6.964H21a.75.75 0 0 1 0 1.5h-1.286a7.752 7.752 0 0 1-6.964 6.964V21a.75.75 0 0 1-1.5 0v-1.286a7.752 7.752 0 0 1-6.964-6.964H3a.75.75 0 0 1 0-1.5h1.286a7.752 7.752 0 0 1 6.964-6.964V3a.75.75 0 0 1 .75-.75Zm-.75 3.545a6.253 6.253 0 0 0-5.455 5.455H7a.75.75 0 0 1 0 1.5H5.795a6.253 6.253 0 0 0 5.455 5.456V17a.75.75 0 0 1 1.5 0v1.206a6.253 6.253 0 0 0 5.456-5.456H17a.75.75 0 0 1 0-1.5h1.206a6.253 6.253 0 0 0-5.456-5.455V7a.75.75 0 0 1-1.5 0V5.795Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",d:"M14 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"})]}),iu=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.25 8a5.75 5.75 0 1 1 11.5 0v1.356c.34.058.655.151.953.303a3.75 3.75 0 0 1 1.638 1.638c.227.445.321.925.366 1.471.043.531.043 1.187.043 2v1.464c0 .813 0 1.469-.043 2-.045.546-.14 1.026-.366 1.47a3.75 3.75 0 0 1-1.639 1.64c-.444.226-.924.32-1.47.365-.531.043-1.187.043-2 .043H8.768c-.813 0-1.469 0-2-.043-.546-.045-1.026-.14-1.47-.366a3.75 3.75 0 0 1-1.64-1.639c-.226-.444-.32-.924-.365-1.47-.043-.531-.043-1.187-.043-2v-1.464c0-.813 0-1.469.043-2 .045-.546.14-1.026.366-1.47a3.75 3.75 0 0 1 1.639-1.64c.297-.15.612-.244.952-.302V8Zm1.5 1.254c.31-.004.652-.004 1.027-.004h6.446c.375 0 .717 0 1.027.004V8a4.25 4.25 0 0 0-8.5 0v1.254ZM8.8 10.75c-.756 0-1.31 0-1.754.027-.551.034-.847.106-1.067.218a2.25 2.25 0 0 0-.984.984c-.1.197-.17.458-.207.912-.037.462-.038 1.056-.038 1.909v1.4c0 .852 0 1.447.038 1.91.037.453.107.714.207.912.216.423.56.767.984.983.197.1.458.17.912.207.462.037 1.057.038 1.909.038h6.4c.852 0 1.447 0 1.91-.038.453-.038.714-.107.912-.207.423-.216.767-.56.983-.983.1-.198.17-.459.207-.913.037-.462.038-1.057.038-1.909v-1.4c0-.853 0-1.447-.038-1.91-.038-.453-.107-.714-.207-.912a2.252 2.252 0 0 0-.983-.983c-.22-.112-.517-.184-1.068-.218a31.52 31.52 0 0 0-1.754-.027H8.8Zm3.2 3a.75.75 0 0 1 .75.75v2a.75.75 0 0 1-1.5 0v-2a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),ip=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"m21.602 18.535-1.456-2.523-.497-.86-.846-1.466c-1.49-2.574-4.421-7.67-5.886-10.189-.451-.702-1.497-.647-1.885.08L9.594 6.069l-.496.859-6.409 11.1c-.09.165-.26.434-.345.611-.148.321-.119.72.068 1.017.21.351.605.543 1.007.524h3.832c4.618 0 11.672.003 13.403 0 .84.001 1.368-.92.95-1.645h-.002Zm-9.94-3.273-.85-1.472a.388.388 0 0 1 .337-.583h1.7c.299 0 .485.324.335.583l-.85 1.472a.388.388 0 0 1-.672 0Zm-1.424-2.742a5.231 5.231 0 0 1-.18-.546l2.811.546h-2.63Zm1.285 3.873c-.12.151-.248.295-.383.431l-.933-2.708 1.315 2.277Zm2.712-3.048c.19.028.38.067.564.116l-1.88 2.162 1.316-2.278Zm-4.35-2.294a7.298 7.298 0 0 1-.043-.827l3.714 1.811-3.672-.983v-.001Zm-.441 2.712.983 3.67a7.25 7.25 0 0 1-.696.45l-.288-4.12Zm6.24.01c.253.11.499.238.738.377l-3.425 2.311 2.688-2.688ZM9.928 9.055a11.9 11.9 0 0 1 .3-1.474l5.642 4.905-5.941-3.43Zm-1.25 9.34c-.47.193-.95.35-1.426.477l1.426-7.337v6.86Zm8.715-3.587c.4.31.778.65 1.126.997l-7.068 2.433 5.942-3.43Zm-5.147-9.984c1.04 1.805 2.55 4.422 3.99 6.913l-5.372-5.371.89-1.543c.11-.19.383-.19.492 0Zm-8.39 13.678c.297-.51.703-1.21.793-1.372l3.2-5.542-1.966 7.34h-1.78a.284.284 0 0 1-.246-.425Zm16.042.428h-7.986l7.341-1.968.89 1.542a.283.283 0 0 1-.244.426h-.001Z"})}),ig=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M3.462 20.18c-.427 0-.824-.22-1.036-.573a1.192 1.192 0 0 1-.073-1.108c.057-.118.147-.272.227-.407a90291.139 90291.139 0 0 0 8.365-14.466A1.195 1.195 0 0 1 12.003 3c.407 0 .78.203.998.542.88 1.508 2.255 3.89 3.586 6.194l2.235 3.866 1.483 2.564 1.284 2.221c.215.37.215.817-.002 1.193a1.18 1.18 0 0 1-1.03.598H3.515a.8.8 0 0 1-.054.002Zm14.477-1.458h1.868c.06 0 .116-.031.146-.084a.167.167 0 0 0 0-.168l-1.566-2.705c-1.115-1.243-2.296-2.08-3.512-2.493a1.44 1.44 0 0 1-.194.692l-1.418 2.452a1.437 1.437 0 0 1-.2.267c-.056.083-.176.26-.19.284l-.005.01-.007.008c-.334.41-.702.763-1.122 1.083-.311.236-.65.455-1.01.653l7.21.001ZM4.83 17.114c-.072.129-.344.598-.607 1.051l-.176.304a.167.167 0 0 0 0 .168c.03.052.084.084.146.084H7.32c1.636-.342 2.953-.945 3.918-1.79a1.443 1.443 0 0 1-.503-.514l-1.418-2.452a1.475 1.475 0 0 1-.132-.305c-.044-.09-.138-.282-.152-.306l-.006-.01-.003-.01a6.535 6.535 0 0 1-.378-1.512c-.05-.387-.07-.79-.062-1.2L4.83 17.114Zm6.975-1.314a.222.222 0 0 0 .355.043l.068-.102 1.383-2.392a.224.224 0 0 0-.14-.329 2.265 2.265 0 0 1-.123-.009v.001h-2.766a.224.224 0 0 0-.215.286c.025.049.043.084.054.11l1.384 2.392Zm2.306-3.958a6.55 6.55 0 0 1 1.5.43c.36.15.719.333 1.07.545-1.429-2.47-3.296-5.7-4.536-7.848A.166.166 0 0 0 12 4.885a.165.165 0 0 0-.145.084l-1.563 2.703c-.521 1.587-.658 3.028-.407 4.286a1.45 1.45 0 0 1 .698-.178h2.835c.109 0 .22.013.33.039.115.008.313.022.342.022h.013l.009.001Z"})}),im=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsxs)("g",{clipPath:"url(#a)",children:[(0,s.jsx)("path",{fill:"currentColor",d:"M0 5a5 5 0 0 1 5-5h14a5 5 0 0 1 5 5v14a5 5 0 0 1-5 5H5a5 5 0 0 1-5-5V5Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M4.557 18.977c-.373 0-.719-.191-.904-.499a1.039 1.039 0 0 1-.063-.966c.05-.103.128-.237.198-.355A100846.436 100846.436 0 0 0 11.08 4.546c.18-.336.533-.546.922-.546.354 0 .68.177.87.472.766 1.315 1.966 3.392 3.126 5.4.74 1.282 1.442 2.496 1.949 3.37.303.526.804 1.393 1.293 2.236l1.119 1.936c.187.324.187.713-.002 1.04a1.028 1.028 0 0 1-.899.521l-2.74.002-5.453-.001H6.469a1736.146 1736.146 0 0 0-1.912.001Zm12.62-1.27h1.629c.053 0 .1-.028.127-.074a.145.145 0 0 0 0-.146l-1.364-2.359c-.973-1.083-2.002-1.814-3.063-2.173a1.254 1.254 0 0 1-.17.604l-1.235 2.137c-.048.082-.106.16-.174.232l-.166.248-.004.01-.006.006a5.694 5.694 0 0 1-.978.944 7.225 7.225 0 0 1-.88.57h6.285ZM5.75 16.304c-.062.112-.3.52-.529.916l-.154.265a.145.145 0 0 0 0 .146.145.145 0 0 0 .128.073H7.92c1.426-.298 2.574-.823 3.415-1.56a1.259 1.259 0 0 1-.438-.448L9.662 13.56a1.284 1.284 0 0 1-.115-.267c-.039-.079-.12-.246-.132-.267l-.006-.009-.003-.007a5.697 5.697 0 0 1-.33-1.319 7.137 7.137 0 0 1-.053-1.046l-3.274 5.66Zm6.08-1.146a.194.194 0 0 0 .31.038l.06-.09 1.206-2.085a.196.196 0 0 0-.122-.287 2.018 2.018 0 0 1-.108-.007h-2.411a.196.196 0 0 0-.187.25l.047.096 1.206 2.085Zm2.011-3.45c.456.074.884.196 1.309.374.314.131.626.29.932.475-1.246-2.153-2.874-4.97-3.954-6.841a.145.145 0 0 0-.128-.074c-.053 0-.1.028-.126.074L10.51 8.073c-.454 1.384-.574 2.64-.355 3.737.187-.102.395-.155.609-.155h2.471c.095 0 .192.01.289.033.099.007.272.02.298.02H13.84Z"})]}),(0,s.jsx)("defs",{children:(0,s.jsx)("clipPath",{id:"a",children:(0,s.jsx)("path",{fill:"currentColor",d:"M0 0H24V24H0z"})})})]}),iv=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsxs)("g",{clipPath:"url(#a)",children:[(0,s.jsx)("path",{fill:"currentColor",d:"M0 5a5 5 0 0 1 5-5h14a5 5 0 0 1 5 5v14a5 5 0 0 1-5 5H5a5 5 0 0 1-5-5V5Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"m20.371 17.543-1.27-2.199-.433-.75-.737-1.278c-1.299-2.244-3.855-6.686-5.132-8.883-.393-.612-1.305-.563-1.643.07L9.902 6.676l-.432.748-5.587 9.678c-.08.143-.227.378-.3.532a.953.953 0 0 0 .058.887.965.965 0 0 0 .878.456H7.86c4.026 0 10.175.003 11.684 0a.958.958 0 0 0 .828-1.434h-.001Zm-8.665-2.853-.741-1.284a.339.339 0 0 1 .293-.507h1.482c.26 0 .423.282.293.508l-.741 1.283a.339.339 0 0 1-.587 0Zm-1.242-2.39a4.537 4.537 0 0 1-.158-.477l2.452.477h-2.294Zm1.12 3.376a4.546 4.546 0 0 1-.334.376l-.813-2.361 1.146 1.985Zm2.365-2.658c.166.025.33.06.491.102l-1.638 1.885 1.147-1.987Zm-3.794-2a6.37 6.37 0 0 1-.036-.72l3.237 1.579-3.201-.858Zm-.384 2.365.858 3.2a6.291 6.291 0 0 1-.607.393l-.251-3.593Zm5.441.009c.22.096.434.207.643.329l-2.986 2.014 2.344-2.343Zm-5.019-4.113c.06-.439.151-.87.262-1.285l4.918 4.276-5.18-2.991Zm-1.09 8.143c-.41.167-.829.304-1.243.415l1.243-6.396v5.98Zm7.597-3.128c.35.27.679.566.982.87l-6.161 2.12 5.18-2.99ZM12.214 5.59c.907 1.574 2.223 3.855 3.478 6.027l-4.683-4.683.776-1.345a.248.248 0 0 1 .429 0v.001ZM4.9 17.515c.258-.445.612-1.056.69-1.196l2.791-4.832-1.715 6.4H5.114a.247.247 0 0 1-.214-.372Zm13.985.372h-6.963l6.4-1.715.777 1.345a.247.247 0 0 1-.214.37Z"})]}),(0,s.jsx)("defs",{children:(0,s.jsx)("clipPath",{id:"a",children:(0,s.jsx)("path",{fill:"currentColor",d:"M0 0H24V24H0z"})})})]}),iy=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 5.75a.75.75 0 0 0 0 1.5h14a.75.75 0 0 0 0-1.5H5Zm0 3.5a.75.75 0 0 0 0 1.5h14a.75.75 0 0 0 0-1.5H5Zm-.75 4.25a.75.75 0 0 1 .75-.75h14a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75ZM5 16.25a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5H5Z",clipRule:"evenodd"})}),ib=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M22 10.888h-5.848l5.065-2.924-1.113-1.927L15.04 8.96l2.924-5.065-1.927-1.113-2.924 5.065V2h-2.224v5.848L7.963 2.783 6.036 3.896 8.961 8.96 3.896 6.037 2.783 7.963l5.065 2.924H2v2.225h5.848l-5.065 2.924 1.113 1.927L8.96 15.04l-2.924 5.064 1.927 1.113 2.924-5.065V22h2.225v-5.848l2.923 5.065 1.927-1.113-2.924-5.065 5.065 2.924 1.113-1.927-5.065-2.923H22v-2.225H22Zm-10 4.138a3.037 3.037 0 1 1 0-6.074 3.037 3.037 0 0 1 0 6.074Z"})}),iw=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"m7.192 11.316 10-4.5.616 1.368L9.328 12l8.48 3.816-.616 1.368-10-4.5a.75.75 0 0 1 0-1.368Z",clipRule:"evenodd"})}),ix=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.274 10.907c-.641.776-.047 1.943.958 1.88l3.617-.225 1.944 3.059c.54.85 1.834.644 2.085-.33l.686-2.666 7.406 7.405a.75.75 0 1 0 1.06-1.06l-7.405-7.406 2.666-.687c.975-.25 1.18-1.544.33-2.084l-3.058-1.944.225-3.618c.062-1.004-1.105-1.599-1.88-.958L8.113 4.581 4.743 3.25c-.937-.37-1.862.556-1.493 1.492l1.332 3.37-2.308 2.795Zm4.688.145-3.018.188L5.87 8.909a1.15 1.15 0 0 0 .183-1.155L4.942 4.94l2.812 1.111c.39.154.832.084 1.155-.182l2.332-1.926-.188 3.018a1.15 1.15 0 0 0 .53 1.042l2.553 1.622-2.929.754a1.15 1.15 0 0 0-.826.827l-.755 2.928-1.622-2.552a1.15 1.15 0 0 0-1.042-.53Z",clipRule:"evenodd"})}),i_=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.458 5.95H8.5c-.69 0-1.25.56-1.25 1.25V10c0 .45-.108.875-.3 1.25h3.467a2.5 2.5 0 0 1 2.333-1.6h5.5a2.5 2.5 0 0 1 0 5h-5.5a2.501 2.501 0 0 1-2.428-1.9H6.95c.192.375.3.8.3 1.25v2.809c0 .69.56 1.25 1.25 1.25h1.914a2.501 2.501 0 0 1 2.336-1.609h5.5a2.5 2.5 0 0 1 0 5h-5.5a2.501 2.501 0 0 1-2.425-1.891H8.5a2.75 2.75 0 0 1-2.75-2.75V14c0-.69-.56-1.25-1.25-1.25H2v-1.5h2.512A1.25 1.25 0 0 0 5.75 10V7.2A2.75 2.75 0 0 1 8.5 4.45h1.8a2.5 2.5 0 0 1 2.45-2h5.5a2.5 2.5 0 0 1 0 5h-5.5a2.5 2.5 0 0 1-2.292-1.5Zm1.292-1a1 1 0 0 1 1-1h5.5a1 1 0 1 1 0 2h-5.5a1 1 0 0 1-1-1Zm0 7.2a1 1 0 0 1 1-1h5.5a1 1 0 1 1 0 2h-5.5a1 1 0 0 1-1-1Zm1 5.8a1 1 0 1 0 0 2h5.5a1 1 0 1 0 0-2h-5.5Z",clipRule:"evenodd"})}),iC=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.75 4.5c-1.138 0-2.098.76-2.4 1.8H8.764a2.75 2.75 0 0 0-2.75 2.75v1c0 .69-.56 1.25-1.25 1.25H2v1.5h2.765c.69 0 1.25.56 1.25 1.25v1a2.75 2.75 0 0 0 2.75 2.75h1.616a2.501 2.501 0 0 0 2.369 1.7h5.5a2.5 2.5 0 0 0 0-5h-5.5c-1.138 0-2.098.76-2.4 1.8H8.764c-.69 0-1.25-.56-1.25-1.25v-1c0-.788-.332-1.499-.863-2a2.742 2.742 0 0 0 .863-2v-1c0-.69.56-1.25 1.25-1.25h1.616a2.501 2.501 0 0 0 2.369 1.7h5.5a2.5 2.5 0 0 0 0-5h-5.5Zm-1 2.5a1 1 0 0 1 1-1h5.5a1 1 0 1 1 0 2h-5.5a1 1 0 0 1-1-1Zm0 10a1 1 0 0 1 1-1h5.5a1 1 0 1 1 0 2h-5.5a1 1 0 0 1-1-1Z",clipRule:"evenodd"})}),ik=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.5 12c0-.46.373-.833.833-.833h13.334a.833.833 0 0 1 0 1.666H5.333A.833.833 0 0 1 4.5 12Z",clipRule:"evenodd"})}),iS=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.5 12a1.73 1.73 0 1 0 3.462 0A1.73 1.73 0 0 0 4.5 12Zm7.5 1.73a1.73 1.73 0 1 1 0-3.46 1.73 1.73 0 0 1 0 3.46Zm5.77 0a1.73 1.73 0 1 1 0-3.46 1.73 1.73 0 0 1 0 3.46Z",clipRule:"evenodd"})}),iM=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.5 6a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Zm0 6a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0ZM12 19.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z",clipRule:"evenodd"})}),iE=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.75 4a.75.75 0 0 0-1.5 0v16a.75.75 0 0 0 1.5 0V4Zm8.405 4.57a.75.75 0 1 0-.976-1.14l-4.667 4a.75.75 0 0 0 0 1.14l4.667 4a.75.75 0 1 0 .976-1.14l-3.128-2.68H20a.75.75 0 0 0 0-1.5h-9.973l3.128-2.68Z",clipRule:"evenodd"})}),iI=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.75 4a.75.75 0 0 0-1.5 0v16a.75.75 0 0 0 1.5 0V4Zm-9.905 4.57a.75.75 0 1 1 .976-1.14l4.667 4a.75.75 0 0 1 0 1.14l-4.667 4a.75.75 0 1 1-.976-1.14l3.128-2.68H4a.75.75 0 0 1 0-1.5h9.973l-3.128-2.68Z",clipRule:"evenodd"})}),iB=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.25 4A.75.75 0 0 1 5 3.25h14a.75.75 0 0 1 .75.75v16a.75.75 0 0 1-.75.75H5a.75.75 0 0 1-.75-.75v-3a.75.75 0 0 1 1.5 0v2.25h12.5V4.75H5.75V7.5a.75.75 0 0 1-1.5 0V4Zm8 4a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 0 1.5H13a.75.75 0 0 1-.75-.75Zm.75 2.75a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 0-1.5h-2ZM12.25 15a.75.75 0 0 1 .75-.75h1a.75.75 0 0 1 0 1.5h-1a.75.75 0 0 1-.75-.75ZM8.03 8.47a.75.75 0 0 0-1.06 1.06l1.72 1.72H2.5a.75.75 0 0 0 0 1.5h6.19l-1.72 1.72a.75.75 0 1 0 1.06 1.06l3-3a.75.75 0 0 0 0-1.06l-3-3Z",clipRule:"evenodd"})}),i$=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillOpacity:.6,fillRule:"evenodd",d:"M13 5.75c0-.966.784-1.75 1.75-1.75h3c.966 0 1.75.784 1.75 1.75v13a1.75 1.75 0 0 1-1.75 1.75h-3A1.75 1.75 0 0 1 13 18.75V16a.75.75 0 0 1 1.5 0v2.75c0 .138.112.25.25.25h3a.25.25 0 0 0 .25-.25v-13a.25.25 0 0 0-.25-.25h-3a.25.25 0 0 0-.25.25V8.5a.75.75 0 0 1-1.5 0V5.75Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.75 4a.75.75 0 0 1 0 1.5h-1a.25.25 0 0 0-.25.25v13c0 .138.112.25.25.25h1a.75.75 0 0 1 0 1.5h-1A1.75 1.75 0 0 1 4 18.75v-13C4 4.784 4.784 4 5.75 4h1Zm3.243 6.73a.75.75 0 1 0-1.152-.96l-1.667 2a.75.75 0 0 0 0 .96l1.667 2a.75.75 0 0 0 1.152-.96L9.35 13h3.399a.75.75 0 0 0 0-1.5H9.351l.642-.77Z",clipRule:"evenodd"})]}),iT=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillOpacity:.6,fillRule:"evenodd",d:"M10.5 5.75A1.75 1.75 0 0 0 8.75 4h-3A1.75 1.75 0 0 0 4 5.75v13c0 .966.784 1.75 1.75 1.75h3a1.75 1.75 0 0 0 1.75-1.75V16A.75.75 0 0 0 9 16v2.75a.25.25 0 0 1-.25.25h-3a.25.25 0 0 1-.25-.25v-13a.25.25 0 0 1 .25-.25h3a.25.25 0 0 1 .25.25V8.5a.75.75 0 0 0 1.5 0V5.75Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M16.75 4a.75.75 0 0 0 0 1.5h1a.25.25 0 0 1 .25.25v13a.25.25 0 0 1-.25.25h-1a.75.75 0 0 0 0 1.5h1a1.75 1.75 0 0 0 1.75-1.75v-13A1.75 1.75 0 0 0 17.75 4h-1Zm-3.243 6.73a.75.75 0 1 1 1.152-.96l1.667 2a.75.75 0 0 1 0 .96l-1.667 2a.75.75 0 0 1-1.152-.96l.642-.77H10.75a.75.75 0 0 1 0-1.5h3.399l-.642-.77Z",clipRule:"evenodd"})]}),iO=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",d:"M3.03 5.302c-.278-1.606 1.41-2.832 2.851-2.07l13.518 7.14c1.542.815 1.336 3.086-.328 3.609l-5.526 1.736a1.963 1.963 0 0 0-1.01.734L9.17 21.174c-1.012 1.421-3.236.915-3.534-.804L3.03 5.302Z"}),(0,s.jsx)("path",{stroke:"currentColor",strokeOpacity:.2,d:"M3.523 5.217c-.207-1.197 1.05-2.11 2.125-1.543l13.518 7.14c1.149.607.995 2.3-.245 2.69l-5.526 1.736c-.512.16-.957.484-1.268.921l-3.364 4.723c-.754 1.06-2.411.682-2.633-.6L3.523 5.218Z"})]}),iP=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7.53 6.03a.75.75 0 0 0-1.06-1.06l-1.5 1.5-.406-.464a.75.75 0 1 0-1.128.988l.933 1.067a.75.75 0 0 0 1.095.036L7.53 6.03Zm0 5.5a.75.75 0 1 0-1.06-1.06l-1.5 1.5-.406-.464a.75.75 0 0 0-1.128.988l.933 1.066a.75.75 0 0 0 1.095.037L7.53 11.53Zm0 4.44a.75.75 0 0 1 0 1.06l-2.066 2.067a.75.75 0 0 1-1.095-.037l-.933-1.066a.75.75 0 0 1 1.128-.988l.406.463 1.5-1.5a.75.75 0 0 1 1.06 0ZM10.5 5.25a.75.75 0 0 0 0 1.5h9.6a.75.75 0 0 0 0-1.5h-9.6ZM9.75 12a.75.75 0 0 1 .75-.75h9.6a.75.75 0 0 1 0 1.5h-9.6a.75.75 0 0 1-.75-.75Zm.75 5.25a.75.75 0 0 0 0 1.5h9.6a.75.75 0 0 0 0-1.5h-9.6Z",clipRule:"evenodd"})}),iH=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M16.19 6.16a2.133 2.133 0 1 1 4.267 0 2.133 2.133 0 0 1-4.266 0Zm-1.286 1.353L9.22 8.546a3.661 3.661 0 0 1-.866 2.308l3.346 3.824a3.66 3.66 0 0 1 2.596-.525l1.977-4.942a3.69 3.69 0 0 1-1.368-1.698Zm-5.982-.481A3.677 3.677 0 1 0 7.13 11.8l3.47 3.965a3.676 3.676 0 1 0 5.129-1.038l1.976-4.943a3.676 3.676 0 1 0-3.054-3.794l-5.73 1.042ZM3.41 8.483a2.133 2.133 0 1 1 4.266 0 2.133 2.133 0 0 1-4.266 0Zm10.266 7.162a2.133 2.133 0 1 0 0 4.266 2.133 2.133 0 0 0 0-4.266Z",clipRule:"evenodd"})}),iA=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"m9.488 15.75-1.164 2.425 1.352.65 1.476-3.075H17.5v-1.5h-5.628l1.92-4H17.5v-1.5h-2.988l1.164-2.425-1.352-.65-1.476 3.075H6.5v1.5h5.628l-1.92 4H6.5v1.5h2.988Z",clipRule:"evenodd"})}),iL=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7.435 5.118a2.868 2.868 0 0 1 4.986-1.934 2.868 2.868 0 0 1 4.639 3.301h2.831c.967 0 1.75.784 1.75 1.75v2.236a1.75 1.75 0 0 1-1.059 1.608V19a2.75 2.75 0 0 1-2.75 2.75H7.01A2.75 2.75 0 0 1 4.259 19v-6.921A1.75 1.75 0 0 1 3.2 10.47V8.235c0-.966.784-1.75 1.75-1.75h2.832a2.855 2.855 0 0 1-.347-1.367Zm2.868 1.367h1.368V5.118a1.368 1.368 0 1 0-1.368 1.367Zm2.868-1.367v1.367h1.367a1.368 1.368 0 1 0-1.367-1.367ZM4.95 7.985a.25.25 0 0 0-.25.25v2.236c0 .138.112.25.25.25h14.941a.25.25 0 0 0 .25-.25V8.235a.25.25 0 0 0-.25-.25H4.95Zm.809 4.236V19c0 .69.56 1.25 1.25 1.25h4.662v-8.03H5.759Zm7.412 0v8.029h4.661c.69 0 1.25-.56 1.25-1.25v-6.78h-5.911Z",clipRule:"evenodd"})}),iD=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 4.75a.75.75 0 0 1 .75.75v5.75h5.75a.75.75 0 0 1 0 1.5h-5.75v5.75a.75.75 0 0 1-1.5 0v-5.75H5.5a.75.75 0 0 1 0-1.5h5.75V5.5a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),iZ=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5.06 4.185A.75.75 0 0 0 4 5.246l1.398 1.399a14.118 14.118 0 0 0-3.212 2.41.75.75 0 0 0 1.06 1.06 12.6 12.6 0 0 1 3.263-2.36l2.24 2.242a9.627 9.627 0 0 0-3.414 2.207.75.75 0 1 0 1.061 1.06 8.118 8.118 0 0 1 3.54-2.08l2.467 2.466A5.635 5.635 0 0 0 8.17 15.3a.75.75 0 1 0 1.06 1.06 4.15 4.15 0 0 1 5.87 0c.029.03.06.056.092.08l2.744 2.742a.75.75 0 1 0 1.06-1.06L5.06 4.185Zm4.492 2.507c4.035-.85 8.402.292 11.533 3.423a.75.75 0 0 0 1.06-1.06 14.102 14.102 0 0 0-12.902-3.83.75.75 0 1 0 .31 1.467Zm3.752 2.75a.75.75 0 1 0-.176 1.49 8.12 8.12 0 0 1 4.807 2.333.75.75 0 0 0 1.06-1.06 9.621 9.621 0 0 0-5.691-2.763Zm-1.139 8.842a.75.75 0 1 0 0 1.5h.01a.75.75 0 1 0 0-1.5h-.01Z",clipRule:"evenodd"})}),ij=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 5A2.75 2.75 0 0 1 6 2.25h9A2.75 2.75 0 0 1 17.75 5v10.857a2.75 2.75 0 0 1-2.75 2.75H6a2.75 2.75 0 0 1-2.75-2.75V5ZM6 3.75c-.69 0-1.25.56-1.25 1.25v10.857c0 .69.56 1.25 1.25 1.25h9c.69 0 1.25-.56 1.25-1.25V5c0-.69-.56-1.25-1.25-1.25H6Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillOpacity:.6,d:"M6.25 18.607H15a2.75 2.75 0 0 0 2.75-2.75V5.25H18A2.75 2.75 0 0 1 20.75 8v10.857a2.75 2.75 0 0 1-2.75 2.75H9a2.75 2.75 0 0 1-2.75-2.75v-.25Z"})]}),iV=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M9.255 4.832a2.75 2.75 0 0 1 5.49 0A6.75 6.75 0 0 1 18.75 11v3.159c0 .34.135.665.375.906l1.064 1.063c.598.599.174 1.622-.672 1.622H15.75V18a3.75 3.75 0 1 1-7.5 0v-.25H4.483c-.847 0-1.27-1.023-.672-1.622l1.064-1.063c.24-.24.375-.567.375-.906V11a6.751 6.751 0 0 1 4.005-6.168ZM9.75 17.75V18a2.25 2.25 0 0 0 4.5 0v-.25h-4.5Zm2.25-14c-.69 0-1.25.56-1.25 1.25v.341a.75.75 0 0 1-.5.708A5.252 5.252 0 0 0 6.75 11v3.159c0 .737-.293 1.445-.815 1.966l-.124.125h12.378l-.124-.125a2.782 2.782 0 0 1-.815-1.966V11c0-2.285-1.46-4.23-3.5-4.951a.75.75 0 0 1-.5-.708V5c0-.69-.56-1.25-1.25-1.25Z",clipRule:"evenodd"})}),iz=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M6.268 6.199c.568.46.78.426 1.845.355L18.16 5.95c.214 0 .036-.214-.035-.25l-1.668-1.205c-.32-.248-.746-.533-1.562-.462l-9.728.71c-.354.035-.425.213-.284.355l1.386 1.1ZM6.87 8.54v10.569c0 .568.284.78.923.745l11.04-.638c.638-.035.71-.426.71-.887V7.83c0-.46-.178-.71-.568-.674L7.439 7.83c-.426.035-.568.248-.568.71Zm10.899.567c.07.319 0 .639-.32.675l-.533.106v7.802c-.462.249-.887.39-1.242.39-.568 0-.71-.177-1.136-.709l-3.48-5.462v5.285l1.102.248s0 .639-.889.639l-2.449.142c-.07-.142 0-.496.249-.568l.639-.177V10.49l-.888-.07c-.07-.32.107-.781.604-.817l2.627-.176 3.62 5.532v-4.893l-.923-.107c-.07-.39.214-.673.569-.71l2.45-.142ZM4.35 3.787l10.117-.745c1.242-.107 1.562-.035 2.343.532l3.23 2.27c.532.39.71.496.71.922v12.45c0 .78-.284 1.241-1.278 1.312l-11.75.71c-.745.035-1.1-.071-1.491-.568l-2.378-3.086c-.426-.568-.603-.993-.603-1.49V5.028c0-.639.283-1.17 1.1-1.241Z"})}),iR=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.114 3.678a.75.75 0 0 1 0 1.06L4.28 6.573a.75.75 0 0 1-1.06-1.06l1.833-1.834a.75.75 0 0 1 1.06 0Zm11.772 0a.75.75 0 0 1 1.061 0l1.833 1.833a.75.75 0 0 1-1.06 1.061l-1.834-1.833a.75.75 0 0 1 0-1.061ZM12 5.875a6.583 6.583 0 1 0 0 13.167 6.583 6.583 0 0 0 0-13.167Zm-8.083 6.583a8.083 8.083 0 1 1 16.166 0 8.083 8.083 0 0 1-16.166 0Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.197 10.359a.75.75 0 0 1 0 1.06l-3.555 3.556a.75.75 0 0 1-1.061 0l-1.778-1.778a.75.75 0 0 1 1.06-1.06l1.248 1.247 3.025-3.025a.75.75 0 0 1 1.061 0Z",clipRule:"evenodd"})]}),iF=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.182 3.272a.75.75 0 0 1 .546.91L10.71 8.25h4.453l1.108-4.432a.75.75 0 0 1 1.456.364L16.71 8.25H20a.75.75 0 0 1 0 1.5h-3.664l-1.125 4.5H18a.75.75 0 1 1 0 1.5h-3.164l-1.108 4.432a.75.75 0 0 1-1.456-.364l1.017-4.068H8.836l-1.108 4.432a.75.75 0 0 1-1.456-.364L7.29 15.75H4a.75.75 0 0 1 0-1.5h3.664l1.125-4.5H6a.75.75 0 0 1 0-1.5h3.164l1.108-4.432a.75.75 0 0 1 .91-.546Zm-.846 6.478-1.125 4.5h4.453l1.125-4.5h-4.453Z",clipRule:"evenodd"})}),iN=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.129 5.762a.593.593 0 0 0 .15-.08l.255-.177V7.64c0 .188.063.35.181.466a.656.656 0 0 0 .47.177c.186 0 .35-.061.468-.177a.637.637 0 0 0 .182-.466V4.934a.71.71 0 0 0-.197-.52c-.13-.13-.316-.195-.534-.195-.221 0-.434.022-.675.183l-.677.452a.53.53 0 0 0-.252.46c0 .273.203.472.464.472a.501.501 0 0 0 .165-.024Zm5.277-.16a.768.768 0 0 0 0 1.536h10.326a.768.768 0 1 0 0-1.536H9.406Zm0 5.632a.768.768 0 0 0 0 1.536h10.326a.768.768 0 1 0 0-1.535l-10.326-.001Zm0 5.633a.768.768 0 1 0 0 1.536h10.326a.768.768 0 1 0 0-1.536H9.406Zm-2.782-5.753c.012-.066.018-.136.018-.21 0-.678-.58-1.136-1.486-1.136-.652 0-1.176.277-1.373.721.197-.444.721-.72 1.373-.72.907 0 1.486.457 1.486 1.134 0 .075-.006.145-.018.211Zm-1.5 1.64v.02h1.184c.274 0 .43.163.43.414 0-.25-.156-.414-.43-.414H5.126v-.02Zm-1.384.237c.035-.14.126-.26.284-.393l1.026-.878c.338-.29.48-.453.523-.622-.042.17-.185.331-.523.622l-1.026.879c-.158.131-.25.253-.284.392Zm.763-1.81a.821.821 0 0 0 .251-.254.674.674 0 0 1 .184-.193.36.36 0 0 1 .202-.054c.113 0 .199.034.255.085.056.05.09.12.09.21 0 .17-.079.304-.502.667l-1.026.878c-.219.184-.336.365-.336.608 0 .156.045.303.152.412.108.108.265.164.463.164h2.073a.537.537 0 0 0 .389-.145.512.512 0 0 0 .142-.371.511.511 0 0 0-.142-.374.539.539 0 0 0-.39-.142h-.932l.496-.428c.287-.25.506-.447.651-.65.15-.207.221-.419.221-.691 0-.37-.16-.684-.442-.902-.281-.217-.677-.335-1.146-.335-.676 0-1.248.288-1.467.783a.703.703 0 0 0-.057.283c0 .155.05.29.152.387.1.095.24.142.4.142a.604.604 0 0 0 .32-.08Zm-.832 4.897c.152-.414.67-.853 1.557-.853.457 0 .865.096 1.16.29a.998.998 0 0 1 .478.865c0 .483-.308.804-.692.941.234.05.43.143.576.279.184.17.285.404.285.687 0 .405-.174.737-.49.966-.313.228-.762.352-1.311.352-.96 0-1.495-.458-1.641-.868a.704.704 0 0 1-.04-.228.51.51 0 0 1 .155-.387.594.594 0 0 1 .413-.142c.117 0 .217.02.305.064s.16.112.223.203a.79.79 0 0 0 .236.245c.09.055.206.087.377.087.278 0 .46-.165.46-.379a.329.329 0 0 0-.14-.288c-.096-.066-.242-.104-.444-.104H5.11a.483.483 0 0 1-.35-.122.438.438 0 0 1-.12-.323c0-.124.039-.236.12-.317.082-.08.2-.125.35-.125h.028c.178 0 .311-.038.399-.102a.315.315 0 0 0 .131-.268.323.323 0 0 0-.112-.258.493.493 0 0 0-.322-.098.566.566 0 0 0-.286.068.533.533 0 0 0-.198.207.702.702 0 0 1-.241.27.642.642 0 0 1-.343.082.549.549 0 0 1-.401-.144.5.5 0 0 1-.136-.363c0-.085.012-.153.042-.237Z",clipRule:"evenodd"})}),iq=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M19.552 5.67c.25-.25.654-.25.904 0l-.001.002c.25.25.25.654 0 .904a3.515 3.515 0 0 1-2.524 1.036c-.155 0-.313-.01-.472-.028-1.155-.137-2.32-.762-3.364-1.807l-1.808 1.808 3.127 3.127a.64.64 0 1 1-.904.905L11.383 8.49l-1.809 1.808 3.127 3.127a.64.64 0 1 1-.904.904L8.67 11.202 6.862 13.01l3.127 3.127a.64.64 0 1 1-.904.904l-3.127-3.127-.004-.004A6.394 6.394 0 0 1 15 4.872c1.6 1.6 3.43 1.921 4.552.799ZM6.132 9.643a.986.986 0 1 0 1.394-1.395.986.986 0 0 0-1.393 1.395ZM9.336 6.44a.986.986 0 1 0 1.393-1.395.986.986 0 0 0-1.393 1.395Zm5.223.709 3.138 3.138a6.393 6.393 0 0 1-9.053 9.03c-1.6-1.6-3.429-1.92-4.551-.798a.64.64 0 1 1-.905-.904c.786-.786 1.85-1.144 2.996-1.008 1.156.136 2.32.761 3.364 1.806l1.808-1.808-3.126-3.127a.639.639 0 1 1 .904-.904L12.26 15.7l1.808-1.809-3.127-3.126a.639.639 0 1 1 .904-.905l3.127 3.127 1.808-1.808-3.127-3.127a.64.64 0 1 1 .905-.904Zm-1.643 11.995a.986.986 0 1 0 1.394-1.395.986.986 0 0 0-1.394 1.395Zm3.202-3.202a.986.986 0 1 0 1.394-1.395.986.986 0 0 0-1.394 1.395Z",clipRule:"evenodd"})}),iU=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.25 4a.75.75 0 0 1 .75-.75h6a.75.75 0 0 1 .75.75v6a.75.75 0 0 1-1.5 0V5.81l-8.72 8.72a.75.75 0 1 1-1.06-1.06l8.72-8.72H14a.75.75 0 0 1-.75-.75ZM6 6.75c-.69 0-1.25.56-1.25 1.25v10c0 .69.56 1.25 1.25 1.25h10c.69 0 1.25-.56 1.25-1.25v-4a.75.75 0 0 1 1.5 0v4A2.75 2.75 0 0 1 16 20.75H6A2.75 2.75 0 0 1 3.25 18V8A2.75 2.75 0 0 1 6 5.25h4a.75.75 0 0 1 0 1.5H6Z",clipRule:"evenodd"})}),iW=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.665 2.33a.75.75 0 0 1 .67 0l8 4a.75.75 0 0 1 .415.67v10a.75.75 0 0 1-.415.67l-8 4a.75.75 0 0 1-.67 0l-8-4A.75.75 0 0 1 3.25 17V7a.75.75 0 0 1 .415-.67l8-4ZM4.75 8.213l6.5 3.25v8.322l-6.5-3.25V8.215Zm8 11.572 6.5-3.25V8.215l-6.5 3.25v8.322ZM12 10.162 18.323 7 12 3.839 5.677 7 12 10.162Z",clipRule:"evenodd"})}),iG=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7 3.25A2.75 2.75 0 0 0 4.25 6v12A2.75 2.75 0 0 0 7 20.75h10A2.75 2.75 0 0 0 19.75 18V6A2.75 2.75 0 0 0 17 3.25H7ZM5.75 6c0-.69.56-1.25 1.25-1.25h10c.69 0 1.25.56 1.25 1.25v12c0 .69-.56 1.25-1.25 1.25H7c-.69 0-1.25-.56-1.25-1.25V6ZM9 7.25a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5H9Zm-.75 4.25a.75.75 0 0 1 .75-.75h6a.75.75 0 0 1 0 1.5H9a.75.75 0 0 1-.75-.75ZM9 14.25a.75.75 0 0 0 0 1.5h5a.75.75 0 0 0 0-1.5H9Z",clipRule:"evenodd"})}),iY=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75a3.9 3.9 0 0 0 3.9-3.9v-.585c0-.4.003-.486.012-.543a.975.975 0 0 1 .81-.81c.057-.009.143-.012.543-.012h.585a3.9 3.9 0 0 0 3.9-3.9c0-5.385-4.365-9.75-9.75-9.75ZM9.075 7.612a1.462 1.462 0 1 1 2.925 0 1.462 1.462 0 0 1-2.925 0Zm4.875.976a1.463 1.463 0 1 1 2.925 0 1.463 1.463 0 0 1-2.925 0ZM7.613 10.05a1.463 1.463 0 1 0 0 2.925 1.463 1.463 0 0 0 0-2.925Z",clipRule:"evenodd"})}),iK=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.8 2.489a.75.75 0 0 0-.75.75V4.25H7A2.75 2.75 0 0 0 4.25 7v12A2.75 2.75 0 0 0 7 21.75h10A2.75 2.75 0 0 0 19.75 19V7A2.75 2.75 0 0 0 17 4.25h-.95V3.239a.75.75 0 0 0-.75-.75H8.8Zm7.25 3.261v.928a.75.75 0 0 1-.75.75H8.8a.75.75 0 0 1-.75-.75V5.75H7c-.69 0-1.25.56-1.25 1.25v12c0 .69.56 1.25 1.25 1.25h10c.69 0 1.25-.56 1.25-1.25V7c0-.69-.56-1.25-1.25-1.25h-.95Zm-6.5.178v-1.94h5v1.94h-5Z",clipRule:"evenodd"})}),iX=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.25 7A2.75 2.75 0 0 1 5 4.25h14A2.75 2.75 0 0 1 21.75 7v10A2.75 2.75 0 0 1 19 19.75H5A2.75 2.75 0 0 1 2.25 17V7ZM5 5.75c-.69 0-1.25.56-1.25 1.25v1.25h16.5V7c0-.69-.56-1.25-1.25-1.25H5Zm15.25 4H3.75V17c0 .69.56 1.25 1.25 1.25h14c.69 0 1.25-.56 1.25-1.25V9.75Zm-6 5.25a.75.75 0 0 1 .75-.75h3a.75.75 0 0 1 0 1.5h-3a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"})}),iQ=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M19.279 4.721a1.614 1.614 0 0 0-2.28 0l-.885.883 2.278 2.273.887-.885a1.603 1.603 0 0 0 0-2.271ZM17.33 8.937l-2.277-2.273L4.25 17.445v2.305h2.245L17.33 8.937Zm-1.39-5.278a3.114 3.114 0 0 1 4.398 0 3.103 3.103 0 0 1 0 4.395L7.335 21.03a.75.75 0 0 1-.53.22H3.5a.75.75 0 0 1-.75-.75v-3.367c0-.2.08-.39.22-.53L15.94 3.658Z",clipRule:"evenodd"})}),iJ=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M18 12a6 6 0 1 1-12 0 6 6 0 0 1 12 0Z"})}),i1=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M14 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"})}),i0=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.59 3.692a2.75 2.75 0 0 1 3.89 0l2.828 2.828a2.75 2.75 0 0 1 0 3.889l-5.328 5.329.884.884a.75.75 0 1 1-1.06 1.06L11.09 13.97l-4.925 4.924a.75.75 0 0 1-1.06-1.06l4.924-4.925-3.712-3.712a.75.75 0 0 1 1.06-1.06l.884.883 5.329-5.328ZM9.324 10.08l4.596 4.596 5.329-5.329a1.25 1.25 0 0 0 0-1.767l-2.829-2.829a1.25 1.25 0 0 0-1.767 0l-5.329 5.329Z",clipRule:"evenodd"})}),i2=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 2.25a.75.75 0 0 1 .75.75v7.25h5.5V10c0-.966.784-1.75 1.75-1.75h5c.966 0 1.75.784 1.75 1.75v2A1.75 1.75 0 0 1 18 13.75h-5A1.75 1.75 0 0 1 11.25 12v-.25h-5.5V17c0 .69.56 1.25 1.25 1.25h4.25V18c0-.966.784-1.75 1.75-1.75h5c.966 0 1.75.784 1.75 1.75v2A1.75 1.75 0 0 1 18 21.75h-5A1.75 1.75 0 0 1 11.25 20v-.25H7A2.75 2.75 0 0 1 4.25 17V3A.75.75 0 0 1 5 2.25ZM12.75 20c0 .138.112.25.25.25h5a.25.25 0 0 0 .25-.25v-2a.25.25 0 0 0-.25-.25h-5a.25.25 0 0 0-.25.25v2Zm0-8c0 .138.112.25.25.25h5a.25.25 0 0 0 .25-.25v-2a.25.25 0 0 0-.25-.25h-5a.25.25 0 0 0-.25.25v2Z",clipRule:"evenodd"})}),i5=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.48 3.692a2.75 2.75 0 0 0-3.89 0L8.263 9.02l-.883-.884a.75.75 0 0 0-1.061 1.06l1.414 1.415 2.298 2.298-4.924 4.925a.75.75 0 1 0 1.06 1.06l4.925-4.924 2.298 2.298 1.414 1.414a.75.75 0 0 0 1.06-1.06l-.883-.884 5.328-5.329a2.75 2.75 0 0 0 0-3.89L17.48 3.693Z",clipRule:"evenodd"})}),i7=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"m10.104 5.01 6.339 3.566c.782.44 1.415.796 1.883 1.119.47.324.88.684 1.102 1.175a2.75 2.75 0 0 1 0 2.26c-.222.491-.633.851-1.102 1.175-.468.323-1.1.679-1.883 1.119l-6.34 3.566c-.755.425-1.368.77-1.872.995-.508.227-1.015.387-1.54.328a2.75 2.75 0 0 1-1.921-1.124c-.31-.428-.419-.949-.47-1.503-.05-.55-.05-1.253-.05-2.12V8.434c0-.867 0-1.57.05-2.12.051-.554.16-1.075.47-1.503A2.75 2.75 0 0 1 6.69 3.687c.525-.06 1.032.1 1.54.328.504.226 1.117.57 1.873.995Zm-2.485.374c-.437-.195-.642-.22-.76-.206a1.25 1.25 0 0 0-.873.51c-.069.096-.148.287-.192.763-.043.473-.044 1.106-.044 2.02v7.057c0 .915 0 1.548.044 2.021.044.476.123.667.192.763.206.285.524.47.874.51.117.014.322-.01.759-.206.433-.194.985-.504 1.782-.952l6.273-3.529c.824-.463 1.396-.785 1.8-1.064.408-.282.538-.45.586-.557a1.25 1.25 0 0 0 0-1.027c-.048-.108-.178-.276-.586-.558-.404-.278-.976-.601-1.8-1.064L9.401 6.336c-.797-.448-1.35-.758-1.782-.952Z",clipRule:"evenodd"})}),i3=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("g",{clipPath:"url(#a)",children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"m10.217 4.787 6.358 3.577c.774.435 1.415.796 1.893 1.125.48.331.938.723 1.188 1.278a3 3 0 0 1 0 2.466c-.25.555-.708.947-1.188 1.278-.478.33-1.119.69-1.893 1.126l-6.358 3.576c-.748.42-1.37.77-1.883 1-.52.233-1.079.415-1.671.348a3 3 0 0 1-2.096-1.226c-.349-.483-.464-1.059-.516-1.626C4 17.148 4 16.435 4 15.577V8.423c0-.858 0-1.57.051-2.132.052-.567.167-1.143.516-1.626a3 3 0 0 1 2.096-1.226c.592-.067 1.15.115 1.67.348.515.23 1.136.58 1.884 1Z",clipRule:"evenodd"})}),(0,s.jsx)("defs",{children:(0,s.jsx)("clipPath",{id:"a",children:(0,s.jsx)("path",{fill:"currentColor",d:"M0 0H24V24H0z"})})})]}),i4=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M9.902 5.384c.018.077.043.153.074.226l.003.006c.276.666-.151 1.534-1.004 1.534H6.55a1.8 1.8 0 0 0-1.8 1.8v1.124c.012 0 .023-.002.035-.003h.003a2.714 2.714 0 1 1 0 5.408h-.003a1.977 1.977 0 0 1-.035-.003v1.974a1.8 1.8 0 0 0 1.8 1.8h1.974a2.21 2.21 0 0 1-.003-.035v-.003a2.713 2.713 0 1 1 5.408 0v.003a1.999 1.999 0 0 1-.003.035h1.124a1.8 1.8 0 0 0 1.8-1.8v-2.425c0-.85.866-1.284 1.536-1.003l.004.002c.073.031.149.056.226.074a1.353 1.353 0 1 0-.003-2.645c-.067.015-.141.04-.23.076-.666.276-1.533-.152-1.533-1.004V8.95a1.8 1.8 0 0 0-1.8-1.8h-1.575c-.85 0-1.284-.866-1.003-1.536l.002-.004c.031-.073.056-.149.074-.226a1.353 1.353 0 1 0-2.646 0Zm-1.477.266c-.337-1.695.945-3.4 2.8-3.4 1.856 0 3.137 1.705 2.8 3.4h1.025a3.3 3.3 0 0 1 3.3 3.3v1.025c1.695-.337 3.4.944 3.4 2.8 0 1.856-1.705 3.137-3.4 2.8v1.875a3.3 3.3 0 0 1-3.3 3.3h-1.609c-.825 0-1.24-.807-1.05-1.444.023-.082.038-.154.043-.22a1.214 1.214 0 1 0-2.418 0c.005.066.02.137.044.217v.002c.19.633-.223 1.445-1.05 1.445H6.55a3.3 3.3 0 0 1-3.3-3.3v-2.459c0-.825.807-1.24 1.444-1.05.082.023.154.038.22.043a1.214 1.214 0 1 0 0-2.418c-.066.005-.137.02-.217.044h-.002c-.633.19-1.445-.223-1.445-1.05V8.95a3.3 3.3 0 0 1 3.3-3.3h1.875Z",clipRule:"evenodd"})}),i6=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 4.5c.46 0 .833.373.833.833v5.834h5.834a.833.833 0 0 1 0 1.666h-5.834v5.834a.833.833 0 0 1-1.666 0v-5.834H5.333a.833.833 0 0 1 0-1.666h5.834V5.333c0-.46.373-.833.833-.833Z",clipRule:"evenodd"})}),i8=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 5a1 1 0 0 1 1 1v5h5a1 1 0 1 1 0 2h-5v5a1 1 0 1 1-2 0v-5H6a1 1 0 1 1 0-2h5V6a1 1 0 0 1 1-1Z",clipRule:"evenodd"})}),i9=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.25 6.5A2.25 2.25 0 0 1 4.5 4.25h15a2.25 2.25 0 0 1 2.25 2.25v11a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25v-11Zm2.25-.75a.75.75 0 0 0-.75.75v11c0 .414.336.75.75.75h15a.75.75 0 0 0 .75-.75v-11a.75.75 0 0 0-.75-.75h-15ZM5.75 8.5a.75.75 0 0 1 .75-.75h1a.75.75 0 0 1 0 1.5h-1a.75.75 0 0 1-.75-.75Zm.75 2.75a.75.75 0 0 0 0 1.5H13a.75.75 0 0 0 0-1.5H6.5Zm8.25.75a.75.75 0 0 1 .75-.75h2a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1-.75-.75ZM6.5 14.75a.75.75 0 0 0 0 1.5h11a.75.75 0 0 0 0-1.5h-11Z",clipRule:"evenodd"})}),se=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.174 3.952c0-.426.346-.772.772-.772H19.902a.772.772 0 1 1 0 1.544h-.367v9.853h.367a.772.772 0 0 1 0 1.545h-7.206v1.661l3.942 2.252a.772.772 0 0 1-.766 1.341l-3.176-1.815v1.487a.772.772 0 1 1-1.544 0v-1.421l-3.062 1.75a.772.772 0 1 1-.766-1.341l3.828-2.188v-1.726H3.946a.772.772 0 1 1 0-1.545h.368V4.724h-.368a.772.772 0 0 1-.772-.772Zm2.684.772H17.99v9.853H5.858V4.724Zm3.42 4.357a.772.772 0 0 0-1.545 0v2.28a.772.772 0 0 0 1.544 0V9.08Zm2.646-2.482c.427 0 .772.346.772.772v3.99a.772.772 0 1 1-1.544 0V7.37c0-.426.346-.772.772-.772Zm4.191 3.622a.772.772 0 1 0-1.544 0v1.14a.772.772 0 0 0 1.544 0v-1.14Z",clipRule:"evenodd"})}),st=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsxs)("g",{clipPath:"url(#a)",children:[(0,s.jsx)("path",{fill:"currentColor",d:"M24.003 12c0 6.63-5.37 12-12 12s-12-5.37-12-12 5.37-12 12-12 12 5.37 12 12Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M13.603 12h-3.4V8.41h3.4c.99 0 1.8.81 1.8 1.8 0 .991-.81 1.801-1.8 1.801m0-6h-5.8v12h2.4v-3.6h3.4a4.2 4.2 0 1 0 0-8.4Z"})]}),(0,s.jsx)("defs",{children:(0,s.jsx)("clipPath",{id:"a",children:(0,s.jsx)("path",{fill:"currentColor",d:"M0 0H24V24H0z"})})})]}),si=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M15 4.25a.75.75 0 0 1 .75.75v1.25H19A2.75 2.75 0 0 1 21.75 9v6A2.75 2.75 0 0 1 19 17.75h-3.25V19a.75.75 0 0 1-1.5 0v-1.25H5A2.75 2.75 0 0 1 2.25 15V9A2.75 2.75 0 0 1 5 6.25h9.25V5a.75.75 0 0 1 .75-.75ZM5 7.75h9.25v8.5H5c-.69 0-1.25-.56-1.25-1.25V9c0-.69.56-1.25 1.25-1.25Zm10.75 0v8.5H19c.69 0 1.25-.56 1.25-1.25V9c0-.69-.56-1.25-1.25-1.25h-3.25Zm-3 2.25a.75.75 0 0 0-1.5 0v4a.75.75 0 0 0 1.5 0v-4ZM9 9.25a.75.75 0 0 1 .75.75v4a.75.75 0 0 1-1.5 0v-4A.75.75 0 0 1 9 9.25ZM6.75 10a.75.75 0 0 0-1.5 0v4a.75.75 0 0 0 1.5 0v-4Z",clipRule:"evenodd"})}),ss=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 7A.75.75 0 0 1 4 6.25h16a.75.75 0 0 1 0 1.5H4A.75.75 0 0 1 3.25 7ZM3.25 12a.75.75 0 0 1 .75-.75h16a.75.75 0 0 1 0 1.5H4a.75.75 0 0 1-.75-.75ZM3.25 17a.75.75 0 0 1 .75-.75h16a.75.75 0 0 1 0 1.5H4a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"})}),so=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.035 11.25h3.209c.083-2.207.529-4.22 1.232-5.75.143-.313.303-.615.478-.9a8.006 8.006 0 0 0-4.92 6.65ZM12 2.5a9.5 9.5 0 1 0 0 19 9.5 9.5 0 0 0 0-19ZM12 4c-.64 0-1.459.596-2.161 2.126-.6 1.306-1.012 3.097-1.094 5.124h6.51c-.082-2.027-.494-3.818-1.094-5.124C13.46 4.596 12.64 4 12 4Zm4.756 7.25c-.083-2.207-.529-4.22-1.232-5.75a8.474 8.474 0 0 0-.478-.9 8.006 8.006 0 0 1 4.92 6.65h-3.21Zm-1.5 1.5H8.744c.082 2.027.494 3.818 1.094 5.124C10.54 19.404 11.36 20 12 20c.64 0 1.459-.596 2.161-2.126.6-1.306 1.012-3.097 1.094-5.124Zm-.21 6.65a8.47 8.47 0 0 0 .478-.9c.704-1.53 1.15-3.543 1.232-5.75h3.21a8.006 8.006 0 0 1-4.92 6.65Zm-6.092 0a8.473 8.473 0 0 1-.478-.9c-.703-1.53-1.15-3.543-1.232-5.75h-3.21a8.006 8.006 0 0 0 4.92 6.65Z",clipRule:"evenodd"})}),sr=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 10.966v4.095c0 .565.458 1.024 1.024 1.024h4.095c.566 0 1.024-.459 1.024-1.024v-4.095c0-.566-.459-1.024-1.024-1.024H6.704A3.347 3.347 0 0 1 9.845 7.75v-1.5A4.845 4.845 0 0 0 5 10.966Zm8 0v4.095c0 .565.458 1.024 1.024 1.024h4.095c.566 0 1.024-.459 1.024-1.024v-4.095c0-.566-.459-1.024-1.024-1.024h-3.415a3.347 3.347 0 0 1 3.141-2.192v-1.5A4.845 4.845 0 0 0 13 10.966Z",clipRule:"evenodd"})}),sa=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.25 5A.75.75 0 0 1 3 4.25h1A4.25 4.25 0 0 1 8.25 8.5 2.75 2.75 0 0 0 11 11.25h2a2.75 2.75 0 0 0 2.75-2.75A4.25 4.25 0 0 1 20 4.25h1a.75.75 0 0 1 0 1.5h-1a2.75 2.75 0 0 0-2.75 2.75c0 1.049-.38 2.009-1.01 2.75H21a.75.75 0 0 1 0 1.5h-4.76a4.233 4.233 0 0 1 1.01 2.75A2.75 2.75 0 0 0 20 18.25h1a.75.75 0 0 1 0 1.5h-1a4.25 4.25 0 0 1-4.25-4.25A2.75 2.75 0 0 0 13 12.75h-2a2.75 2.75 0 0 0-2.75 2.75A4.25 4.25 0 0 1 4 19.75H3a.75.75 0 0 1 0-1.5h1a2.75 2.75 0 0 0 2.75-2.75c0-1.049.38-2.009 1.01-2.75H3a.75.75 0 0 1 0-1.5h4.76A4.233 4.233 0 0 1 6.75 8.5 2.75 2.75 0 0 0 4 5.75H3A.75.75 0 0 1 2.25 5Z",clipRule:"evenodd"})}),sn=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",d:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M18.652 12.095c0-.81-.655-1.454-1.454-1.454-.378 0-.74.145-1.013.405-1.002-.715-2.373-1.18-3.899-1.24l.668-3.123 2.17.465a1.037 1.037 0 1 0 1.037-1.085c-.406 0-.763.238-.93.584l-2.42-.513a.254.254 0 0 0-.191.036.231.231 0 0 0-.107.167l-.74 3.481c-1.55.048-2.944.513-3.958 1.24a1.464 1.464 0 0 0-1.013-.405 1.452 1.452 0 0 0-.596 2.778 2.625 2.625 0 0 0-.036.44c0 2.242 2.611 4.066 5.83 4.066s5.83-1.812 5.83-4.065a2.75 2.75 0 0 0-.036-.441c.5-.227.858-.74.858-1.336Zm-9.99 1.037a1.038 1.038 0 1 1 1.037 1.038c-.572.011-1.037-.465-1.037-1.038Zm5.806 2.754c-.715.716-2.075.764-2.468.764-.405 0-1.764-.06-2.468-.764a.267.267 0 0 1 0-.381.267.267 0 0 1 .382 0c.453.453 1.406.608 2.086.608.68 0 1.645-.155 2.086-.608a.267.267 0 0 1 .382 0 .29.29 0 0 1 0 .381Zm-.191-1.704a1.038 1.038 0 1 1 1.037-1.037c0 .56-.464 1.037-1.037 1.037Z"})]}),sl=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M15.47 4.47a.75.75 0 0 1 1.06 0l4 4a.75.75 0 0 1 0 1.06l-4 4a.75.75 0 1 1-1.06-1.06l2.72-2.72H13.6c-1.692 0-2.917 0-3.88.08-.954.077-1.585.228-2.103.492a5.25 5.25 0 0 0-2.295 2.295c-.264.518-.415 1.15-.493 2.103-.078.963-.079 2.187-.079 3.88a.75.75 0 0 1-1.5 0v-.034c0-1.651 0-2.937.084-3.968.086-1.047.262-1.897.652-2.662a6.75 6.75 0 0 1 2.95-2.95c.765-.39 1.615-.566 2.662-.652 1.031-.084 2.317-.084 3.968-.084h4.623l-2.72-2.72a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),sc=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5.778 4.75c-.564 0-1.028.464-1.028 1.028v1.778a.75.75 0 0 1-1.5 0V5.778A2.533 2.533 0 0 1 5.778 3.25h1.778a.75.75 0 0 1 0 1.5H5.778ZM15.694 4a.75.75 0 0 1 .75-.75h1.778a2.533 2.533 0 0 1 2.528 2.528v1.778a.75.75 0 0 1-1.5 0V5.778c0-.564-.464-1.028-1.028-1.028h-1.778a.75.75 0 0 1-.75-.75ZM4 15.694a.75.75 0 0 1 .75.75v1.778c0 .564.464 1.028 1.028 1.028h1.778a.75.75 0 0 1 0 1.5H5.778a2.533 2.533 0 0 1-2.528-2.528v-1.778a.75.75 0 0 1 .75-.75ZM8.75 8.8V11.202c.001.002.005.008.013.015a.138.138 0 0 0 .094.033h4.286a.137.137 0 0 0 .094-.033.05.05 0 0 0 .012-.015l.001-.002V8.798a.051.051 0 0 0-.013-.015.137.137 0 0 0-.094-.033H8.857a.137.137 0 0 0-.094.033.053.053 0 0 0-.013.015V8.8Zm-1.5 0c0-.904.77-1.55 1.607-1.55h4.286c.838 0 1.607.646 1.607 1.55v2.4c0 .904-.77 1.55-1.607 1.55H8.857c-.838 0-1.607-.646-1.607-1.55V8.8ZM15.75 15.8V18.202a.05.05 0 0 0 .013.015.137.137 0 0 0 .094.033h4.286a.137.137 0 0 0 .094-.033.05.05 0 0 0 .013-.015V15.798a.05.05 0 0 0-.013-.015.137.137 0 0 0-.094-.033h-4.286a.137.137 0 0 0-.094.033.05.05 0 0 0-.012.015l-.001.002Zm-1.5 0c0-.904.77-1.55 1.607-1.55h4.286c.838 0 1.607.646 1.607 1.55v2.4c0 .904-.77 1.55-1.607 1.55h-4.286c-.838 0-1.607-.646-1.607-1.55v-2.4Z",clipRule:"evenodd"})}),sd=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.75a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5ZM2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm6 0a.75.75 0 0 1 .75-.75h6a.75.75 0 0 1 0 1.5H9a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"})}),sh=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 5.25c-.69 0-1.25.56-1.25 1.25V17c0 .69.56 1.25 1.25 1.25h7a.75.75 0 0 1 0 1.5H5A2.75 2.75 0 0 1 2.25 17V6.5A2.75 2.75 0 0 1 5 3.75h4.672c.729 0 1.428.29 1.944.805l1.195 1.195H19a2.75 2.75 0 0 1 2.75 2.75V11a.75.75 0 0 1-1.5 0V8.5c0-.69-.56-1.25-1.25-1.25h-6.5a.75.75 0 0 1-.53-.22l-1.415-1.414a1.25 1.25 0 0 0-.883-.366H5Zm9.47 8.22a.75.75 0 0 1 1.06 0L18 15.94l2.47-2.47a.75.75 0 1 1 1.06 1.06L19.06 17l2.47 2.47a.75.75 0 1 1-1.06 1.06L18 18.06l-2.47 2.47a.75.75 0 1 1-1.06-1.06L16.94 17l-2.47-2.47a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"})}),su=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.777 13.505a.75.75 0 0 1-1.115-.007l-2.223-2.5a.75.75 0 0 1 1.122-.996l.911 1.025V6a.25.25 0 0 0-.25-.25H10a.75.75 0 0 1 0-1.5h6.222c.967 0 1.75.784 1.75 1.75v5.063l.974-1.068a.75.75 0 0 1 1.108 1.01l-2.277 2.5Zm-11.054-3.01a.75.75 0 0 1 1.115.007l2.223 2.5a.75.75 0 0 1-1.122.996l-.911-1.025V18c0 .138.112.25.25.25H14.5a.75.75 0 0 1 0 1.5H8.278A1.75 1.75 0 0 1 6.528 18v-5.063l-.974 1.068a.75.75 0 1 1-1.108-1.01l2.277-2.5Z",clipRule:"evenodd"})}),sp=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 12a8.75 8.75 0 0 1 14.584-6.522l.002.002 1.414 1.277V4a.75.75 0 0 1 1.5 0v4.444a.75.75 0 0 1-.75.75h-4.444a.75.75 0 1 1 0-1.5h2.494l-1.217-1.098-.001-.001a7.25 7.25 0 1 0 2.238 7.017.75.75 0 1 1 1.463.332A8.75 8.75 0 0 1 3.25 12Z",clipRule:"evenodd"})}),sf=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.25 8.5a4.25 4.25 0 0 1 4.25-4.25H21a.75.75 0 0 1 0 1.5h-5.5a2.75 2.75 0 0 0-2.75 2.75c0 1.049-.38 2.009-1.01 2.75H21a.75.75 0 0 1 0 1.5h-9.26a4.233 4.233 0 0 1 1.01 2.75 2.75 2.75 0 0 0 2.75 2.75H21a.75.75 0 0 1 0 1.5h-5.5a4.25 4.25 0 0 1-4.25-4.25 2.75 2.75 0 0 0-2.75-2.75H3a.75.75 0 0 1 0-1.5h5.5a2.75 2.75 0 0 0 2.75-2.75Z",clipRule:"evenodd"})}),sg=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.25 7A2.75 2.75 0 0 1 5 4.25h14A2.75 2.75 0 0 1 21.75 7v10A2.75 2.75 0 0 1 19 19.75H5A2.75 2.75 0 0 1 2.25 17V7ZM5 5.75h7.25v12.5H5c-.69 0-1.25-.56-1.25-1.25V7c0-.69.56-1.25 1.25-1.25Zm8.75 0v12.5H19c.69 0 1.25-.56 1.25-1.25V7c0-.69-.56-1.25-1.25-1.25h-5.25Zm2.05 1.5a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 0-1.5h-2Zm-.75 3.25a.75.75 0 0 1 .75-.75h2a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1-.75-.75Zm.75 1.75a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 0-1.5h-2Z",clipRule:"evenodd"})}),sm=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M5.235 21.318C3.748 21.318 3 20.612 3 19.087v-8.62c0-1.525.748-2.24 2.235-2.24h8.62c1.488 0 2.236.715 2.236 2.24v8.62c0 1.525-.748 2.231-2.236 2.231h-8.62Zm.027-1.403h8.567c.6 0 .861-.244.861-.854v-8.576c0-.61-.26-.854-.86-.854H5.261c-.592 0-.862.244-.862.854v8.576c0 .61.27.854.862.854ZM20.424 10.682a.572.572 0 0 1-.567-.571V8.73c0-1.962-1.252-3.343-3.236-3.343h-.183v1.179c0 .663-.512.82-1.024.442L13.11 5.313c-.394-.285-.384-.617 0-.902l2.304-1.704c.512-.386 1.024-.23 1.024.452v1.16h.192c2.624 0 4.37 1.777 4.37 4.41v1.382a.58.58 0 0 1-.576.57Z"})}),sv=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.631 5.357a7.012 7.012 0 0 0-6.57 9.467l.794-2.327a.679.679 0 1 1 1.284.438l-1.225 3.592a.679.679 0 0 1-.861.424L2.46 15.725a.679.679 0 0 1 .438-1.284l1.805.616a8.369 8.369 0 1 1 7.928 5.681.679.679 0 0 1 0-1.357 7.012 7.012 0 1 0 0-14.024Z",clipRule:"evenodd"})}),sy=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.25 7A2.75 2.75 0 0 1 5 4.25h14A2.75 2.75 0 0 1 21.75 7v10A2.75 2.75 0 0 1 19 19.75H5A2.75 2.75 0 0 1 2.25 17V7ZM5 5.75c-.69 0-1.25.56-1.25 1.25v10c0 .69.56 1.25 1.25 1.25h14c.69 0 1.25-.56 1.25-1.25V7c0-.69-.56-1.25-1.25-1.25H5Z",clipRule:"evenodd"})}),sb=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 4.75c-.69 0-1.25.56-1.25 1.25v12c0 .69.56 1.25 1.25 1.25h12c.69 0 1.25-.56 1.25-1.25V7.828c0-.331-.132-.649-.366-.883l-1.829-1.829a1.25 1.25 0 0 0-.883-.366h-.422V7A1.75 1.75 0 0 1 14 8.75h-4A1.75 1.75 0 0 1 8.25 7V4.75H6Zm6 0h2.25V7a.25.25 0 0 1-.25.25h-4A.25.25 0 0 1 9.75 7V4.75H12Zm4.172-1.5H6A2.75 2.75 0 0 0 3.25 6v12A2.75 2.75 0 0 0 6 20.75h12A2.75 2.75 0 0 0 20.75 18V7.828c0-.729-.29-1.428-.805-1.944l-1.829-1.829a2.75 2.75 0 0 0-1.944-.805ZM9.75 14a2.25 2.25 0 1 1 4.5 0 2.25 2.25 0 0 1-4.5 0ZM12 10.25a3.75 3.75 0 1 0 0 7.5 3.75 3.75 0 0 0 0-7.5Z",clipRule:"evenodd"})}),sw=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 6A2.75 2.75 0 0 1 6 3.25h5a.75.75 0 0 1 0 1.5H6c-.69 0-1.25.56-1.25 1.25v12c0 .69.56 1.25 1.25 1.25h12c.69 0 1.25-.56 1.25-1.25v-5a.75.75 0 0 1 1.5 0v5A2.75 2.75 0 0 1 18 20.75H6A2.75 2.75 0 0 1 3.25 18V6Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M15 4.75a.75.75 0 0 1 0-1.5h5a.75.75 0 0 1 .75.75v5a.75.75 0 0 1-1.5 0V5.81l-7.44 7.44H15a.75.75 0 0 1 0 1.5h-5a.75.75 0 0 1-.75-.75V9a.75.75 0 0 1 1.5 0v3.19l7.44-7.44H15Z",clipRule:"evenodd"})]}),sx=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.25 4a.75.75 0 0 1 .75-.75h6a.75.75 0 0 1 .75.75v6a.75.75 0 0 1-1.5 0V4.75H14a.75.75 0 0 1-.75-.75ZM10.75 20a.75.75 0 0 1-.75.75H4a.75.75 0 0 1-.75-.75v-6a.75.75 0 0 1 1.5 0v5.25H10a.75.75 0 0 1 .75.75Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"m3.47 19.47 16-16 1.06 1.06-16 16-1.06-1.06Z",clipRule:"evenodd"})]}),s_=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.667 4.75a1.917 1.917 0 1 0 0 3.833 1.917 1.917 0 0 0 0-3.833ZM3.25 6.667A3.417 3.417 0 1 1 9.568 8.47l2.721 2.51 7.202-6.643A.75.75 0 0 1 20.51 5.44L9.569 15.53a3.417 3.417 0 1 1-1.053-1.07L11.183 12 8.515 9.54A3.417 3.417 0 0 1 3.25 6.666Zm10.865 7.017a.75.75 0 0 1 1.06-.042l5.333 4.918a.75.75 0 1 1-1.016 1.103l-5.334-4.919a.75.75 0 0 1-.043-1.06Zm-7.448 1.733a1.917 1.917 0 1 0 0 3.833 1.917 1.917 0 0 0 0-3.833Z",clipRule:"evenodd"})}),sC=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.75 9.5a5.75 5.75 0 1 1 11.5 0 5.75 5.75 0 0 1-11.5 0ZM9.5 2.25a7.25 7.25 0 1 0 4.569 12.88l5.4 5.4a.75.75 0 1 0 1.061-1.06l-5.4-5.401A7.25 7.25 0 0 0 9.5 2.25Z",clipRule:"evenodd"})}),sk=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.012 4.35c-.17-1.5 1.514-2.496 2.748-1.625l13.222 9.335c1.383.977.712 3.152-.98 3.18l-6.661.11a.25.25 0 0 0-.213.127L9.066 20.88c-.836 1.475-3.071 1.019-3.261-.666L4.012 4.35Zm1.883-.4a.25.25 0 0 0-.393.232l1.793 15.863a.25.25 0 0 0 .466.095l3.061-5.403a1.75 1.75 0 0 1 1.494-.887l6.66-.11a.25.25 0 0 0 .141-.454L5.895 3.95Z",clipRule:"evenodd"})}),sS=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3 6a3 3 0 0 1 5.92-.692h6.16a3.001 3.001 0 1 1 3.612 3.612v6.16a3.001 3.001 0 1 1-3.612 3.612H8.92a3.001 3.001 0 1 1-3.612-3.612V8.92A3.001 3.001 0 0 1 3 6Zm3.692 2.92v6.16a3.004 3.004 0 0 1 2.228 2.228h6.16a3.004 3.004 0 0 1 2.228-2.228V8.92a3.004 3.004 0 0 1-2.228-2.228H8.92A3.005 3.005 0 0 1 6.692 8.92ZM6 4.385a1.615 1.615 0 1 0 0 3.23 1.615 1.615 0 0 0 0-3.23Zm12 0a1.615 1.615 0 1 0 0 3.23 1.615 1.615 0 0 0 0-3.23Zm-12 12a1.615 1.615 0 1 0 0 3.23 1.615 1.615 0 0 0 0-3.23Zm12 0a1.615 1.615 0 1 0 0 3.23 1.615 1.615 0 0 0 0-3.23Z",clipRule:"evenodd"})}),sM=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3a.657.657 0 0 0 0 1.317h2.625v15.366H12A.657.657 0 0 0 12 21h6.563a.657.657 0 0 0 0-1.317h-2.625V4.317h2.624a.657.657 0 0 0 0-1.317H12ZM5 7.39a.438.438 0 0 0-.438.44v8.78c0 .242.196.439.438.439h7.656a.657.657 0 0 1 0 1.317H5c-.966 0-1.75-.786-1.75-1.756V7.83c0-.97.784-1.757 1.75-1.757h7.656a.657.657 0 0 1 0 1.317H5Zm14 9.659a.438.438 0 0 0 .438-.44V7.83A.438.438 0 0 0 19 7.39h-1.094a.657.657 0 0 1 0-1.317H19c.966 0 1.75.786 1.75 1.756v8.78c0 .97-.784 1.757-1.75 1.757h-1.094a.657.657 0 0 1 0-1.317H19Z",clipRule:"evenodd"})}),sE=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 3.25A2.75 2.75 0 0 0 3.25 6v12A2.75 2.75 0 0 0 6 20.75h5a.75.75 0 0 0 0-1.5H6c-.69 0-1.25-.56-1.25-1.25V6c0-.69.56-1.25 1.25-1.25h12c.69 0 1.25.56 1.25 1.25v5a.75.75 0 0 0 1.5 0V6A2.75 2.75 0 0 0 18 3.25H6Zm7.939 10.041a.5.5 0 0 0-.648.648l2.957 7.556a.5.5 0 0 0 .936-.012l1.061-2.937a.5.5 0 0 1 .3-.3l2.938-1.062a.5.5 0 0 0 .012-.936l-7.556-2.957Z",clipRule:"evenodd"})}),sI=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M20.088 4.143s1.804-.703 1.653 1.005c-.05.704-.5 3.166-.851 5.828l-1.203 7.888s-.1 1.156-1.002 1.357c-.902.2-2.255-.703-2.506-.904-.2-.151-3.757-2.412-5.01-3.517-.351-.302-.752-.905.05-1.608l5.26-5.025c.602-.602 1.203-2.009-1.302-.3l-7.015 4.772s-.802.503-2.305.05L2.6 12.684s-1.203-.753.852-1.507c5.01-2.361 11.174-4.772 16.635-7.034h.001Z"})}),sB=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M9.596 4.14c.612-2.52 4.196-2.52 4.808 0a.974.974 0 0 0 1.454.602c2.215-1.35 4.75 1.186 3.4 3.4a.974.974 0 0 0 .602 1.454c2.52.612 2.52 4.196 0 4.808a.974.974 0 0 0-.602 1.454c1.35 2.215-1.185 4.75-3.4 3.4a.974.974 0 0 0-1.454.602c-.612 2.52-4.196 2.52-4.808 0a.974.974 0 0 0-1.454-.602c-2.214 1.35-4.75-1.185-3.4-3.4a.974.974 0 0 0-.602-1.454c-2.52-.612-2.52-4.196 0-4.808a.974.974 0 0 0 .602-1.454c-1.35-2.214 1.186-4.75 3.4-3.4a.974.974 0 0 0 1.454-.602Zm3.35.354c-.24-.992-1.652-.992-1.893 0a2.474 2.474 0 0 1-3.691 1.53c-.872-.532-1.87.466-1.339 1.338.872 1.43.1 3.296-1.529 3.691-.992.241-.992 1.653 0 1.893a2.474 2.474 0 0 1 1.53 3.692c-.532.872.466 1.87 1.338 1.339a2.474 2.474 0 0 1 3.691 1.529c.241.992 1.653.992 1.893 0a2.474 2.474 0 0 1 3.692-1.53c.872.532 1.87-.466 1.339-1.338a2.474 2.474 0 0 1 1.529-3.692c.992-.24.992-1.652 0-1.893a2.474 2.474 0 0 1-1.53-3.691c.532-.872-.466-1.87-1.338-1.339-1.43.872-3.296.1-3.692-1.529ZM12 9.75a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5ZM8.25 12a3.75 3.75 0 1 1 7.5 0 3.75 3.75 0 0 1-7.5 0Z",clipRule:"evenodd"})}),s$=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.25a.75.75 0 0 1 .651.378l3.556 6.222a.75.75 0 0 1-.651 1.122H8.444a.75.75 0 0 1-.65-1.122l3.555-6.222A.75.75 0 0 1 12 3.25ZM9.737 9.472h4.526L12 5.512l-2.263 3.96ZM7.11 14.528a2.361 2.361 0 1 0 0 4.722 2.361 2.361 0 0 0 0-4.722Zm-3.861 2.36a3.861 3.861 0 1 1 7.722 0 3.861 3.861 0 0 1-7.722 0Zm9.778-3.11a.75.75 0 0 1 .75-.75H20a.75.75 0 0 1 .75.75V20a.75.75 0 0 1-.75.75h-6.222a.75.75 0 0 1-.75-.75v-6.222Zm1.5.75v4.722h4.722v-4.722h-4.722Z",clipRule:"evenodd"})}),sT=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M18 3.75a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5ZM14.25 6a3.75 3.75 0 1 1 .799 2.314l-5.427 2.713a3.753 3.753 0 0 1 0 1.946l5.427 2.713a3.75 3.75 0 1 1-.671 1.341L8.95 14.314a3.75 3.75 0 1 1 0-4.628l5.427-2.713A3.751 3.751 0 0 1 14.25 6ZM6 9.75a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5Zm12 6a2.25 2.25 0 1 0-.002 4.5 2.25 2.25 0 0 0 .002-4.5Z",clipRule:"evenodd"})}),sO=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.601 3.315a.75.75 0 0 1 .807.128l6.095 5.5a.75.75 0 0 1 0 1.114l-6.095 5.5A.75.75 0 0 1 14.156 15v-2.735c-2.614.106-4.1.76-4.92 1.345-.45.322-.715.633-.862.847a1.884 1.884 0 0 0-.166.29v.002A.75.75 0 0 1 6.75 14.5c0-3.006 1.322-4.981 3.035-6.178 1.4-.977 3.035-1.419 4.37-1.538V4a.75.75 0 0 1 .446-.685Zm-5.996 8.911c1.227-.793 3.191-1.476 6.3-1.476a.75.75 0 0 1 .75.75v1.813L19.882 9.5l-4.225-3.813V7.5a.75.75 0 0 1-.75.75c-1.202 0-2.894.347-4.262 1.302-.866.605-1.619 1.462-2.039 2.675Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6 5.75c-.69 0-1.25.56-1.25 1.25v11c0 .69.56 1.25 1.25 1.25h11c.69 0 1.25-.56 1.25-1.25v-2a.75.75 0 0 1 1.5 0v2A2.75 2.75 0 0 1 17 20.75H6A2.75 2.75 0 0 1 3.25 18V7A2.75 2.75 0 0 1 6 4.25h4a.75.75 0 0 1 0 1.5H6Z",clipRule:"evenodd"})]}),sP=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 5.75a.75.75 0 0 0 0 1.5h14a.75.75 0 0 0 0-1.5H5Zm0 3.5a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5H5Z",clipRule:"evenodd"})}),sH=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.35 7.25a2.501 2.501 0 0 1 2.4-1.8h5.5a2.5 2.5 0 0 1 0 5h-5.5c-1.1 0-2.036-.712-2.37-1.7H7.237c.47.627.75 1.406.75 2.25v2a2.25 2.25 0 0 0 2.25 2.25h.113a2.501 2.501 0 0 1 2.401-1.8h5.5a2.5 2.5 0 1 1 0 5h-5.5c-1.1 0-2.036-.712-2.37-1.7h-.145A3.75 3.75 0 0 1 6.485 13v-2a2.25 2.25 0 0 0-2.25-2.25H2v-1.5h8.35Zm2.4-.3a1 1 0 1 0 0 2h5.5a1 1 0 1 0 0-2h-5.5Zm0 8a1 1 0 1 0 0 2h5.5a1 1 0 0 0 0-2h-5.5Z",clipRule:"evenodd"})}),sA=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.25 7A2.75 2.75 0 0 1 5 4.25h14A2.75 2.75 0 0 1 21.75 7v10A2.75 2.75 0 0 1 19 19.75H5A2.75 2.75 0 0 1 2.25 17V7ZM5 5.75h5.25v12.5H5c-.69 0-1.25-.56-1.25-1.25V7c0-.69.56-1.25 1.25-1.25Zm6.75 0v12.5H19c.69 0 1.25-.56 1.25-1.25V7c0-.69-.56-1.25-1.25-1.25h-7.25ZM6 7.25a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 0-1.5H6Zm-.75 3.25A.75.75 0 0 1 6 9.75h2a.75.75 0 0 1 0 1.5H6a.75.75 0 0 1-.75-.75ZM6 12.25a.75.75 0 0 0 0 1.5h2a.75.75 0 0 0 0-1.5H6Z",clipRule:"evenodd"})}),sL=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 2.25A2.75 2.75 0 0 0 5.25 5v14A2.75 2.75 0 0 0 8 21.75h5A2.75 2.75 0 0 0 15.75 19v-1.5a.75.75 0 0 0-1.5 0V19c0 .69-.56 1.25-1.25 1.25H8c-.69 0-1.25-.56-1.25-1.25V5c0-.69.56-1.25 1.25-1.25h5c.69 0 1.25.56 1.25 1.25v1.5a.75.75 0 0 0 1.5 0V5A2.75 2.75 0 0 0 13 2.25H8Zm10.03 6.22a.75.75 0 1 0-1.06 1.06l1 1 .72.72H11a.75.75 0 0 0 0 1.5h7.69l-.72.72-1 1a.75.75 0 1 0 1.06 1.06l1-1 2-2a.75.75 0 0 0 0-1.06l-2-2-1-1Z",clipRule:"evenodd"})}),sD=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.75 12a8.25 8.25 0 1 1 16.5 0 8.25 8.25 0 0 1-16.5 0ZM12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-2.47 8.22a.75.75 0 0 0-1.06 1.06l3 3a.75.75 0 0 0 1.06 0l3-3a.75.75 0 1 0-1.06-1.06L12 12.94l-2.47-2.47Z",clipRule:"evenodd"})}),sZ=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.75a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5ZM2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M16.53 9.53a.75.75 0 0 0-1.06-1.06l-4.97 4.97-1.47-1.47a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l5.5-5.5Z",clipRule:"evenodd"})]}),sj=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 21.5a9.5 9.5 0 1 0 0-19 9.5 9.5 0 0 0 0 19Zm4.225-12.136a.75.75 0 1 0-1.061-1.061l-5.275 5.275-1.581-1.58a.75.75 0 1 0-1.06 1.06l2.11 2.111a.75.75 0 0 0 1.061 0l5.806-5.805Z",clipRule:"evenodd"})}),sV=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.75a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5ZM2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Z",clipRule:"evenodd"})}),sz=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.75A8.213 8.213 0 0 0 3.75 12 8.213 8.213 0 0 0 12 20.25 8.213 8.213 0 0 0 20.25 12 8.213 8.213 0 0 0 12 3.75ZM2.25 12A9.713 9.713 0 0 1 12 2.25 9.713 9.713 0 0 1 21.75 12 9.713 9.713 0 0 1 12 21.75 9.713 9.713 0 0 1 2.25 12ZM8.5 7.75a.75.75 0 0 1 .75.75V10a.75.75 0 0 1-1.5 0V8.5a.75.75 0 0 1 .75-.75Zm7 0a.75.75 0 0 1 .75.75V10a.75.75 0 0 1-1.5 0V8.5a.75.75 0 0 1 .75-.75Zm-8.682 5.522a.75.75 0 0 1 .91.546C8.134 15.443 9.683 16.75 12 16.75s3.866-1.307 4.272-2.932a.75.75 0 0 1 1.456.364c-.594 2.376-2.812 4.068-5.728 4.068s-5.134-1.692-5.728-4.068a.75.75 0 0 1 .546-.91Z",clipRule:"evenodd"})}),sR=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5.75 4.25A.75.75 0 0 0 5 5v3a.75.75 0 0 0 1.5 0V5.75h2.25a.75.75 0 0 0 0-1.5h-3Zm0 15.5A.75.75 0 0 1 5 19v-3a.75.75 0 0 1 1.5 0v2.25h2.25a.75.75 0 0 1 0 1.5h-3ZM19.5 5a.75.75 0 0 0-.75-.75h-3a.75.75 0 0 0 0 1.5H18V8a.75.75 0 0 0 1.5 0V5Zm-.75 14.75a.75.75 0 0 0 .75-.75v-3a.75.75 0 0 0-1.5 0v2.25h-2.25a.75.75 0 0 0 0 1.5h3Z",clipRule:"evenodd"})}),sF=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M17.75 16.688a.75.75 0 0 1-1.5 0V6.123l-3.22 3.22a.75.75 0 1 1-1.06-1.06l4.5-4.5a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1-1.06 1.06l-3.22-3.22v10.564Zm-10-9.375a.75.75 0 0 0-1.5 0v10.564l-3.22-3.22a.75.75 0 0 0-1.06 1.06l4.5 4.5a.75.75 0 0 0 1.06 0l4.5-4.5a.75.75 0 1 0-1.06-1.06l-3.22 3.22V7.313Z",clipRule:"evenodd"})}),sN=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M9.05 6a.75.75 0 1 0-1.5 0v10.19l-2.72-2.72a.75.75 0 0 0-1.06 1.06l4 4a.75.75 0 0 0 1.06 0l4-4a.75.75 0 1 0-1.06-1.06l-2.72 2.72V6Zm4.95.75h6a.75.75 0 0 0 0-1.5h-6a.75.75 0 0 0 0 1.5Zm1 4a.75.75 0 0 0 0 1.5h5a.75.75 0 0 0 0-1.5h-5Zm5 7h-4a.75.75 0 0 1 0-1.5h4a.75.75 0 0 1 0 1.5Z",clipRule:"evenodd"})}),sq=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14 6.75h6a.75.75 0 0 0 0-1.5h-6a.75.75 0 0 0 0 1.5Zm1 4a.75.75 0 0 0 0 1.5h5a.75.75 0 0 0 0-1.5h-5Zm5 7h-4a.75.75 0 0 1 0-1.5h4a.75.75 0 0 1 0 1.5ZM9.05 18a.75.75 0 0 1-1.5 0V7.81l-2.72 2.72a.75.75 0 1 1-1.06-1.06l4-4a.75.75 0 0 1 1.06 0l4 4a.75.75 0 1 1-1.06 1.06L9.05 7.81V18Z",clipRule:"evenodd"})}),sU=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5.75 4A1.75 1.75 0 0 0 4 5.75v12c0 .966.784 1.75 1.75 1.75h12a1.75 1.75 0 0 0 1.75-1.75v-12A1.75 1.75 0 0 0 17.75 4h-12ZM11 5.5H5.75a.25.25 0 0 0-.25.25v12c0 .138.112.25.25.25H11V5.5ZM12.5 18V5.5h5.25a.25.25 0 0 1 .25.25v12a.25.25 0 0 1-.25.25H12.5Z",clipRule:"evenodd"})}),sW=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 3.25h17.5v17.5H3.25V3.25Zm1.5 1.5v14.5h14.5V4.75H4.75Z",clipRule:"evenodd"})}),sG=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M19.218 12.75a.75.75 0 0 0 .559-.245l2.277-2.5a.75.75 0 1 0-1.108-1.01l-.974 1.068V5a1.75 1.75 0 0 0-1.75-1.75H12a.75.75 0 0 0 0 1.5h6.222a.25.25 0 0 1 .25.25v5.027l-.911-1.025a.75.75 0 0 0-1.122.996l2.223 2.5a.75.75 0 0 0 .556.252Zm-14.936-1.5a.75.75 0 0 0-.559.245l-2.277 2.5a.75.75 0 1 0 1.108 1.01l.974-1.068V19c0 .966.783 1.75 1.75 1.75H11.5a.75.75 0 0 0 0-1.5H5.278a.25.25 0 0 1-.25-.25v-5.027l.911 1.025a.75.75 0 0 0 1.122-.996l-2.223-2.5a.75.75 0 0 0-.556-.252ZM13.25 9a.75.75 0 0 0-.987-.712l-1.5.5a.75.75 0 0 0 .474 1.423l.513-.17v4.209H10.5a.75.75 0 0 0 0 1.5h4a.75.75 0 0 0 0-1.5h-1.25V9Z",clipRule:"evenodd"})}),sY=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.25 12a.75.75 0 0 1 .75-.75h18a.75.75 0 0 1 0 1.5H3a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"})}),sK=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7.53 7.47a.75.75 0 0 1 0 1.06l-2.72 2.72H21a.75.75 0 0 1 0 1.5H4.81l2.72 2.72a.75.75 0 1 1-1.06 1.06l-4-4a.75.75 0 0 1 0-1.06l4-4a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})}),sX=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M6 8.25a3.75 3.75 0 1 0 3.675 4.5H21a.75.75 0 0 0 0-1.5H9.675A3.751 3.751 0 0 0 6 8.25Z"})}),sQ=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5.47 8.47a.75.75 0 0 1 1.06 0l2.78 2.78H21a.75.75 0 0 1 0 1.5H9.31l-2.78 2.78a.75.75 0 0 1-1.06 0l-3-3a.75.75 0 0 1 0-1.06l3-3Z",clipRule:"evenodd"})}),sJ=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M7.75 8a.75.75 0 0 0-1.28-.53l-4 4a.75.75 0 0 0 0 1.06l4 4A.75.75 0 0 0 7.75 16v-3.25H21a.75.75 0 0 0 0-1.5H7.75V8Z"})}),s1=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 3.75a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5ZM2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12ZM10 8.25a.75.75 0 0 1 .75.75v6a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75Zm4.75.75a.75.75 0 0 0-1.5 0v6a.75.75 0 0 0 1.5 0V9Z",clipRule:"evenodd"})}),s0=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.5 12a8.5 8.5 0 1 1-17 0 8.5 8.5 0 0 1 17 0Zm1.5 0c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10ZM10 8a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-4Z",clipRule:"evenodd"})}),s2=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.53 3.47a.75.75 0 0 1 0 1.06l-16 16a.75.75 0 0 1-1.06-1.06l16-16a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})}),s5=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.406 7.464a3.468 3.468 0 0 1 6.59-1.513.77.77 0 0 0 1.385-.673 5.009 5.009 0 0 0-9.05 4.3h1.793a3.453 3.453 0 0 1-.718-2.114Zm6.512 8.476c0-.795-.268-1.528-.718-2.113h1.792a5.008 5.008 0 0 1-9.05 4.299.77.77 0 1 1 1.387-.673 3.468 3.468 0 0 0 6.589-1.513ZM4.297 10.905a.797.797 0 0 0 0 1.594h15.406a.797.797 0 0 0 0-1.594H4.297Z",clipRule:"evenodd"})}),s7=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.25 5.45c0-1.204.964-2.2 2.178-2.2h11.144c1.214 0 2.178.996 2.178 2.2v5.394c0 1.478-.84 2.83-2.166 3.468l-1.842.884a1.274 1.274 0 0 0-.683 1.41l.054.26c.414 1.987-1.077 3.884-3.113 3.884s-3.527-1.897-3.113-3.884l.054-.26a1.273 1.273 0 0 0-.683-1.41l-1.842-.884a3.842 3.842 0 0 1-2.166-3.468V5.45Zm1.503 5.522a2.339 2.339 0 0 0 1.313 1.988l1.841.883a2.773 2.773 0 0 1 1.503 3.068l-.055.26c-.226 1.085.59 2.079 1.645 2.079 1.055 0 1.87-.994 1.645-2.079l-.055-.26a2.773 2.773 0 0 1 1.503-3.068l1.841-.883a2.339 2.339 0 0 0 1.313-1.988H5.753Zm12.497-1.5H5.75V5.45c0-.398.314-.7.678-.7h2.197v2.806a.75.75 0 0 0 1.5 0V4.75h3.75v1.917a.75.75 0 0 0 1.5 0V4.75h2.197a.69.69 0 0 1 .678.7v4.022Z",clipRule:"evenodd"})}),s3=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.47 3.47a.75.75 0 0 0 0 1.06l16 16a.75.75 0 1 0 1.06-1.06l-16-16a.75.75 0 0 0-1.06 0Z",clipRule:"evenodd"})}),s4=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.27 3.831a.75.75 0 0 1 .899-.562c6.615 1.527 12.546 4.893 15.306 7.15.361.296.66.6.846.919.195.335.305.77.11 1.21-.176.393-.523.617-.807.75-.3.142-.659.242-1.032.319-.75.155-1.715.25-2.739.336l-.756.063c-.817.066-1.667.135-2.514.23-2.243.249-4.034.569-5.13.952-.443.155-.694.295-.82.39.41.486 1.095.97 1.966 1.428.891.468 1.915.875 2.895 1.212a36.166 36.166 0 0 0 3.59 1.023l.056.012.014.003h.003a.75.75 0 0 1-.314 1.467L15 20l-.157.733h-.002l-.005-.001-.017-.004-.062-.014a29.09 29.09 0 0 1-1.072-.262c-.7-.183-1.656-.454-2.679-.805-1.02-.35-2.121-.787-3.105-1.303-.97-.51-1.89-1.13-2.487-1.876-.188-.235-.339-.535-.343-.888a1.34 1.34 0 0 1 .337-.889c.352-.414.94-.696 1.55-.909 1.266-.443 3.202-.777 5.46-1.027a87.805 87.805 0 0 1 2.572-.236l.737-.06c1.034-.088 1.913-.177 2.56-.31.288-.06.5-.123.645-.184a3.163 3.163 0 0 0-.407-.384c-2.587-2.117-8.31-5.377-14.694-6.85a.75.75 0 0 1-.562-.9Z",clipRule:"evenodd"})}),s6=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.354 11.25a2.751 2.751 0 0 1 2.646-2h5a2.75 2.75 0 1 1 0 5.5h-5a2.751 2.751 0 0 1-2.646-2H2a.75.75 0 0 1 0-1.5h8.354Zm2.646-.5a1.25 1.25 0 1 0 0 2.5h5a1.25 1.25 0 1 0 0-2.5h-5Z",clipRule:"evenodd"})}),s8=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",d:"M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z",opacity:.14}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm14.678-3.735a1 1 0 0 1 .057 1.413l-5.539 6a1 1 0 0 1-1.47 0l-2.46-2.666a1 1 0 1 1 1.469-1.357l1.726 1.87 4.804-5.203a1 1 0 0 1 1.413-.057Z",clipRule:"evenodd"})]}),s9=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.5 5c.064 0 .117.048.124.11.046.405.169.7.368.902.198.202.486.327.894.363a.125.125 0 0 1 0 .25c-.401.034-.696.16-.899.362-.203.203-.328.498-.363.899a.125.125 0 0 1-.248 0c-.037-.408-.162-.696-.364-.894-.203-.2-.497-.322-.901-.368a.125.125 0 0 1 0-.248c.41-.048.699-.17.897-.368.198-.198.32-.487.368-.897A.125.125 0 0 1 11.5 5ZM8.073 6.244a.275.275 0 0 0-.546 0c-.104.903-.374 1.538-.81 1.973-.435.436-1.07.706-1.974.81a.275.275 0 0 0 .001.546c.888.1 1.537.37 1.983.809.444.436.72 1.07.8 1.967a.275.275 0 0 0 .547 0c.076-.882.352-1.53.798-1.977.447-.446 1.095-.722 1.977-.798a.275.275 0 0 0 0-.548c-.896-.08-1.531-.355-1.967-.8-.438-.445-.708-1.094-.809-1.982Zm6.427.506a.75.75 0 0 0 0 1.5H19a.75.75 0 0 0 0-1.5h-4.5Zm-1.5 3.5a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5h-6ZM4.25 14.5a.75.75 0 0 1 .75-.75h14a.75.75 0 0 1 0 1.5H5a.75.75 0 0 1-.75-.75ZM5 17.25a.75.75 0 0 0 0 1.5h14a.75.75 0 0 0 0-1.5H5Z",clipRule:"evenodd"})}),oe=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.564 7.467a3.017 3.017 0 0 1 2.903-2.903l4.606-.17c.323-.013.636.11.864.338l6.647 6.648a1.16 1.16 0 0 1 0 1.64l-6.563 6.564a1.16 1.16 0 0 1-1.641 0l-6.648-6.647a1.16 1.16 0 0 1-.339-.864l.17-4.606Zm2.851-4.295a4.41 4.41 0 0 0-4.243 4.243l-.17 4.607c-.027.71.244 1.397.746 1.9l6.647 6.647a2.553 2.553 0 0 0 3.61 0l6.564-6.564a2.553 2.553 0 0 0 0-3.61L13.92 3.748a2.553 2.553 0 0 0-1.9-.746l-4.606.17Zm.847 5.09A.928.928 0 1 0 6.95 6.95a.928.928 0 0 0 1.313 1.313Z",clipRule:"evenodd"})}),ot=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.263 2.48a.735.735 0 0 0 .054 1.47l4.276-.159c.34-.012.67.117.911.358l6.307 6.307a.735.735 0 1 0 1.039-1.04L14.543 3.11a2.694 2.694 0 0 0-2.005-.788l-4.275.159Zm-.536 4.242a3.185 3.185 0 0 0-3.065 3.065l-.126 3.41c-.013.34.117.67.358.91l5.618 5.619a1.225 1.225 0 0 0 1.732 0l5.422-5.422a1.225 1.225 0 0 0 0-1.732l-5.618-5.618c-.241-.241-.572-.37-.912-.358l-3.41.126Zm-4.534 3.01a4.654 4.654 0 0 1 4.48-4.479l3.409-.126a2.695 2.695 0 0 1 2.005.788l5.618 5.617a2.695 2.695 0 0 1 0 3.811l-5.422 5.422a2.695 2.695 0 0 1-3.81 0l-5.619-5.618a2.694 2.694 0 0 1-.787-2.005l.126-3.41Zm4.673-.976a.828.828 0 1 1-1.17 1.17.828.828 0 0 1 1.17-1.17Z",clipRule:"evenodd"})}),oi=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",d:"M12 2a9.999 9.999 0 0 0-7.07 17.071A9.999 9.999 0 1 0 19.07 4.93 9.999 9.999 0 0 0 12 2Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"M6.527 11.894c2.915-1.27 4.86-2.107 5.83-2.511 2.78-1.156 3.356-1.356 3.732-1.363.083-.001.267.02.388.116a.43.43 0 0 1 .142.271c.012.078.03.255.015.394-.15 1.581-.801 5.418-1.132 7.19-.14.749-.416 1-.683 1.024-.581.054-1.022-.383-1.585-.752-.88-.577-1.376-.936-2.23-1.499-.988-.65-.348-1.008.215-1.593.147-.153 2.706-2.48 2.755-2.691.006-.026.012-.125-.047-.177-.058-.052-.144-.034-.207-.02-.089.02-1.493.95-4.218 2.788-.399.274-.76.408-1.085.4-.356-.007-1.043-.201-1.554-.367-.625-.204-1.124-.311-1.08-.657.022-.18.27-.364.744-.553Z"})]}),os=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 4A.75.75 0 0 1 4 3.25h16a.75.75 0 0 1 .75.75v2.667a.75.75 0 0 1-1.5 0V4.75h-6.5v14.5H16a.75.75 0 0 1 0 1.5H8a.75.75 0 0 1 0-1.5h3.25V4.75h-6.5v1.917a.75.75 0 0 1-1.5 0V4Z",clipRule:"evenodd"})}),oo=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.75 6a.75.75 0 0 1 .75-.75h15a.75.75 0 0 1 0 1.5h-15A.75.75 0 0 1 3.75 6Zm3.5 6a.75.75 0 0 1 .75-.75h8a.75.75 0 0 1 0 1.5H8a.75.75 0 0 1-.75-.75ZM6 17.25a.75.75 0 0 0 0 1.5h12a.75.75 0 0 0 0-1.5H6Z",clipRule:"evenodd"})}),or=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M20.75 6a.75.75 0 0 0-.75-.75H5a.75.75 0 0 0 0 1.5h15a.75.75 0 0 0 .75-.75Zm-7 6a.75.75 0 0 0-.75-.75H5a.75.75 0 0 0 0 1.5h8a.75.75 0 0 0 .75-.75Zm3 6a.75.75 0 0 0-.75-.75H5a.75.75 0 0 0 0 1.5h11a.75.75 0 0 0 .75-.75Z",clipRule:"evenodd"})}),oa=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M4.25 6A.75.75 0 0 1 5 5.25h15a.75.75 0 0 1 0 1.5H5A.75.75 0 0 1 4.25 6Zm7 6a.75.75 0 0 1 .75-.75h8a.75.75 0 0 1 0 1.5h-8a.75.75 0 0 1-.75-.75Zm-3 6a.75.75 0 0 1 .75-.75h11a.75.75 0 0 1 0 1.5H9a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"})}),on=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.15 5.5A2.35 2.35 0 0 1 5.5 3.15h13a2.35 2.35 0 0 1 2.35 2.35v13a2.35 2.35 0 0 1-2.35 2.35h-13a2.35 2.35 0 0 1-2.35-2.35v-13Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillOpacity:.3,fillRule:"evenodd",d:"M3.15 5.5A2.35 2.35 0 0 1 5.5 3.15h13a2.35 2.35 0 0 1 2.35 2.35v13a2.35 2.35 0 0 1-2.35 2.35h-13a2.35 2.35 0 0 1-2.35-2.35v-13ZM5.5 3.85A1.65 1.65 0 0 0 3.85 5.5v13c0 .911.739 1.65 1.65 1.65h13a1.65 1.65 0 0 0 1.65-1.65v-13a1.65 1.65 0 0 0-1.65-1.65h-13Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.622 7.505a1.471 1.471 0 0 1 2.756 0l3.324 8.865a.75.75 0 0 1-1.404.527l-.94-2.505H9.642l-.94 2.505a.75.75 0 0 1-1.404-.527l3.324-8.865Zm-.418 5.387h3.592L12 8.102l-1.796 4.79Z",clipRule:"evenodd"})]}),ol=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M10.453 4.622a1.652 1.652 0 0 1 3.094 0l4.155 11.081a.75.75 0 0 1-1.404.527l-1.22-3.253H8.922l-1.22 3.253a.75.75 0 0 1-1.404-.527l4.155-11.081Zm-.969 6.855h5.031L12.142 5.15a.152.152 0 0 0-.284 0l-2.374 6.328Z",clipRule:"evenodd"}),(0,s.jsx)("rect",{width:16,height:2.5,x:4,y:18,fill:"currentColor",rx:1})]}),oc=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.667 4.707c-.73 0-1.381.461-1.622 1.15l-2.286 6.531-.329.94-1.325 3.786a.886.886 0 0 0 1.673.585l1.117-3.193h5.543l1.118 3.193a.886.886 0 0 0 1.672-.585l-1.325-3.787-.329-.939-2.285-6.53a1.718 1.718 0 0 0-1.622-1.151Zm0 1.88 2.151 6.147H6.515l2.152-6.147Zm4.363-1.67a.805.805 0 1 0 0 1.61h7.22a.805.805 0 0 0 0-1.61h-7.22Zm1.805 5.886a.806.806 0 0 0 0 1.611h5.415a.806.806 0 0 0 0-1.61h-5.415Zm.398 6.693c0-.445.36-.805.805-.805h4.212a.805.805 0 1 1 0 1.61h-4.212a.805.805 0 0 1-.805-.805Z",clipRule:"evenodd"})}),od=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7.25 7A2.75 2.75 0 0 1 10 4.25h3a.75.75 0 0 1 0 1.5h-3c-.69 0-1.25.56-1.25 1.25v4.25h6.5V7A2.75 2.75 0 0 1 18 4.25h3a.75.75 0 0 1 0 1.5h-3c-.69 0-1.25.56-1.25 1.25v4.25H21a.75.75 0 0 1 0 1.5h-7.25V17c0 .69.56 1.25 1.25 1.25h3a.75.75 0 0 1 0 1.5h-3A2.75 2.75 0 0 1 12.25 17v-4.25H3a.75.75 0 0 1 0-1.5h4.25V7Z",clipRule:"evenodd"})}),oh=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.84 5.25a.75.75 0 0 0-.75.75v2a.75.75 0 0 0 1.5 0V6.75H7v10.5H5.023a.75.75 0 0 0 0 1.5h5.454a.75.75 0 1 0 0-1.5H8.5V6.75h3.41V8a.75.75 0 0 0 1.5 0V6a.75.75 0 0 0-.75-.75H2.84Zm12.764 0a.75.75 0 0 0 0 1.5h5.455a.75.75 0 1 0 0-1.5h-5.455Zm-.75 6.75a.75.75 0 0 1 .75-.75h5.455a.75.75 0 1 1 0 1.5h-5.455a.75.75 0 0 1-.75-.75Zm.75 5.25a.75.75 0 0 0 0 1.5h5.455a.75.75 0 1 0 0-1.5h-5.455Z",clipRule:"evenodd"})}),ou=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 6A.75.75 0 0 1 4 5.25h13a.75.75 0 0 1 0 1.5H4A.75.75 0 0 1 3.25 6ZM3.25 12a.75.75 0 0 1 .75-.75h13a.75.75 0 0 1 0 1.5H4a.75.75 0 0 1-.75-.75ZM3.25 18a.75.75 0 0 1 .75-.75h13a.75.75 0 0 1 0 1.5H4a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",d:"M20.8 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM20.8 18a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM20.8 6a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"})]}),op=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.205 2.787c.393 0 .712.319.712.712v.711h6.166V3.5a.712.712 0 0 1 1.423 0v.711h2.135a2.609 2.609 0 0 1 2.609 2.61v11.384a2.609 2.609 0 0 1-2.609 2.609H5.359a2.609 2.609 0 0 1-2.609-2.61V6.82A2.609 2.609 0 0 1 5.359 4.21h2.135V3.5c0-.393.318-.712.711-.712Zm6.878 2.846v.712a.712.712 0 0 0 1.423 0v-.712h2.135c.655 0 1.186.531 1.186 1.186v1.66H4.173V6.82c0-.655.531-1.186 1.186-1.186h2.135v.712a.712.712 0 1 0 1.423 0v-.712h6.166Zm4.744 4.27H4.173v8.3c0 .656.531 1.187 1.186 1.187h13.282c.655 0 1.186-.531 1.186-1.186V9.903Zm-12.57 1.47a.474.474 0 0 0-.475.475v1.423c0 .262.212.474.474.474H8.68a.474.474 0 0 0 .475-.474v-1.424a.474.474 0 0 0-.475-.474H7.256Zm-.475 4.174c0-.261.212-.474.474-.474H8.68c.262 0 .475.213.475.474v1.424a.474.474 0 0 1-.475.474H7.256a.474.474 0 0 1-.474-.474v-1.424Zm4.459-4.174a.474.474 0 0 0-.474.475v1.423c0 .262.212.474.474.474h1.423a.474.474 0 0 0 .475-.474v-1.424a.474.474 0 0 0-.475-.474h-1.423Zm-.474 4.174c0-.261.212-.474.474-.474h1.423c.262 0 .475.213.475.474v1.424a.474.474 0 0 1-.475.474h-1.423a.474.474 0 0 1-.474-.474v-1.424Zm4.553-4.174a.474.474 0 0 0-.474.475v1.423c0 .262.213.474.474.474h1.424a.474.474 0 0 0 .474-.474v-1.424a.474.474 0 0 0-.474-.474H15.32Z",clipRule:"evenodd"})}),of=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M15.632 11.35a.757.757 0 0 1 0 1.3l-5.527 3.248c-.491.29-1.105-.072-1.105-.65V8.752c0-.577.614-.938 1.105-.65l5.527 3.25Z"})}),og=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M13.15 15.132a.757.757 0 0 1-1.3 0L8.602 9.605c-.29-.491.072-1.105.65-1.105h6.497c.577 0 .938.614.65 1.105l-3.25 5.527Z"})}),om=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.42 3.205a.68.68 0 0 1 .68.68v.68h5.888v-.68a.68.68 0 1 1 1.358 0v.68h2.039a2.491 2.491 0 0 1 2.491 2.49V12.49a.68.68 0 1 1-1.359 0V10H4.57v7.926c0 .626.507 1.133 1.132 1.133h5.888a.68.68 0 0 1 0 1.359H5.702a2.491 2.491 0 0 1-2.491-2.492V7.055a2.491 2.491 0 0 1 2.49-2.49h2.04v-.68a.68.68 0 0 1 .679-.68Zm6.568 2.718v.68a.68.68 0 1 0 1.358 0v-.68h2.039c.625 0 1.132.507 1.132 1.132v1.586H4.57V7.055c0-.625.507-1.132 1.132-1.132H7.74v.68a.68.68 0 1 0 1.36 0v-.68h5.888Zm3.641 10.672a.68.68 0 1 1 .96-.96l1.923 1.92a.68.68 0 0 1 0 .962l-1.922 1.921a.68.68 0 1 1-.96-.96l1.44-1.442-1.44-1.441Zm-4.238-.96a.68.68 0 0 0 0 .96l1.44 1.441-1.44 1.442a.68.68 0 1 0 .96.96l1.922-1.921a.68.68 0 0 0 0-.961l-1.921-1.922a.68.68 0 0 0-.961 0Z",clipRule:"evenodd"})}),ov=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"m9.17 8.506-1.112 2.877a.85.85 0 0 1-.793.544H4a.75.75 0 0 1 0-1.5h2.82l1.699-4.4c.3-.776 1.422-.703 1.618.107l1.96 8.08 1.797-5.67a.85.85 0 0 1 1.483-.263l1.658 2.146H20a.75.75 0 0 1 0 1.5h-3.284a.85.85 0 0 1-.673-.33L14.95 10.18l-2.126 6.705c-.26.82-1.434.78-1.636-.056L9.169 8.506Z",clipRule:"evenodd"})}),oy=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"m12 2.5 9.96 17.25H2.04L12 2.5Zm0 3L4.639 18.25H19.36L12 5.5Z",clipRule:"evenodd"})}),ob=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M17.463 3.4h2.914l-6.365 7.275 7.488 9.899h-5.863l-4.592-6.004-5.255 6.004H2.875l6.809-7.783L2.5 3.401h6.012l4.15 5.488L17.464 3.4Zm-1.022 15.43h1.614L7.635 5.052H5.903L16.44 18.83Z"})}),ow=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M7.744 3.968a.808.808 0 1 0-1.616 0v7.003a5.656 5.656 0 0 0 11.313 0V3.968a.808.808 0 1 0-1.616 0v7.003a4.04 4.04 0 1 1-8.08 0V3.968ZM4.458 19.32a.808.808 0 1 0 0 1.616h15.084a.808.808 0 0 0 0-1.616H4.458Z",clipRule:"evenodd"})}),ox=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.53 4.47a.75.75 0 0 1 0 1.06L5.81 8.25h4.624c1.651 0 2.937 0 3.968.084 1.047.086 1.897.262 2.662.652a6.75 6.75 0 0 1 2.95 2.95c.39.765.566 1.615.652 2.662.084 1.031.084 2.317.084 3.968v.034a.75.75 0 0 1-1.5 0c0-1.693 0-2.917-.08-3.88-.077-.954-.228-1.585-.492-2.104a5.25 5.25 0 0 0-2.295-2.294c-.518-.264-1.15-.415-2.103-.493-.963-.078-2.188-.079-3.88-.079H5.81l2.72 2.72a.75.75 0 1 1-1.06 1.06l-4-4a.75.75 0 0 1 0-1.06l4-4a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"})}),o_=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5.286 4.75c-.346 0-.536.25-.536.45v3.6c0 .2.19.45.536.45h6.428c.346 0 .536-.25.536-.45V5.2c0-.2-.19-.45-.536-.45H5.286ZM3.25 5.2c0-1.125.961-1.95 2.036-1.95h6.428c1.075 0 2.036.825 2.036 1.95v3.6c0 1.125-.961 1.95-2.036 1.95H5.286c-1.075 0-2.036-.825-2.036-1.95V5.2ZM12.286 14.75c-.346 0-.536.25-.536.45v3.6c0 .2.19.45.536.45h6.428c.346 0 .536-.25.536-.45v-3.6c0-.2-.19-.45-.536-.45h-6.428Zm-2.036.45c0-1.125.961-1.95 2.036-1.95h6.428c1.075 0 2.036.825 2.036 1.95v3.6c0 1.125-.961 1.95-2.036 1.95h-6.428c-1.075 0-2.036-.825-2.036-1.95v-3.6Z",clipRule:"evenodd"})}),oC=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M14.522 5.35a2.919 2.919 0 1 1 4.128 4.128l-3.669 3.669a.75.75 0 1 0 1.06 1.06l3.67-3.669a4.419 4.419 0 1 0-6.25-6.249l-1.008 1.009a.75.75 0 1 0 1.06 1.06l1.009-1.008Zm-5.503 5.503a.75.75 0 0 0-1.061-1.06L4.289 13.46a4.419 4.419 0 1 0 6.25 6.25l1.01-1.01a.75.75 0 1 0-1.06-1.061l-1.011 1.01a2.919 2.919 0 0 1-4.128-4.128l3.669-3.669Zm.376-6.36a.75.75 0 1 0-1.461.338l.4 1.734a.75.75 0 1 0 1.462-.337l-.4-1.734Zm-4.564 3.44a.75.75 0 1 0-.337 1.462l1.734.4a.75.75 0 1 0 .337-1.46l-1.734-.401Zm12.941 6.271a.75.75 0 0 0-.337 1.462l1.734.4a.75.75 0 1 0 .337-1.461l-1.734-.4Zm-2.106 3.23a.75.75 0 1 0-1.462.338l.4 1.734a.75.75 0 0 0 1.462-.337l-.4-1.734Z",clipRule:"evenodd"})}),ok=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.25 8a5.75 5.75 0 0 1 11.021-2.3.75.75 0 1 1-1.374.6A4.251 4.251 0 0 0 7.75 8v1.254c.31-.004.652-.004 1.027-.004h6.446c.728 0 1.328 0 1.823.03.626.038 1.164.128 1.657.379a3.75 3.75 0 0 1 1.638 1.638c.227.445.321.925.366 1.471.043.531.043 1.187.043 2v1.464c0 .813 0 1.469-.043 2-.045.546-.14 1.026-.366 1.47a3.75 3.75 0 0 1-1.639 1.64c-.444.226-.924.32-1.47.365-.531.043-1.187.043-2 .043H8.768c-.813 0-1.469 0-2-.043-.546-.045-1.026-.14-1.47-.366a3.75 3.75 0 0 1-1.64-1.639c-.226-.444-.32-.924-.365-1.47-.043-.531-.043-1.187-.043-2v-1.464c0-.813 0-1.469.043-2 .045-.546.14-1.026.366-1.47a3.75 3.75 0 0 1 1.639-1.64c.297-.15.612-.244.952-.302V8Zm2.55 2.75c-.756 0-1.31 0-1.754.027-.551.034-.847.106-1.067.218a2.25 2.25 0 0 0-.984.984c-.1.197-.17.458-.207.912-.037.462-.038 1.056-.038 1.909v1.4c0 .852 0 1.447.038 1.91.037.453.107.714.207.912.216.423.56.767.984.983.197.1.458.17.912.207.462.037 1.057.038 1.909.038h6.4c.852 0 1.447 0 1.91-.038.453-.038.714-.107.912-.207.423-.216.767-.56.983-.983.1-.198.17-.459.207-.913.037-.462.038-1.057.038-1.909v-1.4c0-.853 0-1.447-.038-1.91-.038-.453-.107-.714-.207-.912a2.252 2.252 0 0 0-.983-.983c-.22-.112-.517-.184-1.068-.218a31.52 31.52 0 0 0-1.754-.027H8.8Zm3.2 3a.75.75 0 0 1 .75.75v2a.75.75 0 0 1-1.5 0v-2a.75.75 0 0 1 .75-.75Z",clipRule:"evenodd"})}),oS=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("g",{clipPath:"url(#a)",children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M13.591 3.692a2.75 2.75 0 0 1 3.89 0l2.827 2.828a2.75 2.75 0 0 1 0 3.889l-1.06 1.06a.75.75 0 1 1-1.06-1.06l1.06-1.06a1.25 1.25 0 0 0 0-1.768l-2.829-2.829a1.25 1.25 0 0 0-1.767 0l-1.061 1.06a.75.75 0 0 1-1.06-1.06l1.06-1.06Zm-6.364-.708a.75.75 0 0 1 1.06 0l12.729 12.728a.75.75 0 0 1-1.061 1.061l-3.005-3.005-1.97 1.97.884.884a.75.75 0 1 1-1.06 1.06L11.09 13.97l-4.925 4.924a.75.75 0 1 1-1.06-1.06l4.924-4.925-3.712-3.712a.75.75 0 0 1 1.06-1.06l.884.883 1.97-1.97-3.005-3.005a.75.75 0 0 1 0-1.06Zm4.066 5.127-1.97 1.97 4.596 4.596 1.97-1.97-4.596-4.596Z",clipRule:"evenodd"})}),(0,s.jsx)("defs",{children:(0,s.jsx)("clipPath",{id:"a",children:(0,s.jsx)("path",{fill:"currentColor",d:"M0 0H24V24H0z"})})})]}),oM=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",d:"M2 12a5 5 0 0 1 5-5h2a5 5 0 0 1 0 10H7a5 5 0 0 1-5-5Z",opacity:.14}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.293 2.293a1 1 0 0 1 1.414 0l4 4 14 14a1 1 0 0 1-1.414 1.414L16.586 18H16.5a1 1 0 0 1-.997-1.082l-1.542-1.543A5.993 5.993 0 0 1 9 18H7A6 6 0 0 1 4.946 6.36L2.293 3.708a1 1 0 0 1 0-1.414Zm4.312 5.726A4 4 0 0 0 7 16h2a4 4 0 0 0 3.509-2.077l-1.572-1.572A1 1 0 0 1 9 12c0-.487.058-.962.169-1.417L6.605 8.019ZM15 8c-.556 0-1.084.113-1.563.316a1 1 0 1 1-.782-1.84A5.984 5.984 0 0 1 15 6h2a6 6 0 0 1 4.615 9.835 1 1 0 0 1-1.538-1.279A4 4 0 0 0 17 8h-2Z",clipRule:"evenodd"})]}),oE=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11 5.75a4.25 4.25 0 0 0-4.147 5.183.75.75 0 0 1-.568.896A3.252 3.252 0 0 0 7 18.25h9a4.25 4.25 0 1 0-.085-8.5.75.75 0 0 1-.75-.6A4.252 4.252 0 0 0 11 5.75ZM5.25 10a5.75 5.75 0 0 1 11.235-1.73A5.75 5.75 0 0 1 16 19.75H7a4.75 4.75 0 0 1-1.722-9.178A5.808 5.808 0 0 1 5.25 10Zm6.45-.75a.75.75 0 0 1 .75.75v3a.75.75 0 0 1-1.5 0v-3a.75.75 0 0 1 .75-.75Zm.05 7.25a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",clipRule:"evenodd"})}),oI=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8 2.75a.75.75 0 0 1 .75.75v.75h6.5V3.5a.75.75 0 0 1 1.5 0v.75H19A2.75 2.75 0 0 1 21.75 7v5a.75.75 0 0 1-1.5 0v-1.75H3.75V19c0 .69.56 1.25 1.25 1.25h7a.75.75 0 0 1 0 1.5H5A2.75 2.75 0 0 1 2.25 19V7A2.75 2.75 0 0 1 5 4.25h2.25V3.5A.75.75 0 0 1 8 2.75Zm7.25 3v.75a.75.75 0 0 0 1.5 0v-.75H19c.69 0 1.25.56 1.25 1.25v1.75H3.75V7c0-.69.56-1.25 1.25-1.25h2.25v.75a.75.75 0 0 0 1.5 0v-.75h6.5Zm.184 9.842a3.03 3.03 0 0 1 5.253 1.188.75.75 0 0 0 1.453-.373 4.53 4.53 0 0 0-8.128-1.418l-.596-.252a.3.3 0 0 0-.41.337l.483 2.329a.3.3 0 0 0 .454.193l2.01-1.272a.3.3 0 0 0-.043-.53l-.476-.202Zm2.1 5.415c.931 0 1.765-.42 2.32-1.082l-.476-.201a.3.3 0 0 1-.043-.53l2.01-1.272a.3.3 0 0 1 .454.193l.485 2.329a.3.3 0 0 1-.411.337l-.596-.252a4.523 4.523 0 0 1-3.743 1.979 4.525 4.525 0 0 1-4.385-3.397.75.75 0 0 1 1.453-.374 3.025 3.025 0 0 0 2.933 2.27Z",clipRule:"evenodd"})}),oB=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12ZM12 3.75a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5Zm-4.621 7.72 4.09-4.091a.75.75 0 0 1 1.061 0l4.091 4.09a.75.75 0 1 1-1.06 1.061L12.75 9.72v6.78a.75.75 0 0 1-1.5 0V9.72l-2.81 2.81a.75.75 0 0 1-1.061-1.06Z",clipRule:"evenodd"})}),o$=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M5 10.75a.25.25 0 0 0-.25.25v7c0 .69.56 1.25 1.25 1.25h12c.69 0 1.25-.56 1.25-1.25v-7a.25.25 0 0 0-.25-.25h-1a.75.75 0 0 1 0-1.5h1c.966 0 1.75.784 1.75 1.75v7A2.75 2.75 0 0 1 18 20.75H6A2.75 2.75 0 0 1 3.25 18v-7c0-.966.784-1.75 1.75-1.75h1a.75.75 0 0 1 0 1.5H5Z",clipRule:"evenodd"}),(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 2.75a.75.75 0 0 1 .53.22l4 4a.75.75 0 0 1-1.06 1.06l-2.72-2.72V15.5a.75.75 0 0 1-1.5 0V5.31L8.53 8.03a.75.75 0 0 1-1.06-1.06l4-4a.75.75 0 0 1 .53-.22Z",clipRule:"evenodd"})]}),oT=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.75 6.672v11.326c1.102-.479 2.388-.748 3.75-.748s2.648.27 3.75.748V6.672c-.997-.567-2.302-.922-3.75-.922s-2.753.355-3.75.922Zm9 0v11.326c1.102-.479 2.388-.748 3.75-.748s2.648.27 3.75.748V6.672c-.997-.567-2.302-.922-3.75-.922s-2.753.355-3.75.922Zm-.75-1.3c-1.247-.71-2.816-1.122-4.5-1.122-1.877 0-3.61.511-4.915 1.378a.75.75 0 0 0-.335.625v13a.75.75 0 0 0 1.165.625c1.031-.686 2.469-1.128 4.085-1.128s3.054.442 4.085 1.128a.75.75 0 0 0 .83 0c1.031-.686 2.469-1.128 4.085-1.128s3.054.442 4.085 1.128a.75.75 0 0 0 1.165-.625v-13a.75.75 0 0 0-.335-.625C20.11 4.761 18.377 4.25 16.5 4.25c-1.684 0-3.253.412-4.5 1.123Z",clipRule:"evenodd"})}),oO=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 5.75a9.254 9.254 0 0 0-8.635 5.926.901.901 0 0 0 0 .648 9.254 9.254 0 0 0 17.27 0 .9.9 0 0 0 0-.648A9.254 9.254 0 0 0 12 5.75ZM1.966 11.137C3.516 7.11 7.424 4.25 12 4.25c4.577 0 8.484 2.86 10.035 6.887.214.555.214 1.17 0 1.726-1.55 4.027-5.458 6.887-10.034 6.887-4.577 0-8.484-2.86-10.035-6.887a2.401 2.401 0 0 1 0-1.726ZM12 9.75a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5ZM8.25 12a3.75 3.75 0 1 1 7.5 0 3.75 3.75 0 0 1-7.5 0Z",clipRule:"evenodd"})}),oP=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.25 20a.75.75 0 0 1-.75-.75V4.75a.75.75 0 0 1 1.5 0v14.5a.75.75 0 0 1-.75.75ZM9.665 8.44a.75.75 0 0 1 .062 1.058L8.17 11.25h7.66l-1.557-1.752a.75.75 0 0 1 1.12-.996l2.668 3a.75.75 0 0 1 0 .996l-2.667 3a.75.75 0 1 1-1.121-.996l1.557-1.752H8.17l1.557 1.752a.75.75 0 0 1-1.12.996l-2.668-3a.75.75 0 0 1 0-.996l2.667-3a.75.75 0 0 1 1.059-.063ZM21.5 4.75a.75.75 0 0 0-1.5 0v14.5a.75.75 0 0 0 1.5 0V4.75Z",clipRule:"evenodd"})}),oH=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M9 4.25a.75.75 0 0 0 0 1.5h6a.75.75 0 0 0 0-1.5H9ZM6.25 8A.75.75 0 0 1 7 7.25h10a.75.75 0 0 1 0 1.5H7A.75.75 0 0 1 6.25 8Zm-2 5A2.75 2.75 0 0 1 7 10.25h10A2.75 2.75 0 0 1 19.75 13v5A2.75 2.75 0 0 1 17 20.75H7A2.75 2.75 0 0 1 4.25 18v-5ZM7 11.75c-.69 0-1.25.56-1.25 1.25v5c0 .69.56 1.25 1.25 1.25h10c.69 0 1.25-.56 1.25-1.25v-5c0-.69-.56-1.25-1.25-1.25H7Z",clipRule:"evenodd"})}),oA=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M12 4.75a7.25 7.25 0 1 0 0 14.5 7.25 7.25 0 0 0 0-14.5ZM3.25 12a8.75 8.75 0 1 1 17.5 0 8.75 8.75 0 0 1-17.5 0ZM12 7.694a.75.75 0 0 1 .75.75V12a.75.75 0 0 1-1.5 0V8.444a.75.75 0 0 1 .75-.75Zm-.75 7.862a.75.75 0 0 1 .75-.75h.009a.75.75 0 1 1 0 1.5H12a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"})}),oL=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M3.784 11.25H8.26c.06-2.25.39-4.298.907-5.851.161-.483.345-.932.552-1.33a8.257 8.257 0 0 0-5.935 7.181Zm8.216-9c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm0 1.5c-.086 0-.287.052-.579.421-.285.362-.574.932-.83 1.702-.459 1.374-.77 3.255-.83 5.377h4.478c-.06-2.122-.371-4.003-.83-5.377-.256-.77-.545-1.34-.83-1.702-.292-.37-.493-.421-.579-.421Zm3.74 7.5c-.06-2.25-.39-4.298-.907-5.851a9.181 9.181 0 0 0-.552-1.33 8.257 8.257 0 0 1 5.935 7.181H15.74Zm-1.5 1.5H9.76c.06 2.122.372 4.003.83 5.377.257.77.546 1.34.831 1.701.292.37.493.422.579.422.086 0 .287-.052.579-.422.285-.361.574-.93.83-1.701.459-1.374.77-3.255.83-5.377Zm.041 7.18c.207-.397.39-.846.552-1.329.518-1.553.847-3.6.907-5.851h4.476a8.257 8.257 0 0 1-5.935 7.18Zm-4.562 0a9.183 9.183 0 0 1-.552-1.329c-.517-1.553-.847-3.6-.907-5.851H3.784a8.257 8.257 0 0 0 5.935 7.18Z",clipRule:"evenodd"})}),oD=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.046 5a.75.75 0 0 1 .75-.75h2.882a6.072 6.072 0 1 1 0 12.144h-8.89l3.027 3.08a.75.75 0 0 1-1.07 1.052l-4.28-4.356a.75.75 0 0 1 0-1.051l4.28-4.356a.75.75 0 1 1 1.07 1.052l-3.026 3.08h8.889a4.572 4.572 0 1 0 0-9.145h-2.882a.75.75 0 0 1-.75-.75Z",clipRule:"evenodd"})}),oZ=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M8.336 3.095c.38 0 .688.308.688.688v.688h5.963v-.688a.688.688 0 1 1 1.376 0v.688h2.064a2.523 2.523 0 0 1 2.522 2.523v5.504a.688.688 0 0 1-1.376 0v-2.43H4.437v7.934c0 .634.513 1.147 1.146 1.147h5.963a.688.688 0 0 1 0 1.376H5.583a2.523 2.523 0 0 1-2.522-2.523V6.994A2.523 2.523 0 0 1 5.583 4.47h2.065v-.688c0-.38.308-.688.688-.688Zm6.65 2.752v.688a.688.688 0 1 0 1.377 0v-.688h2.064c.633 0 1.146.514 1.146 1.147v1.514H4.437V6.994c0-.633.513-1.147 1.146-1.147h2.065v.688a.688.688 0 0 0 1.376 0v-.688h5.963Zm1.68 9.834a.688.688 0 0 1 0 .973l-1.46 1.46 1.46 1.46a.688.688 0 0 1-.973.972L13.745 18.6a.688.688 0 0 1 0-.973l1.947-1.946a.688.688 0 0 1 .973 0Zm4.193.973a.688.688 0 0 0-.973-.973l-1.946 1.946a.688.688 0 0 0 0 .973l1.946 1.946a.688.688 0 0 0 .973-.973l-1.46-1.46 1.46-1.459Z",clipRule:"evenodd"})}),oj=e=>(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:[(0,s.jsx)("path",{fill:"red",d:"M21.08 7.192a2.546 2.546 0 0 0-.616-1.12 2.364 2.364 0 0 0-1.065-.649C17.925 5 11.99 5 11.99 5s-5.934.013-7.408.436c-.403.115-.77.338-1.065.649-.295.31-.508.696-.617 1.12-.446 2.757-.619 6.957.012 9.603.11.423.322.81.617 1.12.295.31.662.534 1.065.649C6.068 19 12.003 19 12.003 19s5.934 0 7.408-.423c.403-.115.77-.338 1.065-.649.295-.31.508-.697.617-1.12.47-2.76.615-6.958-.012-9.616Z"}),(0,s.jsx)("path",{fill:"currentColor",d:"m10 15 5-3-5-3v6Z"})]}),oV=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",d:"M12.546 5v10l8.272-10h-8.273ZM7.136 9.455c2.263 0 4.137-2.281 4.137-4.455H3c0 2.174 1.873 4.455 4.136 4.455ZM12.546 19c0-2.174 1.873-4.454 4.136-4.454s4.136 2.28 4.136 4.454h-8.273ZM11.273 19V9L3 19h8.273Z"})}),oz=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.115 4.885a6.23 6.23 0 1 0 0 12.461 6.23 6.23 0 0 0 0-12.461ZM3.5 11.115a7.615 7.615 0 1 1 13.468 4.874l4.33 4.33a.692.692 0 1 1-.98.978l-4.33-4.33A7.615 7.615 0 0 1 3.5 11.116Zm4.154 0c0-.382.31-.692.692-.692h5.539a.692.692 0 1 1 0 1.385H8.346a.692.692 0 0 1-.692-.693Z",clipRule:"evenodd"})}),oR=e=>(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"1em",height:"1em",fill:"none",style:{userSelect:"none",flexShrink:0},...e,children:(0,s.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.115 4.885a6.23 6.23 0 1 0 4.408 10.634 6.23 6.23 0 0 0-4.408-10.634Zm5.854 11.102a7.615 7.615 0 1 0-.979.98l4.328 4.33a.692.692 0 1 0 .98-.979l-4.329-4.331Zm-5.854-8.333c.383 0 .693.31.693.692v2.077h2.077a.692.692 0 1 1 0 1.385h-2.077v2.077a.692.692 0 1 1-1.385 0v-2.077H8.346a.692.692 0 0 1 0-1.385h2.077V8.346c0-.382.31-.692.692-.692Z",clipRule:"evenodd"})})},1126:(e,t,i)=>{i.d(t,{ug:()=>z,S5:()=>R,JU:()=>D,cI:()=>Z,iy:()=>L,i5:()=>V,C6:()=>f,CX:()=>w,sr:()=>x,lB:()=>k,wB:()=>E,A1:()=>$});var s=i(68419),o=i(73134),r=i(94098),a=i(54702),n=i(96458),l=i(73711),c=i(50620);function d(e,t,i,s){t[e]=t[e]??{},t[e][i]=s}function h(e,t,i){return i?e[t]?.[i]??null:e[t]??{}}function u(e){return e._decoratorState}let p=Symbol("convert");function f(e){return function(t,i){let s=String(i.name);return{init(t){return d(p,Object.getPrototypeOf(this),s,e),t}}}}function g(e,t,i){let s=h(Object.getPrototypeOf(i),p,e);return s?s(t,i):t}let m=Symbol("derive"),v=Object.keys;function y(e,t,i){let s=Object.getPrototypeOf(i),o=u(i.surface);if(o.deriving||o.creating)return null;let r=h(s,m,e);return r?r.reduce((e,s)=>(Object.entries(s(t,i)).forEach(([t,i])=>{e[t]=i}),e),{}):null}function b(e,t){if(e){let i=u(t.surface);i.deriving=!0,v(e).forEach(i=>{t[i]=e[i]}),i.deriving=!1}}function w(e){return function(t,i){let s=String(i.name);return{init(t){let i=Object.getPrototypeOf(this),o=h(i,m,s);return Array.isArray(o)?o.push(e):d(m,i,s,[e]),t}}}}function x(){return function(e,t){let i=t.name;return{init(e){return this._local.set(i,e),e},get(){return this._local.get(i)},set(e){let t=u(this.surface)?.creating,s=this._local.get(i),o=t?e:g(i,e,this),r=y(i,e,this);this._local.set(i,o),t||(b(r,this),this._onChange({props:{[i]:o},oldValues:{[i]:s},local:!0}),this.surface.hooks.update.emit({id:this.id,props:{[i]:o},oldValues:{[i]:s}}))}}}}let _=Symbol("observe"),C=Symbol("observerDisposable");function k(e){return function(t,i){let s=i.name;return{init(t){return d(_,Object.getPrototypeOf(this),s,e),t}}}}function S(e,t){let i=h(Object.getPrototypeOf(t),_,e),s=t[C]??{};if(t[C]=s,s[e]&&(s[e](),delete s[e]),!i)return;let o=t[e];i(null,t,null);let r=(e,s)=>{i(e,t,s)};o&&"observe"in o?(o.observe(r),s[e]=()=>{o.unobserve(r)}):console.warn(`Failed to observe "${e.toString()}" of ${t.type} element, make sure it's a Y type.`)}let M=Symbol("watch");function E(e){return function(t,i){let s=i.name;return{init(t){return d(M,Object.getPrototypeOf(this),s,e),t}}}}let I=Symbol("yProps");function B(e){let t=Object.getPrototypeOf(e);return Object.hasOwn(t,I)||(t[I]=new Set),t[I]}function $(e){return function(t,i){let s=i.name;return{init(e){if(B(this).add(s),!u(this.surface??Object.getPrototypeOf(this).constructor)?.skipYfield)return this.yMap&&(this.yMap.doc?this.surface.doc.transact(()=>{this.yMap.set(s,e)}):(this.yMap.set(s,e),this._preserved.set(s,e))),e},get(){return this.yMap.get(s)??this._preserved.get(s)??e},set(e){let i=u(this.surface)?.creating;if(u(this.surface)?.skipYfield)return;let o=y(s,e,this),r=i?e:g(s,e,this),a=t.get.call(this);this.yMap.doc?this.surface.doc.transact(()=>{this.yMap.set(s,r)}):(this.yMap.set(s,r),this._preserved.set(s,r)),S(s,this),i||(b(o,this),this.surface.hooks.update.emit({id:this.id,props:{[s]:r},oldValues:{[s]:a}}))}}}}var T=i(69050),O=i(43228),P=i(41149),H=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},A=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o;let l=[],c=[],d=[],h=[],u=[],p=[],f=[],m=[],v=[],w=[];return class{static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;e=[x()],t=[E((e,t)=>{t._local.delete("externalBound")}),x()],i=[$()],s=[x()],o=[$()],H(this,null,e,{kind:"accessor",name:"display",static:!1,private:!1,access:{has:e=>"display"in e,get:e=>e.display,set:(e,t)=>{e.display=t}},metadata:r},l,c),H(this,null,t,{kind:"accessor",name:"externalXYWH",static:!1,private:!1,access:{has:e=>"externalXYWH"in e,get:e=>e.externalXYWH,set:(e,t)=>{e.externalXYWH=t}},metadata:r},d,h),H(this,null,i,{kind:"accessor",name:"index",static:!1,private:!1,access:{has:e=>"index"in e,get:e=>e.index,set:(e,t)=>{e.index=t}},metadata:r},u,p),H(this,null,s,{kind:"accessor",name:"opacity",static:!1,private:!1,access:{has:e=>"opacity"in e,get:e=>e.opacity,set:(e,t)=>{e.opacity=t}},metadata:r},f,m),H(this,null,o,{kind:"accessor",name:"seed",static:!1,private:!1,access:{has:e=>"seed"in e,get:e=>e.seed,set:(e,t)=>{e.seed=t}},metadata:r},v,w),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}constructor(e){this._disposable=new T.K,this._local=new Map,this._preserved=new Map,this.#e=A(this,l,!0),this.#t=(A(this,c),A(this,d,void 0)),this.#i=(A(this,h),A(this,u,void 0)),this.#s=(A(this,p),A(this,f,1)),this.#o=(A(this,m),A(this,v,void 0)),A(this,w);let{id:t,yMap:i,model:s,stashedStore:o,onChange:r}=e;this._id=t,this.yMap=i,this.surface=s,this._stashed=o,this._onChange=r,this.index="a0",this.seed=(0,a.vo)()}static propsToY(e){return e}containsBound(e){return(0,a.Bn)(this).some(t=>e.containsPoint(t))}getLineIntersections(e,t){let i=(0,a.Bn)(this);return(0,a.Dx)(e,t,i)}getNearestPoint(e){let t=(0,a.Bn)(this);return(0,a.$L)(t,e)}getRelativePointLocation(e){let t=r.z.deserialize(this.xywh),i=t.getRelativePoint(e),s=(0,a.Hb)([i],t.center,this.rotate)[0],o=(0,a.Hb)(t.points,t.center,this.rotate),l=(0,a.W4)(o,s);return new n.S(s,l)}includesPoint(e,t,i,s){return this.elementBound.isPointInBound([e,t])}intersectsBound(e){return this.containsBound(e)||e.points.some((e,t,i)=>this.getLineIntersections(e,i[(t+1)%i.length]))}onCreated(){}pop(e){if(!this._stashed.has(e))return;let t=this._stashed.get(e);this._stashed.delete(e),delete this[e],B(this).has(e)?this.surface.doc.transact(()=>{this.yMap.set(e,t)}):console.warn("pop a prop that is not yfield or local:",e)}serialize(){return this.yMap.toJSON()}stash(e){if(this._stashed.has(e)||!B(this).has(e))return;let t=this[e];this._stashed.set(e,t),Object.defineProperty(this,e,{configurable:!0,enumerable:!0,get:()=>this._stashed.get(e),set:t=>{let i=g(e,t,this),s=this._stashed.get(e),o=y(e,t,this);this._stashed.set(e,i),this._onChange({props:{[e]:i},oldValues:{[e]:s},local:!0}),this.surface.hooks.update.emit({id:this.id,props:{[e]:i},oldValues:{[e]:s}}),b(o,this)}})}get connectable(){return!0}get deserializedXYWH(){if(!this._lastXYWH||this.xywh!==this._lastXYWH){let e=this.xywh;this._local.set("deserializedXYWH",(0,O.W)(e)),this._lastXYWH=e}return this._local.get("deserializedXYWH")??[0,0,0,0]}get elementBound(){return this.rotate?r.z.from((0,a.e0)(this)):r.z.deserialize(this.xywh)}get externalBound(){if(!this._local.has("externalBound")){let e=this.externalXYWH?r.z.deserialize(this.externalXYWH):null;this._local.set("externalBound",e)}return this._local.get("externalBound")}get group(){return this.surface.getGroup(this.id)}get groups(){return this.surface.getGroups(this.id)}get h(){return this.deserializedXYWH[3]}get id(){return this._id}get isConnected(){return this.surface.hasElementById(this.id)}get w(){return this.deserializedXYWH[2]}get x(){return this.deserializedXYWH[0]}get y(){return this.deserializedXYWH[1]}#e;get display(){return this.#e}set display(e){this.#e=e}#t;get externalXYWH(){return this.#t}set externalXYWH(e){this.#t=e}#i;get index(){return this.#i}set index(e){this.#i=e}#s;get opacity(){return this.#s}set opacity(e){this.#s=e}#o;get seed(){return this.#o}set seed(e){this.#o=e}}})();class D extends L{constructor(){super(...arguments),this._childBoundCacheKey="",this._childIds=[],this._mutex=(0,P.i)()}_updateXYWH(){let e;let t="",i=this._local.get("xywh")??"[0,0,0,0]";this.childElements.forEach(i=>{t+=i.xywh??"",e=e?e.unite(i.elementBound):i.elementBound}),e?(this._local.set("xywh",e.serialize()),this._childBoundCacheKey=t):(this._local.delete("xywh"),this._childBoundCacheKey=""),this._onChange({props:{xywh:e?.serialize()},oldValues:{xywh:i},local:!0})}descendants(e=!0){return this.childElements.reduce((t,i)=>(i instanceof D?(t=t.concat(i.descendants()),e||t.push(i)):t.push(i),t),[])}hasChild(e){return("string"==typeof e?this.children?.has(e):this.children?.has(e.id))??!1}hasDescendant(e){return this.surface.getGroups("string"==typeof e?e:e.id).some(e=>e.id===this.id)}setChildIds(e,t){let i=this.childIds;this._childIds=e,this._onChange({props:{childIds:e},oldValues:{childIds:i},local:t}),this.surface.hooks.update.emit({id:this.id,props:{childIds:e},oldValues:{childIds:i}})}get childElements(){let e=[];for(let t of this.childIds){let i=this.surface.getElementById(t)||this.surface.doc.getBlockById(t);i&&e.push(i)}return e}get childIds(){return this._childIds}get xywh(){return this._local.has("xywh")&&this.childElements.reduce((e,t)=>e+(t.xywh??""),"")===this._childBoundCacheKey||this._mutex(()=>{this._updateXYWH()}),this._local.get("xywh")??"[0,0,0,0]"}set xywh(e){}}class Z{constructor(){this._lastXYWH="[0,0,-1,-1]",this._local=new Map,this.opacity=1}get deserializedXYWH(){if(this.xywh!==this._lastXYWH){let e=this.xywh;this._local.set("deserializedXYWH",(0,O.W)(e)),this._lastXYWH=e}return this._local.get("deserializedXYWH")}get h(){return this.deserializedXYWH[3]}get w(){return this.deserializedXYWH[2]}get x(){return this.deserializedXYWH[0]}get y(){return this.deserializedXYWH[1]}}function j(e,t,i){let s=(s,o)=>{i({props:{[e]:t},oldValues:{},local:o.local})};return t.observe(s),()=>{t.unobserve(s)}}class V extends l.zg{constructor(){super(),this._decoratorState={creating:!1,deriving:!1,skipYfield:!1},this._elementCtorMap={},this._elementModels=new Map,this._elementToGroup=new Map,this._elementTypeMap=new Map,this._groupToElements=new Map,this._surfaceBlockModel=!0,this.elementAdded=new c.D,this.elementRemoved=new c.D,this.elementUpdated=new c.D,this.hooks={update:new c.D,remove:new c.D},this.created.once(()=>this._init())}_createElementFromProps(e,t){let{type:i,id:s,...o}=e;if(!s)throw Error("Cannot find id in props");let r=new l.rl.Y.Map,a=this._createElementFromYMap(i,s,r,{...t,newCreate:!0});return e=this._propsToY(i,e),r.set("type",i),r.set("id",s),Object.keys(o).forEach(t=>{void 0!==e[t]&&(a.model[t]=e[t])}),a}_createElementFromYMap(e,t,i,s){let o=new Map,r=this._elementCtorMap[e];if(!r)throw Error(`Invalid element type: ${i.get("type")}`);let a=this._decoratorState;a.creating=!0,a.skipYfield=s.skipFieldInit??!1;let n=!1;r._decoratorState=a;let c=new r({id:t,yMap:i,model:this,stashedStore:o,onChange:e=>n&&s.onChange({id:t,...e})});return delete r._decoratorState,a.creating=!1,a.skipYfield=!1,{model:c,mount:()=>{Object.keys(h(r.prototype,_)).forEach(e=>{S(e,c)}),c._disposable.add(()=>{Object.values(c[C]??{}).forEach(e=>e())}),function(e,t){Object.keys(h(e,M)).forEach(e=>{!function(e,t){let i=h(Object.getPrototypeOf(t),M,e);i&&t._disposable.add(t.surface.elementUpdated.on(s=>{s.id===t.id&&e in s.props&&i(s.oldValues[e],t,s.local)}))}(e,t)})}(r.prototype,c),c._disposable.add(function(e,t){let i={},s=(s,o)=>{let r={},a={};s.keysChanged.forEach(o=>{let n=s.changes.keys.get(o),c=s.changes.keys.get(o)?.oldValue;if(n&&("update"===n.action||"add"===n.action)){let s=e.yMap.get(o);s instanceof l.rl.Y.Text&&(i[o]?.(),i[o]=j(o,s,t)),e._preserved.set(o,s),r[o]=s,a[o]=c}}),t({props:r,oldValues:a,local:o.local})};return Array.from(e.yMap.entries()).forEach(([s,o])=>{o instanceof l.rl.Y.Text&&(i[s]=j(s,o,t)),e._preserved.set(s,o)}),e.yMap.observe(s),i.ymap=()=>{e.yMap.unobserve(s)},()=>{Object.values(i).forEach(e=>e())}}(c,e=>{n&&s.onChange({id:t,...e})})),n=!0,c.onCreated()},unmount:()=>{n=!1,c._disposable.dispose()}}}_extendElement(e){Object.assign(this._elementCtorMap,e)}_init(){this._initElementModels(),this._watchGroupRelationChange(),this.applyMiddlewares()}_initElementModels(){let e=this.elements.getValue(),t=(e,t)=>{let i=this._elementTypeMap.get(e)||[];-1===i.indexOf(t)&&i.push(t),this._elementTypeMap.set(e,i)},i=(e,t)=>{let i=this._elementTypeMap.get(e)||[],s=i.indexOf(t);-1!==s&&i.splice(s,1)},s=(e,s)=>{let{changes:o,keysChanged:r}=e,a=[],n=[];r.forEach(e=>{let s=o.keys.get(e),r=this.elements.getValue().get(e);switch(s?.action){case"add":if(r){let i=this._elementModels.has(e),s=i?this._elementModels.get(e):this._createElementFromYMap(r.get("type"),r.get("id"),r,{onChange:e=>this.elementUpdated.emit(e),skipFieldInit:!0});i||this._elementModels.set(e,s),t(s.model.type,s.model),a.push(s)}break;case"delete":if(this._elementModels.has(e)){let{model:t,unmount:s}=this._elementModels.get(e);this._elementToGroup.delete(e),i(t.type,t),this._elementModels.delete(e),n.push({model:t,unmount:s})}}}),a.forEach(({mount:e,model:t})=>{e(),this.elementAdded.emit({id:t.id,local:s.local})}),n.forEach(({unmount:e,model:t})=>{e(),this.elementRemoved.emit({id:t.id,type:t.type,model:t,local:s.local})})};e.forEach((e,t)=>{let i=this._createElementFromYMap(e.get("type"),e.get("id"),e,{onChange:e=>this.elementUpdated.emit(e),skipFieldInit:!0});this._elementModels.set(t,i)}),this._elementModels.forEach(({mount:e,model:i})=>{t(i.type,i),e()}),e.observe(s),this.deleted.on(()=>{e.unobserve(s)})}_propsToY(e,t){let i=this._elementCtorMap[e];if(!i)throw Error(`Invalid element type: ${e}`);return(i.propsToY??L.propsToY)(t)}_watchGroupRelationChange(){let e=(e,t)=>{this._elementToGroup.set(e,t),this._groupToElements.set(t,(this._groupToElements.get(t)||[]).concat(e))},t=(e,t)=>{if(this._elementToGroup.has(e)&&this._elementToGroup.get(e)===t&&this._elementToGroup.delete(e),this._groupToElements.has(t)){let i=this._groupToElements.get(t),s=i.indexOf(e);-1!==s&&(i.splice(s,1),0===i.length&&this._groupToElements.delete(t))}},i=e=>e instanceof D;this.elementModels.forEach(t=>{i(t)&&t.childIds.forEach(i=>{e(i,t.id)})}),this.elementUpdated.on(({id:s,oldValues:o})=>{let r=this.getElementById(s);i(r)&&o.childIds&&(o.childIds.forEach(e=>{t(e,s)}),r.childIds.forEach(t=>{e(t,s)}),0===r.childIds.length&&this.removeElement(s))}),this.elementAdded.on(({id:t})=>{let s=this.getElementById(t);i(s)&&s.childIds.forEach(i=>{e(i,t)})}),this.elementRemoved.on(({id:e,model:s})=>{i(s)&&[...this._groupToElements.get(e)||[]].forEach(i=>t(i,e))});let s=this.doc.slots.blockUpdated.on(({type:e,id:t})=>{if("delete"===e){let e=this.getGroup(t);e&&e.removeChild(t)}});this.deleted.on(()=>{s.dispose()})}addElement(e){if(this.doc.readonly)throw Error("Cannot add element in readonly mode");let t=(0,l.Ak)();e.id=t;let i=this._createElementFromProps(e,{onChange:e=>this.elementUpdated.emit(e)});return this._elementModels.set(t,i),this.doc.transact(()=>{this.elements.getValue().set(t,i.model.yMap)}),t}applyMiddlewares(){}dispose(){super.dispose(),this.elementAdded.dispose(),this.elementRemoved.dispose(),this.elementUpdated.dispose(),this._elementModels.forEach(({unmount:e})=>e()),this._elementModels.clear(),this.hooks.update.dispose(),this.hooks.remove.dispose()}getElementById(e){return this._elementModels.get(e)?.model??null}getElementsByType(e){return this._elementTypeMap.get(e)||[]}getGroup(e){return this._elementToGroup.has(e)?this.getElementById(this._elementToGroup.get(e)):null}getGroups(e){let t=[],i=this.getGroup(e);for(;i;)t.push(i),i=this.getGroup(i.id);return t}hasElementById(e){return this._elementModels.has(e)}isInMindmap(e){let t=this.getGroup(e);return t?.type==="mindmap"}removeElement(e){if(this.doc.readonly)throw Error("Cannot remove element in readonly mode");this.hasElementById(e)&&this.doc.transact(()=>{let t=this.getElementById(e),i=this.getGroup(e);t instanceof D&&t.childIds.forEach(e=>{this.hasElementById(e)?this.removeElement(e):this.doc.hasBlock(e)&&this.doc.deleteBlock(this.doc.getBlock(e).model)}),i&&i.removeChild(e),this.elements.getValue().delete(e),this.hooks.remove.emit({id:e,model:t,type:t.type})})}updateElement(e,t){if(this.doc.readonly)throw Error("Cannot update element in readonly mode");let i=this.getElementById(e);if(!i)throw Error(`Element ${e} is not found`);this.doc.transact(()=>{Object.entries(t=this._propsToY(i.type,t)).forEach(([e,t])=>{i[e]=t})})}get elementModels(){let e=[];return this._elementModels.forEach(t=>e.push(t.model)),e}}class z extends l.zg{constructor(){super(...arguments),this._externalXYWH=void 0,this.connectable=!0,this.rotate=0}containsBound(e){let t=r.z.deserialize(this.xywh);return(0,a.Bn)({x:t.x,y:t.y,w:t.w,h:t.h,rotate:this.rotate}).some(t=>e.containsPoint(t))}getLineIntersections(e,t){let i=r.z.deserialize(this.xywh);return(0,a.Dx)(e,t,(0,a.Hb)(i.points,i.center,this.rotate??0))}getNearestPoint(e){let t=r.z.deserialize(this.xywh);return(0,a.$L)((0,a.Hb)(t.points,t.center,this.rotate??0),e)}getRelativePointLocation(e){let t=r.z.deserialize(this.xywh),i=t.getRelativePoint(e),s=(0,a.Hb)([i],t.center,this.rotate??0)[0],o=(0,a.Hb)(t.points,t.center,this.rotate??0),l=(0,a.W4)(o,s);return new n.S(s,l)}includesPoint(e,t,i,s){return r.z.deserialize(this.xywh).isPointInBound([e,t],0)}intersectsBound(e){return this.containsBound(e)||e.points.some((e,t,i)=>this.getLineIntersections(e,i[(t+1)%i.length]))}get elementBound(){let e=r.z.deserialize(this.xywh);return r.z.from((0,a.e0)({...e,rotate:this.rotate}))}get externalBound(){return this._externalXYWH?r.z.deserialize(this._externalXYWH):null}get externalXYWH(){return this._externalXYWH}set externalXYWH(e){this._externalXYWH=e}get group(){let e=this.doc.getBlocks().find(e=>e instanceof V);return e?e.getGroup(this.id)??null:null}get groups(){let e=this.doc.getBlocks().find(e=>e instanceof V);return e?e.getGroups(this.id):[]}}function R(e){if(e===l.zg)return z;{let t=e;for(;Object.getPrototypeOf(t.prototype)!==l.zg.prototype&&null!==Object.getPrototypeOf(t.prototype);)t=Object.getPrototypeOf(t.prototype).constructor;if(null===Object.getPrototypeOf(t.prototype))throw new s.Ss(o.O.GfxBlockElementError,"The SuperClass is not a subclass of BlockModel");Object.setPrototypeOf(t.prototype,z.prototype)}return e}var F=i(91449),N=i(4564),q=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},U=function(e,t,i){for(var s=arguments.length>2,o=0;o{s=o,void 0===i&&(i=requestAnimationFrame(()=>{i=void 0,(!t||t.isConnected)&&e(...s)}))}}(()=>{let e,t,i,s,o,r,a=[(0,N.EM)("gfx-viewport")],n=[],l=F.WF,c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,N.P)(".gfx-viewport")],s=[(0,N.MZ)({attribute:!1})],o=[(0,N.MZ)({attribute:!1})],r=[(0,N.MZ)({type:Number})],q(this,null,i,{kind:"accessor",name:"container",static:!1,private:!1,access:{has:e=>"container"in e,get:e=>e.container,set:(e,t)=>{e.container=t}},metadata:v},c,d),q(this,null,s,{kind:"accessor",name:"getModelsInViewport",static:!1,private:!1,access:{has:e=>"getModelsInViewport"in e,get:e=>e.getModelsInViewport,set:(e,t)=>{e.getModelsInViewport=t}},metadata:v},h,u),q(this,null,o,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:v},p,f),q(this,null,r,{kind:"accessor",name:"maxConcurrentRenders",static:!1,private:!1,access:{has:e=>"maxConcurrentRenders"in e,get:e=>e.maxConcurrentRenders,set:(e,t)=>{e.maxConcurrentRenders=t}},metadata:v},g,m),q(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,F.AH)` .gfx-viewport { position: absolute; left: 0; top: 0; contain: size layout style; display: block; } `}_toCSSTransform(e,t,i){return`translate3d(${e}px, ${t}px, 0) scale(${i})`}connectedCallback(){super.connectedCallback(),this.viewport.viewportUpdated.on(()=>{this._refreshViewport(),this._hideOutsideBlock()})}render(){return(0,F.qy)`
`}scheduleUpdateChildren(e){let{promise:t,resolve:i}=Promise.withResolvers();if(this._pendingChildrenUpdates.push({id:e,resolve:i}),!this._updatingChildrenFlag){this._updatingChildrenFlag=!0;let e=()=>{this._pendingChildrenUpdates.length&&(this._pendingChildrenUpdates.splice(0,this.maxConcurrentRenders).forEach(({resolve:e})=>e()),this._pendingChildrenUpdates.length?requestAnimationFrame(()=>{this.isConnected&&e()}):this._updatingChildrenFlag=!1)};requestAnimationFrame(()=>{this.isConnected&&e()})}return t}#r;get container(){return this.#r}set container(e){this.#r=e}#a;get getModelsInViewport(){return this.#a}set getModelsInViewport(e){this.#a=e}#n;get host(){return this.#n}set host(e){this.#n=e}#l;get maxConcurrentRenders(){return this.#l}set maxConcurrentRenders(e){this.#l=e}constructor(){super(...arguments),this._hideOutsideBlock=W(()=>{if(this.getModelsInViewport&&this.host){let e=this.host,t=this.getModelsInViewport();t.forEach(t=>{let i=e.std.view.getBlock(t.id);i&&(i.style.display=""),this._lastVisibleModels?.has(t)&&this._lastVisibleModels.delete(t)}),this._lastVisibleModels?.forEach(t=>{let i=e.std.view.getBlock(t.id);i&&(i.style.display="none")}),this._lastVisibleModels=t}},this),this._pendingChildrenUpdates=[],this._refreshViewport=W(()=>{let{translateX:e,translateY:t,zoom:i}=this.viewport;this.container&&(this.container.style.transform=this._toCSSTransform(e,t,i))},this),this._updatingChildrenFlag=!1,this.renderingBlocks=new Set,this.#r=U(this,c,null),this.#a=(U(this,d),U(this,h,void 0)),this.#n=(U(this,u),U(this,p,void 0)),this.#l=(U(this,f),U(this,g,2)),U(this,m)}static{U(t,n)}})})()},7595:(e,t,i)=>{i.d(t,{qZ:()=>ei,p_:()=>eO,as:()=>er,ps:()=>ep,B0:()=>u,AE:()=>eE,Yx:()=>eL,yX:()=>v,By:()=>ey,vz:()=>eP,ao:()=>e_,U3:()=>eh,W:()=>eV,Tm:()=>ew,U4:()=>W,fF:()=>eb,$K:()=>eD});var s,o,r=i(68419),a=i(73134),n=i(73711),l=i(45134),c=i(30272),d=i(81463);function h(e){if("element"===e.type)switch(e.tagName){case"html":case"body":return e.children.map(h).reduce((e,t)=>"no"===e||"no"===t?"no":"maybe"===e&&"maybe"===t?"maybe":"yes","maybe");case"img":return"yes";case"head":break;default:return"no"}return"maybe"}class u{constructor(e){this.std=e,this._adapterMap=new Map,this._getDataByType=e=>{let t=new Map;for(let i of e.types)"Files"===i?t.set(i,Array.from(e.files)):t.set(i,e.getData(i));return t.get("Files")&&t.get("text/html")&&"yes"===(0,d.l)().use(c.A).parse(t.get("text/html")).children.map(h).reduce((e,t)=>"no"===e||"no"===t?"no":"maybe"===e&&"maybe"===t?"maybe":"yes","maybe")&&t.delete("text/html"),e=>{let i=t.get(e);if(i)return i;let s=t.get("Files")??[];return s.length>0?s:""}},this._getSnapshotByPriority=async(e,t,i,s)=>{for(let[o,{adapter:r}]of Array.from(this._adapterMap.entries()).sort((e,t)=>t[1].priority-e[1].priority)){let a=e(o);if((!Array.isArray(a)||0!==a.length&&a.map(e=>e.type===o||"*/*"===o).reduce((e,t)=>e&&t,!0))&&a){let e=this._getJob(),o=new r(e),n={file:a,assets:e.assetsManager,blockVersions:t.collection.meta.blockVersions,pageVersion:t.collection.meta.pageVersion,workspaceVersion:t.collection.meta.workspaceVersion,workspaceId:t.collection.id,pageId:t.id},l=await o.toSlice(n,t,i,s);if(l)return l}}return null},this._jobMiddlewares=[],this.copy=async e=>this.copySlice(e),this.copySlice=async e=>{let t=Array.from(this._adapterMap.keys());await this.writeToClipboard(async i=>{let s={...i};return await Promise.all(t.map(async t=>{let i=await this._getClipboardItem(e,t);"string"==typeof i&&(s[t]=i)})),s})},this.duplicateSlice=async(e,t,i,s,o="BLOCKSUITE/SNAPSHOT")=>{let r={[o]:await this._getClipboardItem(e,o)};await this._getSnapshotByPriority(e=>r[e]??"",t,i,s)},this.paste=async(e,t,i,s)=>{let o=e.clipboardData;if(o)try{let e=this.readFromClipboard(o),n=await this._getSnapshotByPriority(t=>e[t],t,i,s);if(!n)throw new r.Ss(a.O.TransformerError,"No snapshot found");return n}catch{let e=this._getDataByType(o);return await this._getSnapshotByPriority(t=>e(t),t,i,s)}},this.pasteBlockSnapshot=async(e,t,i,s)=>this._getJob().snapshotToBlock(e,t,i,s),this.registerAdapter=(e,t,i=0)=>{this._adapterMap.set(e,{adapter:t,priority:i})},this.unregisterAdapter=e=>{this._adapterMap.delete(e)},this.unuse=e=>{this._jobMiddlewares=this._jobMiddlewares.filter(t=>t!==e)},this.use=e=>{this._jobMiddlewares.push(e)}}async _getClipboardItem(e,t){let i=this._getJob(),s=this._adapterMap.get(t);if(!s)return;let{adapter:o}=s,r=new o(i),a=await r.fromSlice(e);if(a)return a.file}_getJob(){return new n._O({middlewares:this._jobMiddlewares,collection:this.std.collection})}readFromClipboard(e){let t=e.getData("text/html"),i=new DOMParser().parseFromString(t,"text/html").querySelector("[data-blocksuite-snapshot]");if(!i)throw new r.Ss(a.O.TransformerError,"No snapshot found");return JSON.parse(l.decompressFromEncodedURIComponent(i.dataset.blocksuiteSnapshot))}async writeToClipboard(e){let t=await e({"text/plain":"","text/html":"","image/png":""}),i=t["text/plain"],s=t["text/html"],o=t["image/png"];delete t["text/plain"],delete t["text/html"],delete t["image/png"];let r=l.compressToEncodedURIComponent(JSON.stringify(t)),a={"text/html":new Blob([`
${s}
`],{type:"text/html"})};if(i.length>0){let e=new Blob([i],{type:"text/plain"});a["text/plain"]=e}if(o instanceof Blob)a["image/png"]=o;else if(o.length>0){let e=new Blob([o],{type:"image/png"});a["image/png"]=e}await navigator.clipboard.write([new ClipboardItem(a)])}get configs(){return this._getJob().adapterConfigs}}let p=Symbol("cmds");class f{constructor(e){this.std=e,this._commands=new Map,this._createChain=(e,t)=>{let i=this._getCommandCtx,s=this._createChain,o=this.chain;return{[p]:t,run:function(){let e=i(),t=!1;try{let i=this[p];e=function e(t,[i,...s]){let o=t;return i&&i(t,i=>{o=e({...t,...i},s)}),o}(e,[...i,(e,i)=>{t=!0,i()}])}catch(e){console.error(e)}return[t,e]},with:function(t){return s(e,[...this[p],(e,i)=>i(t)])},inline:function(t){return s(e,[...this[p],t])},try:function(t){return s(e,[...this[p],(e,i)=>{let s=e;t(o()).some(e=>{e[p]=[(e,t)=>{t(s)},...e[p]];let[t]=e.inline((e,t)=>{s={...s,...e},t()}).run();return!!t&&(i(s),!0)})}])},tryAll:function(t){return s(e,[...this[p],(e,i)=>{let s=e,r=t(o()),a=!0;r.forEach(e=>{e[p]=[(e,t)=>{t(s)},...e[p]];let[t]=e.inline((e,t)=>{s={...s,...e},t()}).run();t&&(a=!1)}),a||i(s)}])},...e}},this._getCommandCtx=()=>({std:this.std}),this.chain=()=>{let e={},t=this._createChain;for(let[i,s]of this._commands.entries())e[i]=function(i){return t(e,[...this[p],(e,t)=>s({...e,...i},t)])};return t(e,[])}}add(e,t){return this._commands.set(e,t),this}exec(e,...t){let i=this._commands.get(e);if(!i)throw new r.Ss(a.O.CommandError,`The command "${e}" not found`);let s=t[0],o={...this._getCommandCtx(),...s},n={};return i(o,e=>{n=e??{}}),n}}var g=i(69050),m=i(50620);class v{static{this.equals=(e,t)=>v.pathToKey(e)===v.pathToKey(t)}static{this.id=e=>e[e.length-1]}static{this.includes=(e,t)=>v.pathToKey(e).startsWith(v.pathToKey(t))}static{this.keyToPath=e=>e.split("|")}static{this.parent=e=>e.slice(0,e.length-1)}static{this.pathToKey=e=>e.join("|")}constructor(){}}class y{constructor(e){this.event=e,this.type="defaultState"}}class b{constructor(){this._map={},this.add=e=>{let t=e.type;this._map[t]&&console.warn("UIEventStateContext: state name duplicated",t),this._map[t]=e},this.get=e=>{let t=this._map[e];if(!t)throw new r.Ss(a.O.EventDispatcherError,`UIEventStateContext: state ${e} not found`);return t},this.has=e=>!!this._map[e]}static from(...e){let t=new b;return e.forEach(e=>{t.add(e)}),t}}class w extends y{constructor({event:e}){super(e),this.type="clipboardState",this.raw=e}}!function(e){e.Selection="selection",e.Target="target"}(s||(s={}));class x extends y{constructor({event:e,sourceType:t}){super(e),this.type="sourceState",this.sourceType=t}}class _{constructor(e){this._dispatcher=e,this._copy=e=>{let t=new w({event:e});this._dispatcher.run("copy",this._createContext(e,t))},this._cut=e=>{let t=new w({event:e});this._dispatcher.run("cut",this._createContext(e,t))},this._paste=e=>{let t=new w({event:e});this._dispatcher.run("paste",this._createContext(e,t))}}_createContext(e,t){return b.from(new y(e),new x({event:e,sourceType:s.Selection}),t)}listen(){this._dispatcher.disposables.addFromEvent(document,"cut",this._cut),this._dispatcher.disposables.addFromEvent(document,"copy",this._copy),this._dispatcher.disposables.addFromEvent(document,"paste",this._paste)}}var C=i(63820),k=i(30338);let S="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function M(e,t,i=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),i&&t.shiftKey&&(e="Shift-"+e),e}class E extends y{constructor({event:e,composing:t}){super(e),this.type="keyboardState",this.raw=e,this.composing=t}}class I extends y{constructor({event:e,rect:t,startX:i,startY:s,last:o}){super(e),this.type="pointerState";let r=e.clientX-t.left,a=e.clientY-t.top;this.raw=e,this.point={x:r,y:a},this.containerOffset={x:t.left,y:t.top},this.start={x:i,y:s},this.delta=o?{x:r-o.point.x,y:a-o.point.y}:{x:0,y:0},this.keys={shift:e.shiftKey,cmd:e.metaKey||e.ctrlKey,alt:e.altKey},this.button=o?.button||e.button,this.pressure=e.pressure}get x(){return this.point.x}get y(){return this.point.y}}class B extends y{constructor(e,t){super(e),this.type="multiPointerState",this.pointers=t}}class ${constructor(e){this._dispatcher=e,this._down=e=>{if(!this._shouldTrigger(e))return;let t=new E({event:e,composing:this.composition});this._dispatcher.run("keyDown",this._createContext(e,t))},this._shouldTrigger=e=>{if(e.isComposing)return!1;let t=C.vL?e.metaKey:e.ctrlKey;return!(["c","v","x"].includes(e.key)&&t&&!e.shiftKey&&!e.altKey||["Control","Meta","Shift"].includes(e.key))},this._up=e=>{if(!this._shouldTrigger(e))return;let t=new E({event:e,composing:this.composition});this._dispatcher.run("keyUp",this._createContext(e,t))},this.composition=!1}_createContext(e,t){return b.from(new y(e),new x({event:e,sourceType:s.Selection}),t)}bindHotkey(e,t){return this._dispatcher.add("keyDown",t=>!this.composition&&(function(e){let t=function(e){let t=Object.create(null);for(let i in e)t[function(e){let t,i,s,o;let n=e.split(/-(?!$)/),l=n.at(-1);return"Space"===l&&(l=" "),n.slice(0,-1).forEach(e=>{if(/^(cmd|meta|m)$/i.test(e)){o=!0;return}if(/^a(lt)?$/i.test(e)){t=!0;return}if(/^(c|ctrl|control)$/i.test(e)){i=!0;return}if(/^s(hift)?$/i.test(e)){s=!0;return}if(/^mod$/i.test(e)){S?o=!0:i=!0;return}throw new r.Ss(a.O.EventDispatcherError,"Unrecognized modifier name: "+e)}),t&&(l="Alt-"+l),i&&(l="Ctrl-"+l),o&&(l="Meta-"+l),s&&(l="Shift-"+l),l}(i)]=e[i];return t}(e);return e=>{let i=e.get("keyboardState").raw,s=(0,k.xT)(i),o=t[M(s,i)];if(o&&o(e))return!0;if(1!==s.length||" "===s)return!1;if(i.shiftKey){let o=t[M(s,i,!1)];if(o&&o(e))return!0}let r=i.shiftKey||i.altKey||i.metaKey||s.charCodeAt(0)>127,a=k.E3[i.keyCode];if(r&&a&&a!==s){let s=t[M(a,i)];if(s&&s(e))return!0}return!1}})(e)(t),t)}listen(){this._dispatcher.disposables.addFromEvent(document,"keydown",this._down),this._dispatcher.disposables.addFromEvent(document,"keyup",this._up),this._dispatcher.disposables.addFromEvent(document,"compositionstart",()=>{this.composition=!0}),this._dispatcher.disposables.addFromEvent(document,"compositionend",()=>{this.composition=!1})}}function T(e,t){return Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)>4}let O=e=>e.toLowerCase();function P(e,t){return b.from(new y(e),new x({event:e,sourceType:s.Target}),t)}class H{constructor(e){this._dispatcher=e}get _rect(){return this._dispatcher.host.getBoundingClientRect()}}class A extends H{constructor(){super(...arguments),this._down=e=>{let{pointerId:t}=e,i=new I({event:e,rect:this._rect,startX:-1/0,startY:-1/0,last:null});this._startStates.set(t,i),this._lastStates.set(t,i),this._dispatcher.run("pointerDown",P(e,i))},this._lastStates=new Map,this._move=e=>{let{pointerId:t}=e,i=this._startStates.get(t)??null,s=this._lastStates.get(t)??null,o=new I({event:e,rect:this._rect,startX:i?.x??-1/0,startY:i?.y??-1/0,last:s});this._lastStates.set(t,o),this._dispatcher.run("pointerMove",P(e,o))},this._startStates=new Map,this._upOrOut=e=>t=>{let{pointerId:i}=t,s=this._startStates.get(i)??null,o=this._lastStates.get(i)??null,r=new I({event:t,rect:this._rect,startX:s?.x??-1/0,startY:s?.y??-1/0,last:o});this._startStates.delete(i),this._lastStates.delete(i),this._dispatcher.run(e?"pointerUp":"pointerOut",P(t,r))}}listen(){let{host:e,disposables:t}=this._dispatcher;t.addFromEvent(e,"pointerdown",this._down),t.addFromEvent(e,"pointermove",this._move),t.addFromEvent(e,"pointerup",this._upOrOut(!0)),t.addFromEvent(e,"pointerout",this._upOrOut(!1))}}class L extends H{constructor(){super(...arguments),this._down=e=>{!1!==e.isPrimary&&(this._downPointerState&&e.pointerId===this._downPointerState.raw.pointerId&&e.timeStamp-this._downPointerState.raw.timeStamp<500&&!T(e,this._downPointerState.raw)?this._pointerDownCount++:this._pointerDownCount=1,this._downPointerState=new I({event:e,rect:this._rect,startX:-1/0,startY:-1/0,last:null}))},this._downPointerState=null,this._pointerDownCount=0,this._up=e=>{if(!this._downPointerState)return;if(T(this._downPointerState.raw,e)){this._pointerDownCount=0,this._downPointerState=null;return}let t=new I({event:e,rect:this._rect,startX:-1/0,startY:-1/0,last:null}),i=P(e,t);(()=>{this._dispatcher.run("pointerUp",i),this._dispatcher.run("click",i),2===this._pointerDownCount&&this._dispatcher.run("doubleClick",i),3===this._pointerDownCount&&this._dispatcher.run("tripleClick",i)})()}}listen(){let{host:e,disposables:t}=this._dispatcher;t.addFromEvent(e,"pointerdown",this._down),t.addFromEvent(e,"pointerup",this._up)}}class D extends H{constructor(){super(...arguments),this._down=e=>{if(!e.isPrimary){this._dragging&&this._lastPointerState&&this._up(this._lastPointerState.raw),this._reset();return}let t=new I({event:e,rect:this._rect,startX:-1/0,startY:-1/0,last:null});this._startPointerState=t,this._dispatcher.disposables.addFromEvent(document,"pointermove",this._move),this._dispatcher.disposables.addFromEvent(document,"pointerup",this._up)},this._dragging=!1,this._lastPointerState=null,this._move=e=>{if(null===this._startPointerState||this._startPointerState.raw.pointerId!==e.pointerId)return;let t=this._startPointerState,i=this._lastPointerState??t,s=new I({event:e,rect:this._rect,startX:t.x,startY:t.y,last:i});this._lastPointerState=s,!this._dragging&&T(e,this._startPointerState.raw)&&(this._dragging=!0,this._dispatcher.run("dragStart",P(e,t))),this._dragging&&this._dispatcher.run("dragMove",P(e,s))},this._reset=()=>{this._dragging=!1,this._startPointerState=null,this._lastPointerState=null,document.removeEventListener("pointermove",this._move),document.removeEventListener("pointerup",this._up)},this._startPointerState=null,this._up=e=>{if(!this._startPointerState||this._startPointerState.raw.pointerId!==e.pointerId)return;let t=this._startPointerState,i=this._lastPointerState,s=new I({event:e,rect:this._rect,startX:t.x,startY:t.y,last:i});this._dragging&&this._dispatcher.run("dragEnd",P(e,s)),this._reset()}}listen(){let{host:e,disposables:t}=this._dispatcher;t.addFromEvent(e,"pointerdown",this._down)}}class Z extends H{constructor(){super(...arguments),this._down=e=>{if(null!==this._startPointerStates.primary&&null!==this._startPointerStates.secondary&&this._reset(),null===this._startPointerStates.primary&&!e.isPrimary)return;let t=new I({event:e,rect:this._rect,startX:-1/0,startY:-1/0,last:null});e.isPrimary?this._startPointerStates.primary=t:this._startPointerStates.secondary=t},this._lastPointerStates={primary:null,secondary:null},this._move=e=>{if(null===this._startPointerStates.primary||null===this._startPointerStates.secondary)return;let{pointerId:t}=e,i=this._startPointerStates.primary.raw.pointerId===t?this._startPointerStates.primary:this._startPointerStates.secondary,s=(this._lastPointerStates.primary?.raw.pointerId===t?this._lastPointerStates.primary:this._lastPointerStates.secondary)??i;if(!T(s.raw,e))return;let o=new I({event:e,rect:this._rect,startX:i.x,startY:i.y,last:s}),r=this._startPointerStates.primary.raw.pointerId!==t?this._startPointerStates.primary:this._startPointerStates.secondary,a=(this._lastPointerStates.primary?.raw.pointerId!==t?this._lastPointerStates.primary:this._lastPointerStates.secondary)??r,n=new I({event:a.raw,rect:this._rect,startX:r.x,startY:r.y,last:a});if(!T(o.delta,n.delta))return;let l=new B(e,[o,n]);this._handleMove(e,l),this._lastPointerStates={primary:o.raw.isPrimary?o:n,secondary:o.raw.isPrimary?n:o}},this._reset=()=>{this._startPointerStates={primary:null,secondary:null},this._lastPointerStates={primary:null,secondary:null}},this._startPointerStates={primary:null,secondary:null},this._upOrOut=e=>{let{pointerId:t}=e;(t===this._startPointerStates.primary?.raw.pointerId||t===this._startPointerStates.secondary?.raw.pointerId)&&this._reset()}}listen(){let{host:e,disposables:t}=this._dispatcher;t.addFromEvent(e,"pointerdown",this._down),t.addFromEvent(e,"pointermove",this._move),t.addFromEvent(e,"pointerup",this._upOrOut),t.addFromEvent(e,"pointerout",this._upOrOut)}}class j extends Z{_handleMove(e,t){"touch"===e.pointerType&&T(t.pointers[0].delta,t.pointers[1].delta)&&this._dispatcher.run("pinch",P(e,t))}}class V extends Z{_handleMove(e,t){var i,s;"touch"===e.pointerType&&T({x:0,y:0},(i=t.pointers[0].delta,s=t.pointers[1].delta,{x:(i.x+s.x)/2,y:(i.y+s.y)/2}))&&this._dispatcher.run("pan",P(e,t))}}class z{constructor(e){this.controllers=[new A(e),new L(e),new D(e),new V(e),new j(e)]}listen(){this.controllers.forEach(e=>e.listen())}}class R{constructor(e){this._dispatcher=e,this._buildScope=e=>{let t;let i=document.getSelection();if(i&&i.rangeCount>0){let s=i.getRangeAt(0);t=this._buildEventScopeByNativeRange(e,s),this._prev=s}else null!==this._prev&&(t=this._buildEventScopeByNativeRange(e,this._prev),this._prev=null);return t},this._compositionEnd=e=>{let t=this._buildScope("compositionEnd");this._dispatcher.run("compositionEnd",this._createContext(e),t)},this._compositionStart=e=>{let t=this._buildScope("compositionStart");this._dispatcher.run("compositionStart",this._createContext(e),t)},this._compositionUpdate=e=>{let t=this._buildScope("compositionUpdate");this._dispatcher.run("compositionUpdate",this._createContext(e),t)},this._prev=null,this._selectionChange=e=>{let t=document.getSelection();if(!t||!t.containsNode(this._dispatcher.host,!0)||t.containsNode(this._dispatcher.host))return;let i=this._buildScope("selectionChange");this._dispatcher.run("selectionChange",this._createContext(e),i)}}_buildEventScopeByNativeRange(e,t){let i=this._findBlockComponentPath(t).map(e=>e).filter(e=>!!e),s=Array.from(new Set(i.flatMap(e=>e.map(e=>this._dispatcher.std.doc.getBlockById(e)?.flavour)).filter(e=>!!e))).reverse();return this._dispatcher.buildEventScope(e,s,i)}_createContext(e){return b.from(new y(e),new x({event:e,sourceType:s.Selection}))}_findBlockComponentPath(e){let t=e.startContainer,i=e.endContainer,s=e.commonAncestorContainer,o=e=>{let t=e instanceof Element?e:e.parentElement;return t?.closest("[data-block-id]")};if(s.nodeType===Node.TEXT_NODE){let e=o(s);if(e)return[e.path]}let r=new Set,a=!1,n=(e,s)=>{if(e&&e!==s){if(e===i){r.add(e),a=!1;return}e===t&&(a=!0),a&&(e.nodeType===Node.TEXT_NODE||e.nodeType===Node.ELEMENT_NODE)&&r.add(e),n(e.firstChild,s),n(e.nextSibling,s)}};n(s.firstChild,s);let l=new Set;return r.forEach(e=>{let t=o(e);!t||l.has(t.path)||l.add(t.path)}),Array.from(l)}listen(){this._dispatcher.disposables.addFromEvent(document,"selectionchange",this._selectionChange),this._dispatcher.disposables.addFromEvent(this._dispatcher.host,"compositionstart",this._compositionStart),this._dispatcher.disposables.addFromEvent(this._dispatcher.host,"compositionend",this._compositionEnd),this._dispatcher.disposables.addFromEvent(this._dispatcher.host,"compositionupdate",this._compositionUpdate)}}let F=["beforeInput","blur","focus","drop","contextMenu","wheel"],N=["click","doubleClick","tripleClick","pointerDown","pointerMove","pointerUp","pointerOut","dragStart","dragMove","dragEnd","pinch","pan","keyDown","keyUp","selectionChange","compositionStart","compositionUpdate","compositionEnd","cut","copy","paste",...F];class q{constructor(e){this.std=e,this._active=!1,this._calculatePath=e=>{let t=[],i=e;for(;i;)t.push(i.id),i=this.std.doc.getParent(i);return t.reverse()},this._handlersMap=Object.fromEntries(N.map(e=>[e,[]])),this.bindHotkey=(...e)=>this._keyboardControl.bindHotkey(...e),this.disposables=new g.K,this.slots={parentScaleChanged:new m.D,editorHostPanned:new m.D},this._pointerControl=new z(this),this._keyboardControl=new $(this),this._rangeControl=new R(this),this._clipboardControl=new _(this)}_bindEvents(){F.forEach(e=>{this.disposables.addFromEvent(this.host,O(e),t=>{this.run(e,b.from(new y(t),new x({event:t,sourceType:s.Selection})))},"wheel"===e?{passive:!1}:void 0)}),this._pointerControl.listen(),this._keyboardControl.listen(),this._rangeControl.listen(),this._clipboardControl.listen();let e=!1;this.disposables.addFromEvent(this.host,"pointerdown",()=>{e=!0,this._active=!0}),this.disposables.addFromEvent(this.host,"pointerup",()=>{e=!1}),this.disposables.addFromEvent(this.host,"click",()=>{this._active=!0}),this.disposables.addFromEvent(this.host,"focusin",()=>{this._active=!0}),this.disposables.addFromEvent(this.host,"focusout",e=>{e.relatedTarget&&!this.host.contains(e.relatedTarget)&&(this._active=!1)}),this.disposables.addFromEvent(this.host,"pointerenter",()=>{this._active=!0}),this.disposables.addFromEvent(this.host,"pointerleave",()=>{document.activeElement&&this.host.contains(document.activeElement)||e||(this._active=!1)})}_buildEventScopeBySelection(e){if(!this._handlersMap[e])return;let t=this._currentSelections,i={},s=t.map(e=>e.blockId).map(e=>this.std.doc.getBlockById(e)).filter(e=>!!e).map(e=>this._calculatePath(e)),o=s.flatMap(e=>e.map(e=>this.std.doc.getBlockById(e)?.flavour)).filter(e=>!!e&&!i[e]&&(i[e]=!0,!0)).reverse();return this.buildEventScope(e,o,s)}_buildEventScopeByTarget(e,t){if(!this._handlersMap[e])return;let i=t instanceof Element?t:t.parentElement,s=i?.closest("[data-block-id]"),o=s?.path;if(!o)return this._buildEventScopeBySelection(e);let r=o.map(e=>this.std.doc.getBlockById(e)?.flavour).filter(e=>!!e).reverse();return this.buildEventScope(e,r,[o])}get _currentSelections(){return this.std.selection.value}_getEventScope(e,t){let i;if(this._handlersMap[e]){switch(t.sourceType){case s.Selection:i=this._buildEventScopeBySelection(e);break;case s.Target:i=this._buildEventScopeByTarget(e,t.event.target);break;default:throw new r.Ss(a.O.EventDispatcherError,`Unknown event scope source: ${t.sourceType}`)}return i}}add(e,t,i){let s={fn:t,flavour:i?.flavour,path:i?.path};return this._handlersMap[e].unshift(s),()=>{this._handlersMap[e].includes(s)&&(this._handlersMap[e]=this._handlersMap[e].filter(e=>e!==s))}}buildEventScope(e,t,i){let s=this._handlersMap[e];if(!s)return;let o=s.filter(e=>void 0===e.flavour&&void 0===e.path),r=s.filter(e=>{let t=e.path;return void 0!==t&&i.some(e=>v.includes(e,t))}),a=s.filter(e=>e.flavour&&t.includes(e.flavour));return{runners:r.concat(a).concat(o),flavours:t,paths:i}}mount(){this.disposables.disposed&&(this.disposables=new g.K),this._bindEvents()}run(e,t,i){if(!this.active)return;let s=t.get("sourceState");if(i||(i=this._getEventScope(e,s)))for(let e of i.runners){let{fn:i}=e;if(i(t)){t.get("defaultState").event.stopPropagation();return}}}unmount(){this.disposables.dispose()}get active(){return this._active}get host(){return this.std.host}}var U=i(46317);let W=e=>{let t=e.host,i=t.selection,s=t.range,o=new m.D;if(!i||!s)return null;let n=i=>{if(i.collapsed){let s=i.startContainer instanceof Element?i.startContainer:i.startContainer.parentElement;if(!s?.closest(`[${U.jN}]`))return!1;let o=s?.closest(`[${t.blockIdAttr}]`);if(!o||o!==e)return!1}else if(!i.intersectsNode(e))return!1;return!0},l=(t,i)=>{if(!n(t))return null;let{from:s,to:o}=i;if(s.blockId===e.blockId)return{index:s.index,length:s.length};if(o&&o.blockId===e.blockId)return{index:o.index,length:o.length};if(!e.model.text)throw new r.Ss(a.O.SelectionError,"element to set text selection has no text");return{index:0,length:e.model.text.length}},c=null;return i.slots.changed.on(()=>{let e=i.find("text");if(!e)return;let t=s.value;t&&n(t)&&requestAnimationFrame(()=>{let i=l(t,e);c&&i&&c.index===i.index&&c.length===i.length||(c=i,o.emit([i,!1]))})}),{setInlineRange:(t,r=!0)=>{if(!s.binding?.isComposing){if(t){let s=i.create("text",{from:{blockId:e.blockId,index:t.index,length:t.length},to:null});i.setGroup("note",[s])}else i.clear(["text"]);o.emit([t,r])}},getInlineRange:()=>{let e=document.getSelection();if(!e||0===e.rangeCount)return null;let t=e.getRangeAt(0);if(!t)return null;let s=i.find("text");return s?l(t,s):null},inlineRangeUpdated:o}};var G=i(64816),Y=i(99603),K=i(31980),X=i(91449),Q=i(4564),J=i(53010),ee=i(94423),et=i(3874);class ei{constructor({blockId:e}){this.blockId=e}static fromJSON(e){throw new r.Ss(a.O.SelectionError,"You must override this method")}is(e){return this.type===e}get group(){return this.constructor.group}get type(){return this.constructor.type}}var es=i(67448);let eo=es.Ay.object({blockId:es.Ay.string()});class er extends ei{static{this.group="note"}static{this.type="block"}static fromJSON(e){return eo.parse(e),new er({blockId:e.blockId})}equals(e){return e instanceof er&&this.blockId===e.blockId}toJSON(){return{type:"block",blockId:this.blockId}}}let ea=es.Ay.object({x:es.Ay.number(),y:es.Ay.number()});class en extends ei{static{this.group="gfx"}static{this.type="cursor"}constructor(e,t){super({blockId:"[gfx-cursor]"}),this.x=e,this.y=t}static fromJSON(e){return ea.parse(e),new en(e.x,e.y)}equals(e){return e instanceof en&&this.x===e.x&&this.y===e.y}toJSON(){return{type:"cursor",x:this.x,y:this.y}}}let el=es.Ay.object({elements:es.Ay.array(es.Ay.string()),editing:es.Ay.boolean(),inoperable:es.Ay.boolean().optional()});class ec extends ei{static{this.group="gfx"}static{this.type="surface"}constructor(e,t,i,s=!1){super({blockId:e}),this.elements=t,this.editing=i,this.inoperable=s}static fromJSON(e){return el.parse(e),new ec(e.blockId,e.elements,e.editing,e.inoperable||!1)}equals(e){return e instanceof ec&&this.blockId===e.blockId&&this.elements.length===e.elements.length&&this.elements.every((t,i)=>t===e.elements[i])&&this.editing===e.editing&&this.inoperable===e.inoperable}isEmpty(){return 0===this.elements.length&&!this.editing}toJSON(){return{type:"surface",blockId:this.blockId,elements:this.elements,editing:this.editing,inoperable:this.inoperable}}}let ed=es.Ay.object({from:es.Ay.object({blockId:es.Ay.string(),index:es.Ay.number(),length:es.Ay.number()}),to:es.Ay.object({blockId:es.Ay.string(),index:es.Ay.number(),length:es.Ay.number()}).nullable(),reverse:es.Ay.boolean().optional()});class eh extends ei{static{this.group="note"}static{this.type="text"}constructor({from:e,to:t,reverse:i}){super({blockId:e.blockId}),this.from=e,this.to=this._equalPoint(e,t)?null:t,this.reverse=!!i}static fromJSON(e){return ed.parse(e),new eh({from:e.from,to:e.to,reverse:!!e.reverse})}_equalPoint(e,t){return e&&t?e.blockId===t.blockId&&e.index===t.index&&e.length===t.length:e===t}empty(){return!!this.to}equals(e){return e instanceof eh&&this.blockId===e.blockId&&this._equalPoint(e.from,this.from)&&this._equalPoint(e.to,this.to)}isCollapsed(){return null===this.to&&0===this.from.length}isInSameBlock(){return null===this.to||this.from.blockId===this.to.blockId}toJSON(){return{type:"text",from:this.from,to:this.to,reverse:this.reverse}}get end(){return this.reverse?this.from:this.to??this.from}get start(){return this.reverse?this.to??this.from:this.from}}class eu{constructor(e){this.std=e,this._itemAdded=e=>{e.stackItem.meta.set("selection-state",this.value)},this._itemPopped=e=>{let t=e.stackItem.meta.get("selection-state");t&&this.set(t)},this._jsonToSelection=e=>{let t=this._selectionConstructors[e.type];if(!t)throw new r.Ss(a.O.SelectionError,`Unknown selection type: ${e.type}`);return t.fromJSON(e)},this._remoteSelections=(0,K.vP)(new Map),this._selectionConstructors={},this._selections=(0,K.vP)([]),this.disposables=new g.K,this.slots={changed:new m.D,remoteChanged:new m.D},this._setupDefaultSelections(),this._store.awareness.on("change",e=>{let t=e.updated.concat(e.added).concat(e.removed),i=this._store.awareness.clientID,s=t.filter(e=>e!==i);if(t.includes(i)){let e=this._store.getLocalSelection(this.std.doc.blockCollection).map(e=>this._jsonToSelection(e));this._selections.value=e}if(s.length>0){let e=new Map;this._store.getStates().forEach((t,i)=>{if(i===this._store.awareness.clientID)return;let s=Object.entries(t.selectionV2).filter(([e])=>e===this.std.doc.id).flatMap(([e,t])=>t).map(e=>{try{return this._jsonToSelection(e)}catch(t){return console.error("Parse remote selection failed:",i,e,t),null}}).filter(e=>!!e);e.set(i,s)}),this._remoteSelections.value=e}})}_setupDefaultSelections(){this.register([eh,er,ec,en])}get _store(){return this.std.collection.awarenessStore}clear(e){if(e){let t=this.value.filter(t=>!e.includes(t.type));this.set(t)}else this.set([])}create(e,...t){let i=this._selectionConstructors[e];if(!i)throw new r.Ss(a.O.SelectionError,`Unknown selection type: ${e}`);return new i(...t)}dispose(){Object.values(this.slots).forEach(e=>e.dispose()),this.disposables.dispose()}filter(e){return this.filter$(e).value}filter$(e){return(0,K.EW)(()=>this.value.filter(t=>t.is(e)))}find(e){return this.find$(e).value}find$(e){return(0,K.EW)(()=>this.value.find(t=>t.is(e)))}fromJSON(e){let t=e.map(e=>this._jsonToSelection(e));return this.set(t)}getGroup(e){return this.value.filter(t=>t.group===e)}mount(){this.disposables.disposed&&(this.disposables=new g.K),this.std.doc.history.on("stack-item-added",this._itemAdded),this.std.doc.history.on("stack-item-popped",this._itemPopped),this.disposables.add(this._store.slots.update.on(({id:e})=>{e!==this._store.awareness.clientID&&this.slots.remoteChanged.emit(this.remoteSelections)}))}register(e){return[e].flat().forEach(e=>{this._selectionConstructors[e.type]=e}),this}set(e){this._store.setLocalSelection(this.std.doc.blockCollection,e.map(e=>e.toJSON())),this.slots.changed.emit(e)}setGroup(e,t){let i=this.value.filter(t=>t.group!==e);this.set([...i,...t])}unmount(){this.std.doc.history.off("stack-item-added",this._itemAdded),this.std.doc.history.off("stack-item-popped",this._itemPopped),this.slots.changed.dispose(),this.disposables.dispose(),this.clear()}update(e){let t=e(this.value);this.set(t)}get remoteSelections(){return this._remoteSelections.value}get value(){return this._selections.value}}class ep{constructor(e){this.disposables=new g.K,this.flavour=e.flavour,this.std=e.std,this.specSlots=e.slots}bindHotKey(e,t){this.disposables.add(this.uiEventDispatcher.bindHotkey(e,{flavour:t?.global?void 0:this.flavour}))}dispose(){this.disposables.dispose()}handleEvent(e,t,i){this.disposables.add(this.uiEventDispatcher.add(e,t,{flavour:i?.global?void 0:this.flavour}))}mounted(){this.specSlots.mounted.emit({service:this})}unmounted(){this.specSlots.unmounted.emit({service:this})}get collection(){return this.std.collection}get doc(){return this.std.doc}get host(){return this.std.host}get selectionManager(){return this.std.selection}get uiEventDispatcher(){return this.std.event}}let ef=()=>({mounted:new m.D,unmounted:new m.D,viewConnected:new m.D,viewDisconnected:new m.D,widgetConnected:new m.D,widgetDisconnected:new m.D});class eg{constructor(e){this.std=e,this._disposables=new g.K,this._services=new Map,this._specs=new Map,this.slots={beforeApply:new m.D,beforeMount:new m.D,beforeUnmount:new m.D,afterApply:new m.D,afterMount:new m.D,afterUnmount:new m.D}}_buildSpecMap(e){let t=new Map;return e.forEach(e=>{t.set(e.schema.model.flavour,e)}),t}_diffServices(e,t){e.forEach((e,i)=>{if(t.has(i)&&t.get(i)?.service===e.service)return;let s=this._services.get(i);s&&(s.dispose(),s.unmounted()),this._services.delete(i)}),t.forEach((e,t)=>{if(this._services.has(t))return;let i=e.service??ep,s=ef(),o=new i({flavour:t,std:this.std,slots:s});e.setup?.(s,this._disposables),this._services.set(t,o),o.mounted()})}applySpecs(e){this.slots.beforeApply.emit();let t=this._specs,i=this._buildSpecMap(e);this._diffServices(t,i),this._specs=i,this.slots.afterApply.emit()}getConfig(e){let t=this._specs.get(e);return t?t.config:null}getService(e){return this._services.get(e)}getView(e){let t=this._specs.get(e);return t?t.view:null}mount(){this.slots.beforeMount.emit(),this._disposables.disposed&&(this._disposables=new g.K),this.slots.afterMount.emit()}unmount(){this.slots.beforeUnmount.emit(),this._services.forEach(e=>{e.dispose(),e.unmounted()}),this._services.clear(),this._disposables.dispose(),this.slots.afterUnmount.emit()}}class em{constructor(e){this.std=e,this._blockMap=new Map,this._widgetMap=new Map,this.calculatePath=e=>{let t=[],i=e;for(;i;)t.push(i.id),i=this.std.doc.getParent(i);return t.reverse()},this.deleteBlock=e=>{this._blockMap.delete(e.id)},this.deleteWidget=e=>{let t=e.dataset.widgetId,i=`${e.model.id}|${t}`;this._widgetMap.delete(i)},this.fromPath=e=>{let t=e??this.std.doc.root?.id;return t?this._blockMap.get(t)??null:null},this.getBlock=e=>this._blockMap.get(e)??null,this.getWidget=(e,t)=>{let i=`${t}|${e}`;return this._widgetMap.get(i)??null},this.setBlock=e=>{this._blockMap.set(e.model.id,e)},this.setWidget=e=>{let t=e.dataset.widgetId,i=`${e.model.id}|${t}`;this._widgetMap.set(i,e)},this.walkThrough=(e,t)=>{let i=this.fromPath(t);if(!i)return;let s=t=>(i,o)=>{if(!0===e(i,o,t))return;let r=i.model.children;r.forEach(e=>{let t=this._blockMap.get(e.id);t&&s(i)(t,r.indexOf(e))})};i.model.children.forEach(e=>{let t=this._blockMap.get(e.id);t&&s(t)(t,i.model.children.indexOf(e))})}}mount(){}unmount(){this._blockMap.clear(),this._widgetMap.clear()}viewFromPath(e,t){if("block"===e)return this.fromPath(t[t.length-1]);let i=t.slice(-2).join("|");return this._widgetMap.get(i)??null}}class ev{constructor(e){this.host=e.host,this.collection=e.doc.collection,this.doc=e.doc,this.event=new q(this),this.selection=new eu(this),this.range=new eP(this.host),this.command=new f(this),this.spec=new eg(this),this.view=new em(this),this.clipboard=new u(this)}mount(){this.selection.mount(),this.range.mount(),this.event.mount(),this.view.mount(),this.spec.mount()}unmount(){this.event.unmount(),this.selection.unmount(),this.view.unmount(),this.spec.unmount()}}let ey={string:e=>"string"==typeof e,number:e=>"number"==typeof e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e,array:e=>Array.isArray(e),instanceOf:e=>t=>t instanceof e,arrayOf:e=>t=>Array.isArray(t)&&t.every(e),recordOf:e=>t=>"object"==typeof t&&null!==t&&Object.values(t).every(e)};function eb(e){return function(t){let i=t.prototype.connectedCallback;t.prototype.connectedCallback=function(){i&&i.call(this),function(e,t){for(let[i,s]of Object.entries(t)){if(void 0===e[i])throw new r.Ss(a.O.DefaultRuntimeError,`Property ${i} is required to ${e.constructor.name}.`);if(s&&!s(e[i]))throw new r.Ss(a.O.DefaultRuntimeError,`Property ${i} is invalid to ${e.constructor.name}.`)}}(this,e)}}}function ew(e){return class extends e{constructor(){super(...arguments),this._disposables=new g.K}connectedCallback(){super.connectedCallback(),this._disposables.disposed&&(this._disposables=new g.K)}disconnectedCallback(){super.disconnectedCallback(),this._disposables.dispose()}get disposables(){return this._disposables}}}var ex=i(22805);class e_ extends X.WF{static{this.disableShadowRoot=!0}static finalizeStyles(e){let t=super.finalizeStyles(e);return this.disableShadowRoot&&(t.forEach(e=>{if(e instanceof X.BO&&"undefined"!=typeof document){let t=document.head,i=document.createElement("style");i.textContent=e.cssText,t.append(i)}else console.error("unreachable")}),t=[]),t}createRenderRoot(){return this.constructor.disableShadowRoot?this:super.createRenderRoot()}}var eC=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ek=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,l,c,d=[eb({doc:ey.instanceOf(n.JA),std:ey.instanceOf(ev),specs:ey.arrayOf(ey.object)}),(0,Q.EM)("editor-host")],h=[],u=(0,K.Jb)(ew(e_)),p=[],f=[],g=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[];return class extends u{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;i=[(0,Q.MZ)({attribute:!1})],s=[(0,Y.Gt)({context:eS}),(0,Q.MZ)({attribute:!1})],o=[(0,Q.MZ)({attribute:!1})],l=[(0,Y.Gt)({context:eM}),(0,Q.wk)()],c=[(0,Q.MZ)({attribute:!1})],eC(this,null,i,{kind:"accessor",name:"blockIdAttr",static:!1,private:!1,access:{has:e=>"blockIdAttr"in e,get:e=>e.blockIdAttr,set:(e,t)=>{e.blockIdAttr=t}},metadata:r},p,f),eC(this,null,s,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:r},g,v),eC(this,null,o,{kind:"accessor",name:"specs",static:!1,private:!1,access:{has:e=>"specs"in e,get:e=>e.specs,set:(e,t)=>{e.specs=t}},metadata:r},y,b),eC(this,null,l,{kind:"accessor",name:"std",static:!1,private:!1,access:{has:e=>"std"in e,get:e=>e.std,set:(e,t)=>{e.std=t}},metadata:r},w,x),eC(this,null,c,{kind:"accessor",name:"widgetIdAttr",static:!1,private:!1,access:{has:e=>"widgetIdAttr"in e,get:e=>e.widgetIdAttr,set:(e,t)=>{e.widgetIdAttr=t}},metadata:r},_,C),eC(null,e={value:t},d,{kind:"class",name:t.name,metadata:r},null,h),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,X.AH)` editor-host { outline: none; isolation: isolate; } `}connectedCallback(){if(super.connectedCallback(),!this.doc.root)throw new r.Ss(a.O.NoRootModelError,"This doc is missing root block. Please initialize the default block structure before connecting the editor to DOM.");this.std=new ev({host:this,doc:this.doc}),this.std.mount(),this.std.spec.applySpecs(this.specs),this.tabIndex=0}disconnectedCallback(){super.disconnectedCallback(),this.std.unmount(),this.slots.unmounted.emit()}async getUpdateComplete(){try{let e=await super.getUpdateComplete(),t=this.doc.root;if(!t)return e;let i=this.std.spec.getView(t.flavour);if(!i)return e;let s=Object.values(i.widgets??{}),o=[i.component,...s];return await Promise.all(o.map(e=>{let t=this.renderRoot.querySelector(e._$litStatic$);if(t instanceof X.WF)return t.updateComplete})),e}catch(e){return e instanceof Error?(0,r.H4)(e):console.error(e),!0}}render(){let{root:e}=this.doc;return e?this._renderModel(e):X.s6}willUpdate(e){e.has("specs")&&this.std.spec.applySpecs(this.specs),super.willUpdate(e)}get command(){return this.std.command}get event(){return this.std.event}get range(){return this.std.range}get selection(){return this.std.selection}get spec(){return this.std.spec}get view(){return this.std.view}#c;get blockIdAttr(){return this.#c}set blockIdAttr(e){this.#c=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}#h;get specs(){return this.#h}set specs(e){this.#h=e}#u;get std(){return this.#u}set std(e){this.#u=e}#p;get widgetIdAttr(){return this.#p}set widgetIdAttr(e){this.#p=e}constructor(){super(...arguments),this._renderModel=e=>{let{flavour:t}=e,i=this.doc.getBlock(e.id);if(!i||i.blockViewType===n.lv.Hidden)return(0,et.qy)`${X.s6}`;let s=this.doc.schema.flavourSchemaMap.get(t),o=this.std.spec.getView(t);if(!s||!o)return console.warn(`Cannot find render flavour ${t}.`),(0,et.qy)`${X.s6}`;let r=o.component,a=o.widgets?Object.entries(o.widgets).reduce((e,[t,i])=>{let s=(0,et.qy)`<${i} ${(0,et.Bk)(this.widgetIdAttr)}=${t}>`;return{...e,[t]:s}},{}):{};return(0,et.qy)`<${r} ${(0,et.Bk)(this.blockIdAttr)}=${e.id} .widgets=${a} .viewType=${i.blockViewType} >`},this.renderChildren=e=>(0,et.qy)`${(0,ex.u)(e.children,e=>e.id,e=>this._renderModel(e))}`,this.renderModel=e=>this._renderModel(e),this.renderSpecPortal=(e,t)=>(0,et.qy)` `,this.slots={unmounted:new m.D},this.#c=ek(this,p,"data-block-id"),this.#d=(ek(this,f),ek(this,g,void 0)),this.#h=(ek(this,v),ek(this,y,void 0)),this.#u=(ek(this,b),ek(this,w,void 0)),this.#p=(ek(this,x),ek(this,_,"data-widget-id")),ek(this,C)}static{ek(t,h)}},t})();var eI=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},eB=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,l,c,d,h,u,p=[eb({doc:ey.instanceOf(n.JA),std:ey.instanceOf(ev),widgets:ey.recordOf(ey.object)})],f=[],g=(0,K.Jb)(ew(e_)),m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[];return class extends g{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(g[Symbol.metadata]??null):void 0;i=[(0,Y.Gt)({context:e$}),(0,Q.wk)()],s=[(0,Q.wk)()],o=[(0,Y.Gt)({context:eT}),(0,Q.wk)()],l=[(0,Q.MZ)({attribute:!1})],c=[(0,Y.Fg)({context:eS})],d=[(0,Y.Fg)({context:eM})],h=[(0,Q.MZ)({attribute:!1})],u=[(0,Q.MZ)({attribute:!1,hasChanged:(e,t)=>e&&t?(!!Object.keys(e).length||!!Object.keys(t).length)&&e!==t:e!==t})],eI(this,null,i,{kind:"accessor",name:"_model",static:!1,private:!1,access:{has:e=>"_model"in e,get:e=>e._model,set:(e,t)=>{e._model=t}},metadata:r},m,v),eI(this,null,s,{kind:"accessor",name:"_renderers",static:!1,private:!1,access:{has:e=>"_renderers"in e,get:e=>e._renderers,set:(e,t)=>{e._renderers=t}},metadata:r},y,b),eI(this,null,o,{kind:"accessor",name:"_service",static:!1,private:!1,access:{has:e=>"_service"in e,get:e=>e._service,set:(e,t)=>{e._service=t}},metadata:r},w,x),eI(this,null,l,{kind:"accessor",name:"dirty",static:!1,private:!1,access:{has:e=>"dirty"in e,get:e=>e.dirty,set:(e,t)=>{e.dirty=t}},metadata:r},_,C),eI(this,null,c,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:r},k,S),eI(this,null,d,{kind:"accessor",name:"std",static:!1,private:!1,access:{has:e=>"std"in e,get:e=>e.std,set:(e,t)=>{e.std=t}},metadata:r},M,E),eI(this,null,h,{kind:"accessor",name:"viewType",static:!1,private:!1,access:{has:e=>"viewType"in e,get:e=>e.viewType,set:(e,t)=>{e.viewType=t}},metadata:r},I,B),eI(this,null,u,{kind:"accessor",name:"widgets",static:!1,private:!1,access:{has:e=>"widgets"in e,get:e=>e.widgets,set:(e,t)=>{e.widgets=t}},metadata:r},$,T),eI(null,e={value:t},p,{kind:"class",name:t.name,metadata:r},null,f),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),eB(t,f)}_renderMismatchBlock(e){return(0,ee.z)(this.isVersionMismatch,()=>{let e=this.doc.schema.flavourSchemaMap.get(this.model.flavour);if(!e)throw new r.Ss(a.O.ValueNotExists,`Cannot find schema for flavour ${this.model.flavour}`);let t=e.version,i=this.model.version;return this.renderVersionMismatch(t,i)},()=>e)}_renderViewType(e){return(0,J.S)(this.viewType,[[n.lv.Display,()=>e],[n.lv.Hidden,()=>X.s6],[n.lv.Bypass,()=>this.renderChildren(this.model)]])}addRenderer(e){this._renderers.push(e)}bindHotKey(e,t){let i={flavour:t?.global?void 0:t?.flavour?this.model.flavour:void 0,path:t?.global||t?.flavour?void 0:this.path},s=this.host.event.bindHotkey(e,i);return this._disposables.add(s),s}connectedCallback(){super.connectedCallback(),this.std.view.setBlock(this);let e=this.std.doc.slots.blockUpdated.on(({type:t,id:i})=>{i===this.model.id&&"delete"===t&&(this.std.view.deleteBlock(this),e.dispose())});this._disposables.add(e),this.path=this.host.view.calculatePath(this.model),this._disposables.add(this.model.propsUpdated.on(()=>{this.requestUpdate()})),this.service.specSlots.viewConnected.emit({service:this.service,component:this})}disconnectedCallback(){super.disconnectedCallback(),this.service?.specSlots.viewDisconnected.emit({service:this.service,component:this})}async getUpdateComplete(){let e=await super.getUpdateComplete();return await Promise.all(this.childBlocks.map(e=>e.updateComplete)),e}render(){return this._renderers.reduce((e,t)=>t.call(this,e),X.s6)}renderBlock(){return X.s6}renderVersionMismatch(e,t){return(0,et.qy)`

Block Version Mismatched

We can not render this ${this.model.flavour} block because the version is mismatched.

Editor version: ${e}

Data version: ${t}

`}update(e){this.dirty?(this.__reflectingProperties&&=this.__reflectingProperties.forEach(e=>this.__propertyToAttribute(e,this[e])),this._$changedProperties=new Map,this.isUpdatePending=!1,this.__childPart=(0,X.XX)(X.s6,this.renderRoot),this.updateComplete.then(()=>{this.dirty=!1}).catch(console.error)):super.update(e)}get blockId(){return this.dataset.blockId}get childBlocks(){return this.model.children.map(e=>this.std.view.getBlock(e.id)).filter(e=>!!e)}get flavour(){return this.model.flavour}get host(){return this.std.host}get isVersionMismatch(){let e=this.doc.schema.flavourSchemaMap.get(this.model.flavour);if(!e)throw new r.Ss(a.O.ValueNotExists,`Cannot find schema for flavour ${this.model.flavour}`);let t=e.version,i=this.model.version;return t!==i&&(console.warn(`Version mismatch for block ${this.model.id}, expected ${t}, actual ${i}`),!0)}get model(){if(this._model)return this._model;let e=this.doc.getBlockById(this.blockId);if(!e)throw new r.Ss(a.O.MissingViewModelError,`Cannot find block model for id ${this.blockId}`);return this._model=e,e}get parentBlock(){let e=this.parentElement;return e?.closest("[data-block-id]")}get rootComponent(){let e=this.doc.root?.id;return e?this.host.view.getBlock(e)??null:null}get selected(){return this._selected.value}get selection(){return this.host.selection}get service(){if(this._service)return this._service;let e=this.std.spec.getService(this.model.flavour);if(!e)throw new r.Ss(a.O.MissingViewModelError,`Cannot find service for flavour ${this.model.flavour}`);return this._service=e,e}get topContenteditableElement(){return this.rootComponent}get widgetComponents(){return Object.keys(this.widgets).reduce((e,t)=>({...e,[t]:this.host.view.getWidget(t,this.blockId)}),{})}#f;get _model(){return this.#f}set _model(e){this.#f=e}#g;get _renderers(){return this.#g}set _renderers(e){this.#g=e}#m;get _service(){return this.#m}set _service(e){this.#m=e}#v;get dirty(){return this.#v}set dirty(e){this.#v=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}#u;get std(){return this.#u}set std(e){this.#u=e}#y;get viewType(){return this.#y}set viewType(e){this.#y=e}#b;get widgets(){return this.#b}set widgets(e){this.#b=e}constructor(){super(...arguments),this._selected=(0,K.EW)(()=>this.std.selection.value.find(e=>e.blockId===this.model?.id)||null),this.handleEvent=(e,t,i)=>{let s={flavour:i?.global?void 0:i?.flavour?this.model?.flavour:void 0,path:i?.global||i?.flavour?void 0:this.path};this._disposables.add(this.host.event.add(e,t,s))},this.path=[],this.renderChildren=e=>this.host.renderChildren(e),this.#f=eB(this,m,null),this.#g=(eB(this,v),eB(this,y,[this.renderBlock,this._renderMismatchBlock,this._renderViewType])),this.#m=(eB(this,b),eB(this,w,null)),this.#v=(eB(this,x),eB(this,_,!1)),this.#d=(eB(this,C),eB(this,k,void 0)),this.#u=(eB(this,S),eB(this,M,void 0)),this.#y=(eB(this,E),eB(this,I,n.lv.Display)),this.#b=(eB(this,B),eB(this,$,void 0)),eB(this,T)}},t})();class eP{static{this.rangeQueryExcludeAttr="data-range-query-exclude"}static{this.rangeSyncExcludeAttr="data-range-sync-exclude"}constructor(e){this.host=e,this.binding=null}_isRangeSyncExcluded(e){return!!e.closest(`[${eP.rangeSyncExcludeAttr}="true"]`)}clear(){let e=document.getSelection();if(!e)return;e.removeAllRanges();let t=this.host.querySelector('[contenteditable="true"]');t instanceof HTMLElement&&t.blur(),document.activeElement instanceof HTMLElement&&document.activeElement.blur()}getClosestBlock(e){let t=e instanceof Element?e:e.parentElement;if(!t)return null;let i=t.closest(`[${this.host.blockIdAttr}]`);return!i||this._isRangeSyncExcluded(i)?null:i}getClosestInlineEditor(e){let t=e instanceof Element?e:e.parentElement;if(!t)return null;let i=t.closest(`[${U.jN}]`);return!i||this._isRangeSyncExcluded(i)?null:i.inlineEditor}getSelectedBlockComponentsByRange(e,t={}){let{mode:i="all",match:s=()=>!0}=t,o=Array.from(this.host.querySelectorAll(`[${this.host.blockIdAttr}]:not([${eP.rangeQueryExcludeAttr}="true"])`)).filter(t=>e.intersectsNode(t)&&s(t));if(0===o.length)return[];let n=this.getClosestBlock(e.startContainer);if(!n)throw new r.Ss(a.O.SelectionError,"First element not found");if("flat"===i)o=o.filter(e=>n.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING||e===n);else if("highest"===i){let e=o[0];o=o.filter((t,i)=>0===i||!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY)&&(e=t,!0))}return o}mount(){this.binding=new eH(this)}queryInlineEditorByPath(e){let t=this.host.view.getBlock(e);if(!t)return null;let i=t.querySelector(`[${U.jN}]`);return!i||this._isRangeSyncExcluded(i)?null:i.inlineEditor}rangeToTextSelection(e,t=!1){let{startContainer:i,endContainer:s}=e,o=this.getClosestBlock(i),r=this.getClosestBlock(s);if(!o||!r)return null;let a=this.getClosestInlineEditor(i),n=this.getClosestInlineEditor(s);if(!a||!n)return null;let l=a.toInlineRange(e),c=n.toInlineRange(e);return l&&c?this.host.selection.create("text",{from:{blockId:o.blockId,index:l.index,length:l.length},to:o===r?null:{blockId:r.blockId,index:c.index,length:c.length},reverse:t}):null}set(e){let t=document.getSelection();t&&(t.removeAllRanges(),t.addRange(e))}syncRangeToTextSelection(e,t){let i=this.host.selection;if(!e){i.clear(["text"]);return}let s=this.rangeToTextSelection(e,t);s?i.setGroup("note",[s]):i.clear(["text"])}syncTextSelectionToRange(e){let t=this.textSelectionToRange(e);t?this.set(t):this.clear()}textSelectionToRange(e){let{from:t,to:i}=e,s=this.queryInlineEditorByPath(t.blockId);if(!s)return null;if(e.isInSameBlock())return s.toDomRange({index:t.index,length:t.length});if(!i)return null;let o=this.queryInlineEditorByPath(i.blockId);if(!o)return null;let r=s.toDomRange({index:t.index,length:t.length}),a=o.toDomRange({index:i.index,length:i.length});if(!r||!a)return null;let n=document.createRange(),l=r.startContainer,c=r.startOffset,d=a.endContainer,h=a.endOffset;return n.setStart(l,c),n.setEnd(d,h),n}get value(){let e=document.getSelection();return e?0===e.rangeCount?null:e.getRangeAt(0):void 0}}class eH{constructor(e){this.manager=e,this._compositionStartCallback=null,this._onBeforeInput=e=>{let t=this.selectionManager.find("text");if(!t||e.isComposing)return;let{from:i,to:s}=t;if(!s||i.blockId===s.blockId)return;let o=this.rangeManager?.value;if(!o)return;let r=this.rangeManager.getSelectedBlockComponentsByRange(o,{mode:"flat"}),a=r.at(0),n=r.at(-1);if(!a||!n)return;let l=a.model.text,c=n.model.text;if(!l||!c)return;e.preventDefault(),this.host.doc.transact(()=>{l.delete(i.index,i.length),l.insert(e.data??"",i.index),c.delete(0,s.length),l.join(c),r.slice(1).reverse().forEach(e=>{let t=this.host.doc.getParent(e.model);t&&this.host.doc.deleteBlock(e.model,{bringChildrenTo:t})})});let d=this.selectionManager.create("text",{from:{blockId:i.blockId,index:i.index+(e.data?.length??0),length:0},to:null});this.selectionManager.setGroup("note",[d])},this._onCompositionEnd=e=>{this._compositionStartCallback&&(e.preventDefault(),this._compositionStartCallback(e).catch(console.error),this._compositionStartCallback=null)},this._onCompositionStart=()=>{let e=this.selectionManager.find("text");if(!e)return;let{from:t,to:i}=e;if(!i)return;this.isComposing=!0;let s=this.rangeManager?.value;if(!s)return;let o=this.rangeManager.getSelectedBlockComponentsByRange(s,{mode:"flat"}),r=this.rangeManager.getSelectedBlockComponentsByRange(s,{mode:"highest",match:e=>"content"===e.model.role}),a=o.at(0),n=o.at(-1);if(!a||!n)return;let l=a.model.text,c=n.model.text;l&&c&&(this._compositionStartCallback=async e=>{this.isComposing=!1;let s=[];for(let e of r){let t=this.host.doc.getParent(e.blockId);if(!t)continue;let i=this.host.view.getBlock(t.id);!(i instanceof eO)||s.includes(i)||(i.dirty=!0,await i.updateComplete,await i.updateComplete,s.push(i))}this.host.doc.transact(()=>{c.delete(0,i.length),l.join(c),o.slice(1).reverse().forEach(e=>{let t=this.host.doc.getParent(e.model);t&&this.host.doc.deleteBlock(e.model,{bringChildrenTo:t})})}),await this.host.updateComplete;let a=this.selectionManager.create("text",{from:{blockId:t.blockId,index:t.index+(e.data?.length??0),length:0},to:null});this.host.selection.setGroup("note",[a]),this.rangeManager?.syncTextSelectionToRange(a)})},this._onNativeSelectionChanged=async()=>{if(this.isComposing)return;await this.host.updateComplete;let e=document.getSelection();if(!e){this.selectionManager.clear(["text"]);return}let t=e.rangeCount>0?e.getRangeAt(0):null,i=!!e.anchorNode&&!!e.focusNode&&(e.anchorNode===e.focusNode?e.anchorOffset>e.focusOffset:e.anchorNode.compareDocumentPosition(e.focusNode)===Node.DOCUMENT_POSITION_PRECEDING);if(!t){this._prevTextSelection=null,this.selectionManager.clear(["text"]);return}if(t.startContainer instanceof HTMLElement&&"false"===t.startContainer.contentEditable&&t.endContainer instanceof HTMLElement&&"false"===t.endContainer.contentEditable){this._prevTextSelection=null,this.selectionManager.clear(["text"]),e.removeRange(t);return}let s=t.commonAncestorContainer instanceof Element?t.commonAncestorContainer:t.commonAncestorContainer.parentElement;if(!s)return;let o=s.closest(`[${this.host.blockIdAttr}]`);if(o?.getAttribute(eP.rangeSyncExcludeAttr)==="true")return;let r=this.rangeManager?.getClosestInlineEditor(t.commonAncestorContainer);if(r?.isComposing)return;let a=this.rangeManager?.rangeToTextSelection(t,i);if(!a){this._prevTextSelection=null,this.selectionManager.clear(["text"]);return}let n=this.host.doc.getBlockById(a.blockId);if(!n)return;let l=this.host.view.calculatePath(n);this._prevTextSelection={selection:a,path:l},this.rangeManager?.syncRangeToTextSelection(t,i)},this._onStdSelectionChanged=e=>{let t=e.find(e=>e.is("text"))??null;t!==this._prevTextSelection&&this.host.updateComplete.then(()=>{let e=t&&this.host.doc.getBlockById(t.blockId),i=e&&this.host.view.calculatePath(e);t&&this._prevTextSelection&&i&&t.equals(this._prevTextSelection.selection)&&i.join("")===this._prevTextSelection.path.join("")||(this._prevTextSelection=t&&i?{selection:t,path:i}:null,t?this.rangeManager?.syncTextSelectionToRange(t):this.rangeManager?.clear())}).catch(console.error)},this._prevTextSelection=null,this.isComposing=!1,this.host.disposables.add(this.selectionManager.slots.changed.on(this._onStdSelectionChanged)),this.host.disposables.addFromEvent(document,"selectionchange",(0,G.nF)(()=>{this._onNativeSelectionChanged().catch(console.error)},10)),this.host.disposables.add(this.host.event.add("beforeInput",e=>{let t=e.get("defaultState").event;this._onBeforeInput(t)})),this.host.disposables.add(this.host.event.add("compositionStart",this._onCompositionStart)),this.host.disposables.add(this.host.event.add("compositionEnd",e=>{let t=e.get("defaultState").event;this._onCompositionEnd(t)}))}get host(){return this.manager.host}get rangeManager(){return this.host.range}get selectionManager(){return this.host.selection}}let eA=Symbol("GfxElement");class eL extends eO{constructor(){super(...arguments),this[o]=!0}static{o=eA}connectedCallback(){super.connectedCallback(),this.style.position="absolute"}getRenderingRect(){let{xywh$:e}=this.model;if(!e)throw new r.Ss(a.O.GfxBlockElementError,"Gfx block element should have `xywh` property.");let[t,i,s,o]=JSON.parse(e.value);return{x:t,y:i,w:s,h:o,zIndex:this.toZIndex()}}renderBlock(){let{x:e,y:t,w:i,h:s,zIndex:o}=this.getRenderingRect();return this.style.left=`${e}px`,this.style.top=`${t}px`,this.style.width=`${i}px`,this.style.height=`${s}px`,this.style.zIndex=o,this.renderGfxBlock()}renderGfxBlock(){return X.s6}renderPageContent(){return X.s6}async scheduleUpdate(){let e=this.parentElement;!this.hasUpdated&&e&&"scheduleUpdateChildren"in e&&await e.scheduleUpdateChildren(this.model.id),super.scheduleUpdate()}toZIndex(){return"1"}updateZIndex(){this.style.zIndex=this.toZIndex()}get rootService(){return this.host.spec.getService(this.rootServiceFlavour)}}function eD(e){var t;return class extends e{constructor(){super(...arguments),this[t]=!0}static{t=eA}connectedCallback(){super.connectedCallback(),this.style.position="absolute"}getRenderingRect(){let{xywh$:e}=this.model;if(!e)throw new r.Ss(a.O.GfxBlockElementError,"Gfx block element should have `xywh` property.");let[t,i,s,o]=JSON.parse(e.value);return{x:t,y:i,w:s,h:o,zIndex:this.toZIndex()}}renderBlock(){let{xywh:e,index:t}=this.model;if(!e||!t)throw new r.Ss(a.O.GfxBlockElementError,"Gfx block element should have `xywh` and `index` props.");let{x:i,y:s,w:o,h:n,zIndex:l}=this.getRenderingRect();return this.style.left=`${i}px`,this.style.top=`${s}px`,this.style.width="number"==typeof o?`${o}px`:o,this.style.height="number"==typeof n?`${n}px`:n,this.style.zIndex=l,this.renderGfxBlock()}renderGfxBlock(){return this.renderPageContent()}renderPageContent(){return super.renderBlock()}async scheduleUpdate(){let e=this.parentElement;!this.hasUpdated&&e&&"scheduleUpdateChildren"in e&&await e.scheduleUpdateChildren(this.model.id),super.scheduleUpdate()}toZIndex(){return"1"}updateZIndex(){this.style.zIndex=this.toZIndex()}get rootService(){return this.host.spec.getService(this.rootServiceFlavour)}}}var eZ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ej=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=(0,K.Jb)(ew(X.WF)),r=[],a=[],n=[],l=[],c=[],d=[],h=[],u=[];return class extends o{static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;e=[(0,Y.Fg)({context:eS})],t=[(0,Y.Fg)({context:e$})],i=[(0,Y.Fg)({context:eT})],s=[(0,Y.Fg)({context:eM})],eZ(this,null,e,{kind:"accessor",name:"_doc",static:!1,private:!1,access:{has:e=>"_doc"in e,get:e=>e._doc,set:(e,t)=>{e._doc=t}},metadata:p},r,a),eZ(this,null,t,{kind:"accessor",name:"_model",static:!1,private:!1,access:{has:e=>"_model"in e,get:e=>e._model,set:(e,t)=>{e._model=t}},metadata:p},n,l),eZ(this,null,i,{kind:"accessor",name:"_service",static:!1,private:!1,access:{has:e=>"_service"in e,get:e=>e._service,set:(e,t)=>{e._service=t}},metadata:p},c,d),eZ(this,null,s,{kind:"accessor",name:"_std",static:!1,private:!1,access:{has:e=>"_std"in e,get:e=>e._std,set:(e,t)=>{e._std=t}},metadata:p},h,u),p&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}bindHotKey(e,t){this._disposables.add(this.host.event.bindHotkey(e,{flavour:t?.global?void 0:this.flavour}))}connectedCallback(){super.connectedCallback();let e=this.widgetId;this.std.view.setWidget(this),this.path=this.host.view.calculatePath(this.model).concat(e),this.service.specSlots.widgetConnected.emit({service:this.service,component:this})}disconnectedCallback(){super.disconnectedCallback(),this.std?.view.deleteWidget(this),this.service.specSlots.widgetDisconnected.emit({service:this.service,component:this})}render(){return null}get block(){return this.std.view.getBlock(this.model.id)}get doc(){return this._doc}get flavour(){return this.model.flavour}get host(){return this.std.host}get model(){return this._model}get service(){return this._service}get std(){return this._std}get widgetId(){return this.dataset.widgetId}#w;get _doc(){return this.#w}set _doc(e){this.#w=e}#f;get _model(){return this.#f}set _model(e){this.#f=e}#m;get _service(){return this.#m}set _service(e){this.#m=e}#x;get _std(){return this.#x}set _std(e){this.#x=e}constructor(){super(...arguments),this.handleEvent=(e,t,i)=>{this._disposables.add(this.host.event.add(e,t,{flavour:i?.global?void 0:this.flavour}))},this.#w=ej(this,r,void 0),this.#f=(ej(this,a),ej(this,n,void 0)),this.#m=(ej(this,l),ej(this,c,void 0)),this.#x=(ej(this,d),ej(this,h,void 0)),ej(this,u)}}})()},80650:(e,t,i)=>{i.d(t,{F:()=>C});var s=i(96509),o=i(71006),r=i(73711),a=i(18342),n=i(79539),l=i(25627),c=i(81463),d=i(38509),h=i(74597),u=i(14076),p=i(13265),f=i(75903),g=i(923),m=i(66745),v=i(96855),y=i(75069),b=i(28050),w=i(75425);function x(){let e=this.data(),t=e.micromarkExtensions||(e.micromarkExtensions=[]),i=e.fromMarkdownExtensions||(e.fromMarkdownExtensions=[]),s=e.toMarkdownExtensions||(e.toMarkdownExtensions=[]);t.push((0,w.y)([(0,m.$)(),(0,v.K)(),(0,y.x)(),(0,b.J)()])),i.push([(0,p.p)(),(0,f.c)(),(0,g.S)(),(0,u.C)()]),s.push({extensions:[(0,p.K)(),(0,f.d)(),(0,g.P)()]})}var _=i(62112);class C extends r.Dy{constructor(){super(...arguments),this._traverseMarkdown=(e,t,i)=>{let o=new r.PV;return o.setONodeTypeGuard(e=>!Array.isArray(e)&&"type"in e&&void 0!==e.type),o.setEnter(async(e,t)=>{switch(e.node.type){case"html":t.openNode({type:"block",id:(0,r.Ak)(),flavour:"affine:paragraph",props:{type:"text",text:{"$blocksuite:internal:text$":!0,delta:[{insert:e.node.value}]}},children:[]},"children").closeNode();break;case"code":t.openNode({type:"block",id:(0,r.Ak)(),flavour:"affine:code",props:{language:e.node.lang??"Plain Text",text:{"$blocksuite:internal:text$":!0,delta:[{insert:e.node.value}]}},children:[]},"children").closeNode();break;case"paragraph":t.openNode({type:"block",id:(0,r.Ak)(),flavour:"affine:paragraph",props:{type:"text",text:{"$blocksuite:internal:text$":!0,delta:this._mdastToDelta(e.node)}},children:[]},"children").closeNode();break;case"heading":t.openNode({type:"block",id:(0,r.Ak)(),flavour:"affine:paragraph",props:{type:`h${e.node.depth}`,text:{"$blocksuite:internal:text$":!0,delta:this._mdastToDelta(e.node)}},children:[]},"children").closeNode();break;case"blockquote":t.openNode({type:"block",id:(0,r.Ak)(),flavour:"affine:paragraph",props:{type:"quote",text:{"$blocksuite:internal:text$":!0,delta:this._mdastToDelta(e.node)}},children:[]},"children").closeNode(),t.skipAllChildren();break;case"list":t.setNodeContext("mdast:list:ordered",e.node.ordered);break;case"listItem":t.openNode({type:"block",id:(0,r.Ak)(),flavour:"affine:list",props:{type:null!==e.node.checked?"todo":t.getNodeContext("mdast:list:ordered")?"numbered":"bulleted",text:{"$blocksuite:internal:text$":!0,delta:e.node.children[0]&&"paragraph"===e.node.children[0].type?this._mdastToDelta(e.node.children[0]):[]},checked:e.node.checked??!1,collapsed:!1},children:[]},"children"),e.node.children[0]&&"paragraph"===e.node.children[0].type&&t.skipChildren(1);break;case"thematicBreak":t.openNode({type:"block",id:(0,r.Ak)(),flavour:"affine:divider",props:{},children:[]},"children").closeNode();break;case"image":{let o="";if(!i)break;if((0,_.vC)(e.node.url)){let t=await (0,_.aK)(e.node.url,void 0,this.configs.get("imageProxy"));if(!t)break;let r=t.clone(),a=new File([await t.blob()],(0,h.u)(t.headers.get("Content-Disposition")??"")??(e.node.url.split("/").at(-1)??"image")+"."+(t.headers.get("Content-Type")?.split("/").at(-1)??"png"),{type:t.headers.get("Content-Type")??""});o=await (0,s.h)(await r.arrayBuffer()),i?.getAssets().set(o,a),await i?.writeToBlob(o)}else{let t=e.node.url;i.getAssets().forEach((e,s)=>{let a=(0,r.wm)(i.getAssets(),s);decodeURIComponent(t).includes(a)&&(o=s)})}t.openNode({type:"block",id:(0,r.Ak)(),flavour:"affine:image",props:{sourceId:o},children:[]},"children").closeNode();break}case"table":{let i=e.node.children[0].children.map(()=>({id:(0,r.Ak)(),hide:!1,width:180})),s=Object.create(null);e.node.children.slice(1).forEach(e=>{let t=(0,r.Ak)();s[t]=Object.create(null),e.children.slice(1).forEach((e,o)=>{s[t][i[o+1].id]={columnId:i[o+1].id,value:(0,_.GZ)(e.children.map(e=>"value"in e?e.value:"").join(""))}})});let o=e.node.children[0].children.map((e,t)=>({type:0===t?"title":"rich-text",name:e.children.map(e=>"value"in e?e.value:"").join(""),data:{},id:i[t].id}));t.openNode({type:"block",id:(0,r.Ak)(),flavour:"affine:database",props:{views:[{id:(0,r.Ak)(),name:"Table View",mode:"table",columns:[],filter:{type:"group",op:"and",conditions:[]},header:{titleColumn:i[0]?.id,iconColumn:"type"}}],title:{"$blocksuite:internal:text$":!0,delta:[]},cells:s,columns:o},children:[]},"children"),t.setNodeContext("affine:table:rowid",Object.keys(s)),t.skipChildren(1);break}case"tableRow":t.openNode({type:"block",id:t.getNodeContext("affine:table:rowid").shift()??(0,r.Ak)(),flavour:"affine:paragraph",props:{text:{"$blocksuite:internal:text$":!0,delta:this._mdastToDelta(e.node.children[0])},type:"text"},children:[]}).closeNode(),t.skipAllChildren()}}),o.setLeave((e,t)=>{switch(e.node.type){case"listItem":case"table":t.closeNode()}}),o.walk(e,t)},this._traverseSnapshot=async(e,t,i)=>{let s=[],n=new r.PV;return n.setONodeTypeGuard(e=>r.T1.safeParse(e).success),n.setEnter(async(e,t)=>{let l=e.node.props.text??{delta:[]},c=t.currentNode();switch(e.node.flavour){case"affine:code":t.openNode({type:"code",lang:e.node.props.language??null,meta:null,value:l.delta.map(e=>e.insert).join("")},"children").closeNode();break;case"affine:paragraph":{let i=t.getGlobalContext("affine:paragraph:depth")??0;switch(e.node.props.type){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":t.openNode({type:"heading",depth:parseInt(e.node.props.type[1]),children:this._deltaToMdAST(l.delta,i)},"children").closeNode();break;case"text":t.openNode({type:"paragraph",children:this._deltaToMdAST(l.delta,i)},"children").closeNode();break;case"quote":t.openNode({type:"blockquote",children:[]},"children").openNode({type:"paragraph",children:this._deltaToMdAST(l.delta)},"children").closeNode().closeNode()}t.setGlobalContext("affine:paragraph:depth",i+1);break}case"affine:list":t.getNodeContext("affine:list:parent")===e.parent&&"list"===c.type&&c.ordered===("numbered"===e.node.props.type)&&(0,_.uy)(c.children[0].checked)===(0,_.uy)("todo"===e.node.props.type?e.node.props.checked:void 0)?t.openNode({type:"listItem",checked:"todo"===e.node.props.type?e.node.props.checked:void 0,spread:!1,children:[]},"children").openNode({type:"paragraph",children:this._deltaToMdAST(l.delta)},"children").closeNode():t.openNode({type:"list",ordered:"numbered"===e.node.props.type,spread:!1,children:[]},"children").setNodeContext("affine:list:parent",e.parent).openNode({type:"listItem",checked:"todo"===e.node.props.type?e.node.props.checked:void 0,spread:!1,children:[]},"children").openNode({type:"paragraph",children:this._deltaToMdAST(l.delta)},"children").closeNode();break;case"affine:divider":t.openNode({type:"thematicBreak"},"children").closeNode();break;case"affine:image":{let o=e.node.props.sourceId??"";if(!i)break;await i.readFromBlob(o);let a=i.getAssets().get(o);if(s.push(o),!a)break;let n=(0,r.wm)(i.getAssets(),o);t.openNode({type:"paragraph",children:[]},"children").openNode({type:"image",url:`assets/${n}`,title:e.node.props.caption??null,alt:a.name??null},"children").closeNode().closeNode();break}case"affine:page":{let i=e.node.props.title??{delta:[]};if(0===i.delta.length)break;t.openNode({type:"heading",depth:1,children:this._deltaToMdAST(i.delta,0)},"children").closeNode();break}case"affine:database":{let i=[],s=e.node.props.columns,o=e.node.children,r=e.node.props.cells,n=e=>({type:"tableCell",children:e}),l=Array.prototype.map.call(o,e=>Array.prototype.map.call(s,t=>{let i=r[e.id]?.[t.id];if(!i&&"title"!==t.type)return n([{type:"text",value:""}]);switch(t.type){case"link":case"progress":case"number":case"checkbox":default:return n([{type:"text",value:i.value}]);case"rich-text":return n(this._deltaToMdAST(i.value.delta));case"title":return n(this._deltaToMdAST(e.props.text.delta));case"date":return n([{type:"text",value:(0,a.GP)(new Date(i.value),"yyyy-MM-dd")}]);case"select":return n([{type:"text",value:t.data.options.find(e=>e.id===i.value)?.value}]);case"multi-select":return n([{type:"text",value:Array.prototype.map.call(i.value,e=>t.data.options.find(t=>e===t.id).value).filter(Boolean).join(",")}])}}));Array.isArray(s)&&i.push({type:"tableRow",children:Array.prototype.map.call(s,e=>n([{type:"text",value:e.name}]))}),Array.prototype.forEach.call(l,e=>{i.push({type:"tableRow",children:e})}),t.openNode({type:"table",children:i}).closeNode(),t.skipAllChildren();break}case"affine:embed-synced-doc":{let i=this.configs.get("embedSyncedDocExportType");void 0===t.getGlobalContext("embed-synced-doc-counter")&&t.setGlobalContext("embed-synced-doc-counter",0);let s=t.getGlobalContext("embed-synced-doc-counter");if(t.setGlobalContext("embed-synced-doc-counter",++s),"content"===i){(0,o.Z1)(e.node.props.pageId);let i=e.node.props.pageId,r=this.job.collection.getDoc(i);if(!r)break;if(1===s){let e=await this.job.docToSnapshot(r);e&&await n.walkONode(e.blocks)}else t.openNode({type:"paragraph",children:[{type:"text",value:r.meta?.title??""}]}).closeNode()}break}case"affine:embed-loom":case"affine:embed-github":case"affine:embed-youtube":case"affine:embed-figma":case"affine:bookmark":if("string"!=typeof e.node.props.title||"string"!=typeof e.node.props.url)break;t.openNode({type:"paragraph",children:[]},"children").openNode({type:"link",url:e.node.props.url,children:[{type:"text",value:e.node.props.title}]},"children").closeNode().closeNode()}}),n.setLeave((e,t)=>{let i=t.currentNode(),s=t.previousNode();switch(e.node.flavour){case"affine:paragraph":t.setGlobalContext("affine:paragraph:depth",t.getGlobalContext("affine:paragraph:depth")-1);break;case"affine:list":t.getPreviousNodeContext("affine:list:parent")===e.parent&&"listItem"===i.type&&s?.type==="list"&&s.ordered===("numbered"===e.node.props.type)&&(0,_.uy)(i.checked)===(0,_.uy)("todo"===e.node.props.type?e.node.props.checked:void 0)?(t.closeNode(),e.next?.flavour!=="affine:list"&&t.closeNode()):t.closeNode().closeNode();break;case"affine:embed-synced-doc":{let e=t.getGlobalContext("embed-synced-doc-counter");t.setGlobalContext("embed-synced-doc-counter",e-1)}}}),{ast:await n.walk(e,t),assetsIds:s}}}_astToMarkdown(e){return(0,c.l)().use(x).use(l.A,{resourceLink:!0}).stringify(e).replace(/ \n/g," \n")}_deltaToMdAST(e,t=0){return t>0&&e.unshift({insert:" ".repeat(4).repeat(t)}),e.map(e=>{let t={type:"text",value:e.attributes?.underline?`${e.insert}`:e.insert};if(e.attributes?.reference){let i=this.configs.get("title:"+e.attributes.reference.pageId);"string"==typeof i&&(t={type:"text",value:i})}return e.attributes?.code&&(t={type:"inlineCode",value:e.insert}),e.attributes?.bold&&(t={type:"strong",children:[t]}),e.attributes?.italic&&(t={type:"emphasis",children:[t]}),e.attributes?.strike&&(t={type:"delete",children:[t]}),e.attributes?.link&&(""===e.insert?t={type:"text",value:e.attributes.link}:e.insert!==e.attributes.link&&(t={type:"link",url:e.attributes.link,children:[t]})),t})}_markdownToAst(e){return(0,c.l)().use(n.A).use(x).parse(e)}_mdastToDelta(e){switch(e.type){case"text":return[{insert:e.value}];case"inlineCode":return[{insert:e.value,attributes:{code:!0}}];case"strong":return e.children.flatMap(e=>this._mdastToDelta(e).map(e=>(e.attributes={...e.attributes,bold:!0},e)));case"emphasis":return e.children.flatMap(e=>this._mdastToDelta(e).map(e=>(e.attributes={...e.attributes,italic:!0},e)));case"delete":return e.children.flatMap(e=>this._mdastToDelta(e).map(e=>(e.attributes={...e.attributes,strike:!0},e)));case"link":return e.children.flatMap(t=>this._mdastToDelta(t).map(t=>(t.attributes={...t.attributes,link:e.url},t)));case"list":return[]}return"children"in e?e.children.flatMap(e=>this._mdastToDelta(e)):[]}async fromBlockSnapshot({snapshot:e,assets:t}){let{ast:i,assetsIds:s}=await this._traverseSnapshot(e,{type:"root",children:[]},t);return{file:this._astToMarkdown(i),assetsIds:s}}async fromDocSnapshot({snapshot:e,assets:t}){let i="",{file:s,assetsIds:o}=await this.fromBlockSnapshot({snapshot:e.blocks,assets:t});return{file:i+=s,assetsIds:o}}async fromSliceSnapshot({snapshot:e,assets:t}){let i="",s=[];for(let o of e.content){let e={type:"root",children:[]},{ast:r,assetsIds:a}=await this._traverseSnapshot(o,e,t);s.push(...a),i+=this._astToMarkdown(r)}return{file:i.match(/\n/g)?.length===1?i.trimEnd():i,assetsIds:s}}async toBlockSnapshot(e){let t=this._markdownToAst(e.file),i={type:"block",id:(0,r.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:d.ko.DocAndEdgeless},children:[]};return this._traverseMarkdown(t,i,e.assets)}async toDocSnapshot(e){let t=this._markdownToAst(e.file),i={type:"block",id:(0,r.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:d.ko.DocAndEdgeless},children:[]};return{type:"page",meta:{id:(0,r.Ak)(),title:"Untitled",createDate:Date.now(),tags:[]},blocks:{type:"block",id:(0,r.Ak)(),flavour:"affine:page",props:{title:{"$blocksuite:internal:text$":!0,delta:[{insert:"Untitled"}]}},children:[{type:"block",id:(0,r.Ak)(),flavour:"affine:surface",props:{elements:{}},children:[]},await this._traverseMarkdown(t,i,e.assets)]}}}async toSliceSnapshot(e){let t="";e.file=e.file.split("\n").map(e=>{if(e.trimStart().startsWith("-"))return e;let i=e.trimStart();if(!t&&i.startsWith("```")){if((t=i.substring(0,i.lastIndexOf("```")+3)).split("").every(e=>"`"===e))return e;t=""}if(!t&&i.startsWith("~~~")){if((t=i.substring(0,i.lastIndexOf("~~~")+3)).split("").every(e=>"~"===e))return e;t=""}return(t&&i.startsWith(t)&&0===i.lastIndexOf(t)&&(t=""),t)?e:e.replace(/^ /," ")}).join("\n");let i=this._markdownToAst(e.file),s={type:"block",id:(0,r.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:d.ko.DocAndEdgeless},children:[]},o=await this._traverseMarkdown(i,s,e.assets);return 0===o.children.length?null:{type:"slice",content:[o],pageVersion:e.pageVersion,workspaceVersion:e.workspaceVersion,workspaceId:e.workspaceId,pageId:e.pageId}}}},62112:(e,t,i)=>{i.d(t,{GZ:()=>l,KH:()=>c,Y3:()=>r,aK:()=>o,uy:()=>a,vC:()=>n});var s=i(71006);let o=async(e,t,i)=>{try{if(!i||e.startsWith("blob:")||e.startsWith("data:")||e.startsWith(window.location.origin))return await fetch(e,t);return await fetch(i+"?url="+encodeURIComponent(e),t).then(e=>{if(!e.ok)throw Error("Network response was not ok");return e}).catch(()=>fetch(e,t))}catch(e){return console.warn("Error fetching image:",e),null}},r=(e,t,i={force:!1})=>{if(0===e.length)return[t];let o=e[e.length-1];return i?.force?(o.insert=o.insert+t.insert,o.attributes=Object.create(null),e):"string"==typeof o.insert&&"string"==typeof t.insert&&((0,s.n4)(o.attributes,t.attributes)||void 0===o.attributes&&void 0===t.attributes)?(o.insert+=t.insert,e):[...e,t]},a=e=>null==e,n=e=>e.startsWith("http:")||e.startsWith("https:")||e.startsWith("data:"),l=e=>({"$blocksuite:internal:text$":!0,delta:0===e.length?[]:[{insert:e}]}),c=e=>"object"==typeof e&&null!==e&&"$blocksuite:internal:text$"in e&&!0===e["$blocksuite:internal:text$"]},87419:(e,t,i)=>{var s=i(7595),o=i(41507),r=i(99971),a=i(91449),n=i(4564),l=i(22805),c=i(41295),d=i(40495);let h=(0,a.AH)` .menu-item { position: relative; width: 100%; display: flex; flex-direction: row; align-items: center; padding: 4px var(--item-padding, 12px); gap: 4px; align-self: stretch; border-radius: 4px; box-sizing: border-box; } .menu-item:hover { background: var(--affine-hover-color); cursor: pointer; } .item-icon { display: flex; color: var(--item-icon-color, var(--affine-brand-color)); } .menu-item:hover .item-icon { color: var(--item-icon-hover-color, var(--affine-brand-color)); } .menu-item.discard:hover { background: var(--affine-background-error-color); .item-name, .item-icon, .enter-icon { color: var(--affine-error-color); } } .item-name { display: flex; padding: 0px 4px; align-items: baseline; flex: 1 0 0; color: var(--affine-text-primary-color); text-align: start; white-space: nowrap; font-feature-settings: 'clig' off, 'liga' off; font-size: var(--affine-font-sm); font-style: normal; font-weight: 400; line-height: 22px; } .item-beta { color: var(--affine-text-secondary-color); font-size: var(--affine-font-xs); font-weight: 500; margin-left: 0.5em; } .enter-icon, .arrow-right-icon { color: var(--affine-icon-color); display: flex; } .enter-icon { opacity: 0; } .arrow-right-icon, .menu-item:hover .enter-icon { opacity: 1; } `;var u=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},p=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,o,l,c,f=[(0,s.fF)({host:s.By.instanceOf(s.AE),item:s.By.object}),(0,n.EM)("ai-sub-item-list")],g=[],m=(0,s.Tm)(a.WF),v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[];(class extends m{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(m[Symbol.metadata]??null):void 0;i=[(0,n.MZ)({attribute:!1})],o=[(0,n.MZ)({attribute:!1})],l=[(0,n.MZ)({attribute:!1})],c=[(0,n.MZ)({attribute:!1})],u(this,null,i,{kind:"accessor",name:"abortController",static:!1,private:!1,access:{has:e=>"abortController"in e,get:e=>e.abortController,set:(e,t)=>{e.abortController=t}},metadata:s},v,y),u(this,null,o,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:s},b,w),u(this,null,l,{kind:"accessor",name:"item",static:!1,private:!1,access:{has:e=>"item"in e,get:e=>e.item,set:(e,t)=>{e.item=t}},metadata:s},x,_),u(this,null,c,{kind:"accessor",name:"onClick",static:!1,private:!1,access:{has:e=>"onClick"in e,get:e=>e.onClick,set:(e,t)=>{e.onClick=t}},metadata:s},C,k),u(null,e={value:t},f,{kind:"class",name:t.name,metadata:s},null,g),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,a.AH)` .ai-sub-menu { display: flex; flex-direction: column; box-sizing: border-box; padding: 8px; min-width: 240px; max-height: 320px; overflow-y: auto; background: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-shadow-2); border-radius: 8px; z-index: var(--affine-z-index-popover); font-family: ${(0,a.iz)(r.$7.fontSansFamily)}; color: var(--affine-text-primary-color); text-align: justify; font-feature-settings: 'clig' off, 'liga' off; font-size: var(--affine-font-sm); font-style: normal; font-weight: 400; line-height: 22px; user-select: none; } ${h} `}render(){return!this.item.subItem||this.item.subItem.length<=0?a.s6:(0,a.qy)`
${this.item.subItem?.map(e=>a.qy``)}
`}#_;get abortController(){return this.#_}set abortController(e){this.#_=e}#n;get host(){return this.#n}set host(e){this.#n=e}#C;get item(){return this.#C}set item(e){this.#C=e}#k;get onClick(){return this.#k}set onClick(e){this.#k=e}constructor(){super(...arguments),this._handleClick=e=>{e.handler&&e.handler(this.host),this.abortController.abort(),this.onClick?.()},this.#_=p(this,v,new AbortController),this.#n=(p(this,y),p(this,b,void 0)),this.#C=(p(this,w),p(this,x,void 0)),this.#k=(p(this,_),p(this,C,void 0)),p(this,k)}static{p(t,g)}})})();var f=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},g=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,o,r,l,c=[(0,s.fF)({host:s.By.instanceOf(s.AE),item:s.By.object}),(0,n.EM)("ai-item")],u=[],p=(0,s.Tm)(a.WF),m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[];(class extends p{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;i=[(0,n.MZ)({attribute:!1})],o=[(0,n.MZ)({attribute:!1})],r=[(0,n.P)(".menu-item")],l=[(0,n.MZ)({attribute:!1})],f(this,null,i,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:s},m,v),f(this,null,o,{kind:"accessor",name:"item",static:!1,private:!1,access:{has:e=>"item"in e,get:e=>e.item,set:(e,t)=>{e.item=t}},metadata:s},y,b),f(this,null,r,{kind:"accessor",name:"menuItem",static:!1,private:!1,access:{has:e=>"menuItem"in e,get:e=>e.menuItem,set:(e,t)=>{e.menuItem=t}},metadata:s},w,x),f(this,null,l,{kind:"accessor",name:"onClick",static:!1,private:!1,access:{has:e=>"onClick"in e,get:e=>e.onClick,set:(e,t)=>{e.onClick=t}},metadata:s},_,C),f(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,u),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,a.AH)` ${h} `}render(){let{item:e}=this,t=e.name.split(" ").join("-").toLocaleLowerCase();return(0,a.qy)``}#n=g(this,m,void 0);get host(){return this.#n}set host(e){this.#n=e}#C=(g(this,v),g(this,y,void 0));get item(){return this.#C}set item(e){this.#C=e}#S=(g(this,b),g(this,w,null));get menuItem(){return this.#S}set menuItem(e){this.#S=e}#k=(g(this,x),g(this,_,void 0));get onClick(){return this.#k}set onClick(e){this.#k=e}constructor(){super(...arguments),g(this,C)}static{g(t,u)}})})();var m=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},v=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,d,h,u=[(0,s.fF)({host:s.By.instanceOf(s.AE)}),(0,n.EM)("ai-item-list")],p=[],f=(0,s.Tm)(a.WF),g=[],y=[],b=[],w=[],x=[],_=[];(class extends f{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;i=[(0,n.MZ)({attribute:!1})],d=[(0,n.MZ)({attribute:!1})],h=[(0,n.MZ)({attribute:!1})],m(this,null,i,{kind:"accessor",name:"groups",static:!1,private:!1,access:{has:e=>"groups"in e,get:e=>e.groups,set:(e,t)=>{e.groups=t}},metadata:s},g,y),m(this,null,d,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:s},b,w),m(this,null,h,{kind:"accessor",name:"onClick",static:!1,private:!1,access:{has:e=>"onClick"in e,get:e=>e.onClick,set:(e,t)=>{e.onClick=t}},metadata:s},x,_),m(null,e={value:t},u,{kind:"class",name:t.name,metadata:s},null,p),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,a.AH)` :host { display: flex; flex-direction: column; gap: 2px; width: 100%; font-family: ${(0,a.iz)(r.$7.fontSansFamily)}; user-select: none; } .group-name { display: flex; padding: 4px calc(var(--item-padding, 8px) + 4px); align-items: center; color: var(--affine-text-secondary-color); text-align: justify; font-size: var(--affine-font-xs); font-style: normal; font-weight: 500; line-height: 20px; width: 100%; box-sizing: border-box; } `}render(){return(0,a.qy)`${(0,l.u)(this.groups,e=>(0,a.qy)` ${e.name?(0,a.qy)`
${e.name.toLocaleUpperCase()}
`:a.s6} ${(0,l.u)(e.items,e=>(0,a.qy)`{this.onClick?.()}} .item=${e} .host=${this.host} class=${this._itemClassName(e)} @mouseover=${()=>{this._openSubMenu(e)}} >`)} `)}`}#M;get groups(){return this.#M}set groups(e){this.#M=e}#n;get host(){return this.#n}set host(e){this.#n=e}#k;get onClick(){return this.#k}set onClick(e){this.#k=e}constructor(){super(...arguments),this._abortController=null,this._activeSubMenuItem=null,this._closeSubMenu=()=>{this._abortController&&(this._abortController.abort(),this._abortController=null),this._activeSubMenuItem=null},this._itemClassName=e=>"ai-item-"+e.name.split(" ").join("-").toLocaleLowerCase(),this._openSubMenu=e=>{if(!e.subItem||0===e.subItem.length){this._closeSubMenu();return}if(e===this._activeSubMenuItem)return;let t=this.shadowRoot?.querySelector(`.${this._itemClassName(e)}`);if(!t||!t.menuItem)return;this._closeSubMenu(),this._activeSubMenuItem=e,this._abortController=new AbortController,this._abortController.signal.addEventListener("abort",()=>{this._closeSubMenu()});let i=t.menuItem,s={mainAxis:e.subItemOffset?.[0]??12,crossAxis:e.subItemOffset?.[1]??-60};(0,c.cl)({template:(0,a.qy)``,container:i,computePosition:{referenceElement:i,placement:"right-start",middleware:[(0,o.UU)(),(0,o.cY)(s)],autoUpdate:!0},abortController:this._abortController,closeOnClickAway:!0})},this.#M=v(this,g,[]),this.#n=(v(this,y),v(this,b,void 0)),this.#k=(v(this,w),v(this,x,void 0)),v(this,_)}static{v(t,p)}})})()},49318:(e,t,i)=>{var s;i.d(t,{f:()=>s,xh:()=>n,yP:()=>a,D_:()=>r}),i(87419);class o extends Error{}!function(e){e.GeneralNetworkError="GeneralNetworkError",e.PaymentRequired="PaymentRequired",e.Unauthorized="Unauthorized"}(s||(s={}));class r extends o{constructor(){super("Unauthorized"),this.type=s.Unauthorized}}class a extends o{constructor(){super("Payment required"),this.type=s.PaymentRequired}}class n extends o{constructor(e="Network error"){super(e),this.type=s.GeneralNetworkError}}},56752:(e,t,i)=>{i.d(t,{w:()=>c});var s=i(7595),o=i(91449),r=i(4564),a=i(54719),n=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},l=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e=s.p_,t=[],i=[];return class extends e{static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(e[Symbol.metadata]??null):void 0;n(this,null,[(0,r.P)(".affine-block-component > block-caption-editor")],{kind:"accessor",name:"_captionEditor",static:!1,private:!1,access:{has:e=>"_captionEditor"in e,get:e=>e._captionEditor,set:(e,t)=>{e._captionEditor=t}},metadata:s},t,i),s&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}constructor(){super(),this.addRenderer(this._renderWithWidget)}_renderWithWidget(e){let t=(0,a.W)({position:"relative",...this.blockContainerStyles});return(0,o.qy)`
${e} ${this.useCaptionEditor?(0,o.qy)``:o.s6} ${this.showBlockSelection?(0,o.qy)``:o.s6}
`}get captionEditor(){return this.useCaptionEditor&&this._captionEditor||console.error("Oops! Please enable useCaptionEditor before accessing captionEditor"),this._captionEditor}#E=l(this,t,void 0);get _captionEditor(){return this.#E}set _captionEditor(e){this.#E=e}#I=void l(this,i);get blockContainerStyles(){return this.#I}set blockContainerStyles(e){this.#I=e}#B=!0;get showBlockSelection(){return this.#B}set showBlockSelection(e){this.#B=e}#$=!1;get useCaptionEditor(){return this.#$}set useCaptionEditor(e){this.#$=e}}})()},53401:(e,t,i)=>{i.d(t,{t:()=>a});var s=i(50620);let o=new Map,r=new Map;function a(e){let t={setMode:(t,i=e)=>{o.set(i,t),r.get(i)?.emit(t)},getMode:(t=e)=>o.get(t)??"page",toggleMode:(i=e)=>{let s="page"===t.getMode(i)?"edgeless":"page";return t.setMode(s),s},onModeChange:(t,i=e)=>(r.get(i)||r.set(i,new s.D),r.get(i).on(t))};return t}},21435:(e,t,i)=>{i.d(t,{f:()=>a});var s=i(46427),o=i(71006),r=i(60019);class a{static{this._dropResult=null}constructor(e,t){this._onDrop=e=>{this._indicator.rect=null;let{onDrop:t}=this._fileDropOptions;if(!t)return;let i=e.dataTransfer;if(!i||"none"===i.effectAllowed)return;let s=i.files;if(!s||!s.length)return;e.preventDefault();let{targetModel:o,type:r}=this,{x:a,y:n}=e;t({files:[...s],targetModel:o,place:r,point:[a,n]})?.catch(console.error)},this.onDragLeave=()=>{a._dropResult=null,this._indicator.rect=null},this.onDragOver=e=>{e.preventDefault();let t=e.dataTransfer;if(!t||"none"===t.effectAllowed)return;let{clientX:i,clientY:o}=e,n=new s.b(i,o),l=(0,r.hF)(n.clone()),c=null;if(l){let e=(0,r.BE)(l),t=this.doc.getParent(e);(0,r.op)(t,["affine:surface"])||(c=(0,r.Ip)(n,e,l))}c?(a._dropResult=c,this._indicator.rect=c.rect):(a._dropResult=null,this._indicator.rect=null)},this._blockService=e,this._fileDropOptions=t,this._indicator=document.querySelector("affine-drag-indicator"),this._indicator||(this._indicator=document.createElement("affine-drag-indicator"),document.body.append(this._indicator)),t.onDrop&&this._blockService.disposables.addFromEvent(this._blockService.std.host,"drop",this._onDrop)}get doc(){return this._blockService.doc}get editorHost(){return this._blockService.std.host}get targetModel(){let e=a._dropResult?.modelState.model||null;if(!e&&(0,r.zU)(this.editorHost)){let t=this.doc.root;(0,o.Z1)(t);let i=t.children[t.children.length-1];if(!i||!(0,r.op)(i,["affine:note"])){let e=this.doc.addBlock("affine:note",{},t.id),s=this.doc.getBlockById(e);(0,o.Z1)(s),i=s}let s=i.children[i.children.length-1];if(s)e=s;else{let t=this.doc.addBlock("affine:paragraph",{},i,0),s=this.doc.getBlockById(t);(0,o.Z1)(s),e=s}}return e}get type(){return a._dropResult&&"before"===a._dropResult.type?"before":"after"}}},76238:(e,t,i)=>{i.d(t,{n:()=>l});var s=i(69050),o=i(41295),r=i(31319);let a={transition:{duration:100,in:{opacity:"1",transition:"opacity 0.1s ease-in-out"},out:{opacity:"0",transition:"opacity 0.1s ease-in-out"}},setPortalAsFloating:!0,allowMultiple:!1},n=({portal:e,hoverOptions:t,abortController:i})=>{if(!e||!t.transition){i.abort();return}Object.assign(e.style,t.transition.out),e.addEventListener("transitionend",()=>{i.abort()},{signal:i.signal}),e.addEventListener("transitioncancel",()=>{i.abort()},{signal:i.signal}),setTimeout(()=>i.abort(),t.transition.duration)};class l{constructor(e,t,i){this._disposables=new s.K,this._isHovering=!1,this._setReference=()=>{console.error("setReference is not ready")},this.onAbort=()=>{this.abort()},this._hoverOptions={...a,...i},(this.host=e).addController(this),this._onHover=t}abort(e=!1){if(this._abortController){if(e){this._abortController.abort();return}n({portal:this._portal,hoverOptions:this._hoverOptions,abortController:this._abortController})}}hostConnected(){this._disposables.disposed&&(this._disposables=new s.K);let{setReference:e,setFloating:t,dispose:i}=(0,r.H)(i=>{if(!this.host.isConnected)return;if(this._isHovering=i,!i){this.onAbort();return}if(this._abortController)return;this._abortController=new AbortController,this._abortController.signal.addEventListener("abort",()=>{this._abortController=void 0}),this._hoverOptions.allowMultiple||(l.globalAbortController?.abort(),l.globalAbortController=this._abortController);let s=this._onHover({setReference:e,abortController:this._abortController});if(!s){this._abortController.abort();return}this._portal=(0,o.cl)({...s,abortController:this._abortController});let r=this._hoverOptions.transition;r&&Object.assign(this._portal.style,r.in),this._hoverOptions.setPortalAsFloating&&t(this._portal)},this._hoverOptions);this._setReference=e,this._disposables.add(i)}hostDisconnected(){this._abortController?.abort(),this._disposables.dispose()}get isHovering(){return this._isHovering}get portal(){return this._portal}get setReference(){return this._setReference}}},4068:(e,t,i)=>{i.d(t,{H:()=>o.H,n:()=>s.n});var s=i(76238),o=i(31319)},31319:(e,t,i)=>{i.d(t,{H:()=>u});var s=i(64816);let o=(e=!0)=>{let t=!1;return({event:i,floatingElement:s})=>{let o=t;return"mouseover"===i.type?o!==(t=!0)||!!e&&(!s||!s.isConnected):"mouseleave"===i.type?!!(o!==(t=!1)||e&&s?.isConnected):(console.warn("Unknown event type in hover middleware",i),!0)}},r=e=>{let t=new AbortController;return async({event:i})=>{t.abort();let o=new AbortController;return t=o,"mouseover"!==i.type||e<=0||(await (0,s.yy)(e,o.signal),!o.signal.aborted)}},a=e=>{let t=new AbortController;return async({event:i})=>{t.abort();let o=new AbortController;return t=o,"mouseleave"!==i.type||e<=0||(await (0,s.yy)(e,o.signal),!o.signal.aborted)}};function n({x:e,y:t},{x:i,y:s},{x:o,y:r},{x:a,y:n}){let l=(i-e)*(n-r)-(a-o)*(s-t);if(0===l)return!1;{let c=((n-r)*(a-e)+(o-a)*(n-t))/l,d=((t-s)*(a-e)+(i-e)*(n-t))/l;return 0=i.left-s&&e<=i.right+s&&t>=i.top-s&&t<=i.bottom-s}let c=(e,t)=>{let i={x:t.x+t.width/2,y:t.y+t.height/2},s={x:t.x,y:t.y},o={x:t.right,y:t.y},r={x:t.x,y:t.bottom},a={x:t.right,y:t.bottom};return n(e,i,r,a)?["top",r,a]:n(e,i,s,o)?["bottom",s,o]:n(e,i,s,r)?["right",s,r]:n(e,i,o,a)?["left",o,a]:null},d=({zIndex:e=1e4,buffer:t=2,idleTimeout:i=40,debug:s=!1}={})=>{let o=new AbortController;return async({event:r,referenceElement:a,floatingElement:n})=>{o.abort();let d=new AbortController;if(o=d,"mouseleave"!==r.type||r.target!==a)return!0;if(!(r instanceof MouseEvent))return console.warn("Unknown event type in hover middleware",r),!0;if(!n)return!0;let h=r.x,u=r.y,p=a.getBoundingClientRect(),f=n.getBoundingClientRect();if(l({x:h,y:u},p))return!0;let g=c({x:h,y:u},f);if(!g)return!0;let m=g[0];if("top"===m&&u>=p.bottom-1||"bottom"===m&&u<=p.top+1||"left"===m&&h>=p.right-1||"right"===m&&h<=p.left+1)return!0;let v=document.createElementNS("http://www.w3.org/2000/svg","svg"),y=document.createElementNS("http://www.w3.org/2000/svg","path"),b=(i,s)=>{if(d.signal.aborted)return;i>=f.left&&i<=f.right&&s>=f.top&&s<=f.bottom&&d.abort();let o={x:i,y:s},r=g[1],a=g[2],n={x:Math.min(o.x,r.x,a.x)-t,y:Math.min(o.y,r.y,a.y)-t},l=Math.max(Math.abs(o.y-r.y),Math.abs(o.y-a.y),Math.abs(r.y-a.y)),c=Math.max(Math.abs(o.x-r.x),Math.abs(o.x-a.x),Math.abs(r.x-a.x));Object.assign(v.style,{position:"fixed",pointerEvents:"none",width:c+2*t,height:l+2*t,zIndex:e,top:0,left:0,transform:`translate(${n.x}px, ${n.y}px)`}),y.setAttributeNS(null,"d",`M${o.x-n.x} ${o.y-n.y} ${r.x-n.x} ${r.y-n.y} ${a.x-n.x} ${a.y-n.y} z`)};y.setAttributeNS(null,"pointer-events","auto"),y.setAttributeNS(null,"fill","transparent"),y.setAttributeNS(null,"stroke-width",t.toString()),y.setAttributeNS(null,"stroke","transparent"),s&&y.setAttributeNS(null,"stroke","red"),b(h,u),v.append(y),document.body.append(v),o.signal.addEventListener("abort",()=>v.remove());let w=0,x=window.setTimeout(()=>d.abort(),i);return v.addEventListener("mousemove",e=>{clearTimeout(x),x=window.setTimeout(()=>d.abort(),i),cancelAnimationFrame(w),w=requestAnimationFrame(()=>b(e.clientX,e.clientY))},{signal:d.signal}),await new Promise(e=>{d.signal.aborted&&e(),d.signal.addEventListener("abort",()=>e()),v.addEventListener("mouseleave",()=>d.abort(),{signal:d.signal})}),!0}},h=({debug:e=!1,idleTimeout:t=500}={})=>{let i=new AbortController;return async({event:s,referenceElement:o,floatingElement:r})=>{i.abort();let a=new AbortController;if(i=a,"mouseleave"!==s.type||s.target!==o)return!0;if(!(s instanceof MouseEvent))return console.warn("Unknown event type in hover middleware",s),!0;if(!r)return!0;let n=(t,i)=>{let s;if(a.signal.aborted)return!1;let n={x:t,y:i},d=o.getBoundingClientRect(),h=r.getBoundingClientRect(),u=c(n,h);if(!u)return!1;let p=u[0];if("top"===p&&i>d.top+1||"bottom"===p&&id.left+1||"right"===p&&tt.remove())}return f};return!n(s.x,s.y)||(await new Promise(e=>{a.signal.aborted&&e(),a.signal.addEventListener("abort",()=>e());let i=window.setTimeout(()=>a.abort(),t);document.addEventListener("mousemove",e=>{clearTimeout(i),i=window.setTimeout(()=>a.abort(),t),n(e.clientX,e.clientY)||a.abort()},{signal:a.signal})}),!0)}},u=(e,{enterDelay:t=0,leaveDelay:i=250,alwayRunWhenNoFloating:s=!0,safeTriangle:n=!1,safeBridge:l=!0}={})=>{let c,u;let p=new AbortController,f=[o(s),n&&d("boolean"==typeof n?void 0:n),l&&h("boolean"==typeof l?void 0:l),r(t),a(i)].filter(e=>"boolean"!=typeof e),g=null,m=async t=>{for(let e of(g=t,f))if(!await e({event:t,floatingElement:u,referenceElement:c}))return;t===g&&e("mouseover"===t.type,t)},v=e=>{e&&(e.matches(":hover")&&!p.signal.aborted&&m(new MouseEvent("mouseover")),e.addEventListener("mouseover",m,{capture:!0,signal:p.signal}),e.addEventListener("mouseleave",m,{signal:p.signal}))},y=e=>{e&&(e.removeEventListener("mouseover",m),e.removeEventListener("mouseleave",m))};return{setReference:e=>{y(c),v(e),c=e},setFloating:e=>{y(u),v(e),u=e},dispose:()=>{p.abort()}}}},1325:(e,t,i)=>{i.d(t,{f:()=>s.f,wN:()=>g.w,Yz:()=>w,n9:()=>x.n,YE:()=>S.YE,sD:()=>E.s,m_:()=>B.m,ti:()=>m.t,cl:()=>M.cl,mP:()=>_.mP,fx:()=>_.fx,Yl:()=>S.Yl,mV:()=>S.mV,se:()=>S.se,tq:()=>S.tq,$E:()=>_.$E,zs:()=>_.zs,kM:()=>$.kM,oR:()=>I.o});var s=i(49318),o=i(7595),r=i(73711),a=i(91449),n=i(4564),l=i(8834),c=i(23156),d=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},h=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,u,p,f=[(0,n.EM)("block-caption-editor")],g=[],m=(0,o.Tm)(o.ao),v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[];(class extends m{static{t=this}static{let o="function"==typeof Symbol&&Symbol.metadata?Object.create(m[Symbol.metadata]??null):void 0;i=[(0,n.MZ)({attribute:!1})],s=[(0,n.wk)()],u=[(0,n.wk)()],p=[(0,n.P)(".block-caption-editor")],d(this,null,i,{kind:"accessor",name:"block",static:!1,private:!1,access:{has:e=>"block"in e,get:e=>e.block,set:(e,t)=>{e.block=t}},metadata:o},v,y),d(this,null,s,{kind:"accessor",name:"caption",static:!1,private:!1,access:{has:e=>"caption"in e,get:e=>e.caption,set:(e,t)=>{e.caption=t}},metadata:o},b,w),d(this,null,u,{kind:"accessor",name:"display",static:!1,private:!1,access:{has:e=>"display"in e,get:e=>e.display,set:(e,t)=>{e.display=t}},metadata:o},x,_),d(this,null,p,{kind:"accessor",name:"input",static:!1,private:!1,access:{has:e=>"input"in e,get:e=>e.input,set:(e,t)=>{e.input=t}},metadata:o},C,k),d(null,e={value:t},f,{kind:"class",name:t.name,metadata:o},null,g),t=e.value,o&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static{this.styles=(0,a.AH)` .block-caption-editor { display: inline-table; resize: none; width: 100%; outline: none; border: 0; background: transparent; color: var(--affine-icon-color); font-size: var(--affine-font-sm); font-family: inherit; text-align: center; } .block-caption-editor::placeholder { color: var(--affine-placeholder-color); } `}_onCaptionKeydown(e){if(e.stopPropagation(),!this.block.isInSurface&&!e.isComposing&&"Enter"===e.key){e.preventDefault();let t=this.block.doc,i=e.target,s=i.selectionStart;if(null===s)return;let o=this.block.model,a=t.getParent(o);if(!a)return;let n=i.value,l=n.slice(0,s);t.updateBlock(o,{caption:l});let d=n.slice(s),h=a.children.indexOf(o),u=t.addBlock("affine:paragraph",{text:new r.EY(d)},a,h+1);c.Km(this.block.host,u)?.catch(console.error)}}_onInputBlur(){this._focus=!1,this.display=!!this.caption?.length}_onInputChange(e){let t=e.target;this.caption=t.value,this.block.doc.updateBlock(this.block.model,{caption:this.caption})}_onInputFocus(){this._focus=!0}connectedCallback(){super.connectedCallback(),this.caption=this.block.model.caption,this.disposables.add(this.block.model.propsUpdated.on(({key:e})=>{"caption"!==e||(this.caption=this.block.model.caption,this._focus||(this.display=!!this.caption?.length))}))}render(){return this.display||this.caption?(0,a.qy)``:a.s6}#T;get block(){return this.#T}set block(e){this.#T=e}#O;get caption(){return this.#O}set caption(e){this.#O=e}#e;get display(){return this.#e}set display(e){this.#e=e}#P;get input(){return this.#P}set input(e){this.#P=e}constructor(){super(...arguments),this._focus=!1,this.show=()=>{this.display=!0,this.updateComplete.then(()=>this.input.focus()).catch(console.error)},this.#T=h(this,v,void 0),this.#O=(h(this,y),h(this,b,void 0)),this.#e=(h(this,w),h(this,x,!1)),this.#P=(h(this,_),h(this,C,void 0)),h(this,k)}static{h(t,g)}})})();var u=i(31980),p=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},f=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,n.EM)("affine-block-selection")],l=[],c=(0,u.Jb)(a.WF),d=[],h=[],g=[],m=[],v=[],y=[];(class extends c{static{t=this}static{let a="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,n.MZ)({attribute:!1})],s=[(0,n.MZ)({attribute:!1})],o=[(0,n.MZ)({attribute:!1})],p(this,null,i,{kind:"accessor",name:"block",static:!1,private:!1,access:{has:e=>"block"in e,get:e=>e.block,set:(e,t)=>{e.block=t}},metadata:a},d,h),p(this,null,s,{kind:"accessor",name:"borderRadius",static:!1,private:!1,access:{has:e=>"borderRadius"in e,get:e=>e.borderRadius,set:(e,t)=>{e.borderRadius=t}},metadata:a},g,m),p(this,null,o,{kind:"accessor",name:"borderWidth",static:!1,private:!1,access:{has:e=>"borderWidth"in e,get:e=>e.borderWidth,set:(e,t)=>{e.borderWidth=t}},metadata:a},v,y),p(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,l),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a})}static{this.styles=(0,a.AH)` :host { position: absolute; z-index: 1; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; background-color: var(--affine-hover-color); border-color: transparent; border-style: solid; } `}connectedCallback(){super.connectedCallback(),this.style.borderRadius=`${this.borderRadius}px`,0!==this.borderWidth&&(this.style.boxSizing="content-box",this.style.transform=`translate(-${this.borderWidth}px, -${this.borderWidth}px)`),this.style.borderWidth=`${this.borderWidth}px`}updated(e){super.updated(e),this.style.display=this.block.selected?.is("block")?"block":"none"}#T=f(this,d,void 0);get block(){return this.#T}set block(e){this.#T=e}#H=(f(this,h),f(this,g,5));get borderRadius(){return this.#H}set borderRadius(e){this.#H=e}#A=(f(this,m),f(this,v,0));get borderWidth(){return this.#A}set borderWidth(e){this.#A=e}constructor(){super(...arguments),f(this,y)}static{f(t,l)}})})();var g=i(56752),m=i(53401),v=i(54719),y=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},b=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,n.EM)("affine-drag-indicator")],s=[],o=a.WF,r=[],l=[];return class extends o{static{t=this}static{let a="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;y(this,null,[(0,n.MZ)({attribute:!1})],{kind:"accessor",name:"rect",static:!1,private:!1,access:{has:e=>"rect"in e,get:e=>e.rect,set:(e,t)=>{e.rect=t}},metadata:a},r,l),y(null,e={value:t},i,{kind:"class",name:t.name,metadata:a},null,s),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a})}static{this.styles=(0,a.AH)` .affine-drag-indicator { position: absolute; top: 0; left: 0; background: var(--affine-primary-color); transition-property: width, height, transform; transition-duration: 100ms; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-delay: 0s; transform-origin: 0 0; pointer-events: none; z-index: 2; } `}render(){if(!this.rect)return null;let{left:e,top:t,width:i,height:s}=this.rect,o=(0,v.W)({width:`${i}px`,height:`${s}px`,transform:`translate(${e}px, ${t}px)`});return(0,a.qy)`
`}#L=b(this,r,null);get rect(){return this.#L}set rect(e){this.#L=e}constructor(){super(...arguments),b(this,l)}static{b(t,s)}},t})();i(21435);var x=i(4068),_=i(52538),C=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},k=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,n.EM)("menu-divider")],r=[],l=a.WF,c=[],d=[],h=[],u=[];(class extends l{static{t=this}static{let a="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,n.MZ)({attribute:!1})],s=[(0,n.MZ)({attribute:!1})],C(this,null,i,{kind:"accessor",name:"dividerMargin",static:!1,private:!1,access:{has:e=>"dividerMargin"in e,get:e=>e.dividerMargin,set:(e,t)=>{e.dividerMargin=t}},metadata:a},c,d),C(this,null,s,{kind:"accessor",name:"vertical",static:!1,private:!1,access:{has:e=>"vertical"in e,get:e=>e.vertical,set:(e,t)=>{e.vertical=t}},metadata:a},h,u),C(null,e={value:t},o,{kind:"class",name:t.name,metadata:a},null,r),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a})}static{this.styles=(0,a.AH)` :host { display: inline-block; } .divider { background-color: var(--affine-border-color); } .divider.vertical { width: 1px; height: 100%; margin: 0 var(--divider-margin); } .divider.horizontal { width: 100%; height: 1px; margin: var(--divider-margin) 0; } `}render(){let e=(0,v.W)({"--divider-margin":`${this.dividerMargin}px`});return(0,a.qy)`
`}#D=k(this,c,7);get dividerMargin(){return this.#D}set dividerMargin(e){this.#D=e}#Z=(k(this,d),k(this,h,!1));get vertical(){return this.#Z}set vertical(e){this.#Z=e}constructor(){super(...arguments),k(this,u)}static{k(t,r)}})})();var S=i(52222),M=i(41295),E=i(36970),I=i(97878),B=i(45378),$=i(75404)},52538:(e,t,i)=>{i.d(t,{$E:()=>C,fx:()=>x,mP:()=>w,zs:()=>_});var s=i(7595),o=i(41507),r=i(91449),a=i(4564),n=i(83951),l=i(9013),c=i(45601),d=i(22805),h=i(54719),u=i(80796),p=i(69147),f=i(82750),g=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},m=function(e,t,i){for(var s=arguments.length>2,o=0;o"select"===e.type,y=(()=>{let e,t,i,y,b,w=[(0,a.EM)("affine-menu")],x=[],_=(0,s.Tm)(s.ao),C=[],k=[],S=[],M=[],E=[],I=[];var B=class extends _{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(_[Symbol.metadata]??null):void 0;i=[(0,a.wk)()],y=[(0,a.wk)()],b=[(0,a.MZ)({attribute:!1})],g(this,null,i,{kind:"accessor",name:"_selectedIndex",static:!1,private:!1,access:{has:e=>"_selectedIndex"in e,get:e=>e._selectedIndex,set:(e,t)=>{e._selectedIndex=t}},metadata:s},C,k),g(this,null,y,{kind:"accessor",name:"_text",static:!1,private:!1,access:{has:e=>"_text"in e,get:e=>e._text,set:(e,t)=>{e._text=t}},metadata:s},S,M),g(this,null,b,{kind:"accessor",name:"options",static:!1,private:!1,access:{has:e=>"options"in e,get:e=>e.options,set:(e,t)=>{e.options=t}},metadata:s},E,I),g(null,e={value:t},w,{kind:"class",name:t.name,metadata:s},null,x),B=t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,r.AH)` affine-menu { font-family: var(--affine-font-family); display: flex; flex-direction: column; user-select: none; min-width: 276px; box-shadow: var(--affine-shadow-2); border-radius: 8px; background-color: var(--affine-background-overlay-panel-color); padding: 8px; position: absolute; z-index: 999; } affine-menu * { box-sizing: border-box; } .affine-menu-body { display: flex; flex-direction: column; gap: 4px; } .affine-menu-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; } /* .affine-menu-header .icon { } */ .affine-menu-header input { flex: 1; border-radius: 4px; outline: none; font-size: 14px; line-height: 22px; padding: 5px 12px; border: 1px solid var(--affine-border-color); } .affine-menu-header input::placeholder { color: var(--affine-placeholder-color); } .affine-menu-header input:focus { border: 1px solid var(--affine-primary-color); } .affine-menu-action { padding: 4px 12px; cursor: pointer; display: flex; gap: 4px; border-radius: 4px; } .affine-menu-action svg { width: 20px; height: 20px; } .affine-menu-action .icon { display: flex; align-items: center; justify-content: center; color: var(--affine-icon-color); fill: var(--affine-icon-color); } .affine-menu-action .content { border-radius: 4px; cursor: pointer; white-space: nowrap; justify-content: space-between; display: flex; align-items: center; font-size: 14px; line-height: 22px; flex: 1; gap: 8px; } .affine-menu-action.selected { background-color: var(--affine-hover-color); } .affine-menu-action.selected.delete-item { background-color: var(--affine-background-error-color); color: var(--affine-error-color); } .affine-menu-action.selected.delete-item .icon > svg { color: var(--affine-error-color); } .affine-menu-action.selected-item { color: var(--affine-text-emphasis-color); } .affine-menu-action.selected-item .icon { color: var(--affine-text-emphasis-color); fill: currentColor; } .database-menu-component-action-button:hover { background-color: rgba(0, 0, 0, 0.1); } .no-results { font-size: 12px; line-height: 20px; color: var(--affine-text-secondary-color); display: flex; align-items: center; justify-content: center; margin-top: 8px; } .affine-menu-action-text { flex: 1; padding: 0 4px; } `}_isConsciousChoice(){return Date.now(){this.focusInput()});let t=e.value.length;e.setSelectionRange(t,t),this._disposables.addFromEvent(e,"keydown",e=>{if(e.stopPropagation(),"Escape"===e.key){this.close();return}if("Enter"===e.key&&!e.isComposing){let e=this.selectedItem;e?e.select():(this.options.input?.onComplete?.(this.text),this._complete());return}if("ArrowUp"===e.key){e.preventDefault(),this.selectedIndex=null!=this.selectedIndex?this.selectedIndex-1:this.minIndex;return}if("ArrowDown"===e.key){e.preventDefault(),this.selectedIndex=null!=this.selectedIndex?this.selectedIndex+1:this.minIndex;return}}),this._disposables.addFromEvent(e,"copy",e=>{e.stopPropagation()}),this._disposables.addFromEvent(e,"cut",e=>{e.stopPropagation()})}}processItems(){this.allItems=[],this.selectableItems=[],this.options.items.flatMap(e=>this.process(e)).forEach(e=>{let t=v(e);this.allItems.push({...e,index:t?this.selectableItems.length:void 0}),t&&this.selectableItems.push(e)})}render(){this.processItems(),this.selectedIndex=this._selectedIndex;let e=this.showHeader(),t=(0,h.W)({opacity:e?"1":"0",height:e?void 0:"0",overflow:e?void 0:"hidden",position:e?void 0:"absolute"}),i=this.selectableItems.length>0&&e&&this.options.input?.divider!==!1;return(0,r.qy)`
${this.options.input?(0,r.qy)`
${this.options.input.icon?(0,r.qy)`
${this.options.input.icon}
`:r.s6}
${i?(0,r.qy)``:null}`:null}
${0===this.selectableItems.length&&this.isSearchMode?(0,r.qy)`
No Results
`:""} ${(0,d.u)(this.allItems,(e,t)=>{let i=e.index,s=0===i,o=e.upDivider||this.allItems[t-1]?.downDivider,a=()=>{this._mouseEnter(i)};if("ui"===e.type)return(0,r.qy)` ${o?(0,r.qy)``:null}
${e.render()}
`;let l=e.class||"affine-menu-item",c=(0,n.H)({"affine-menu-action":!0,selected:"select"===e.type&&this._selectedIndex===i,[l]:!0});return(0,r.qy)` ${o&&!s?(0,r.qy)``:null}
{v(e)&&e.select()}} @mouseenter=${a} >
${e.label()}
`})}
`}#j;get _selectedIndex(){return this.#j}set _selectedIndex(e){this.#j=e}#V;get _text(){return this.#V}set _text(e){this.#V=e}#z;get options(){return this.#z}set options(e){this.#z=e}constructor(){super(...arguments),this._checked={},this._clickContainer=e=>{e.stopPropagation(),this.focusInput()},this._complete=()=>{this.options.onComplete?.(),this.close()},this._inputText=e=>{let t=e.target;this.text=t.value},this._mouseEnter=e=>{this._isConsciousChoice()||e===this.selectedIndex||(this.selectedIndex=e,this.clearSubMenu(),this.selectedItem?.mouseEnter?.())},this.allItems=[],this.initTime=0,this.inputRef=(0,c._)(),this.processMap={action:e=>{let t=e.icon?(0,r.qy)`
${e.icon}
`:r.s6,i=e.postfix??(e.isSelected?p.eqL:void 0),s=i?(0,r.qy)`
${i}
`:r.s6;return[{type:"select",label:()=>(0,r.qy)` ${t}
${e.label?.()??e.name}
${s} `,onHover:e.onHover,select:()=>{e.select(),this._complete()},class:e.class??(e.isSelected?"selected-item":"")}]},checkbox:e=>{let t=e.postfix?(0,r.qy)`
${e.postfix}
`:r.s6,i=this.getChecked(e.name)??e.checked;return[{type:"select",label:()=>(0,r.qy)`
${i?(0,u.xY)():(0,u.wb)()}
${e.label?.()??e.name}
${t} `,select:()=>{this.setChecked(e.name,e.select(i))},class:e.class??""}]},"toggle-switch":e=>{let t=e.postfix?(0,r.qy)`
${e.postfix}
`:r.s6,i=t=>{e.onChange(t)};return[{type:"normal",label:()=>(0,r.qy)`
${e.label?.()??e.name}
${t} `,class:e.class??""}]},group:e=>{let t=e.children().flatMap(e=>this.process(e));return t[0]&&(t[0].upDivider=!0),t[t.length-1]&&(t[t.length-1].downDivider=!0),t},"sub-menu":e=>{let t=()=>{this.subMenu?.remove(),setTimeout(()=>{let t=new B,i=e.options;t.options={...i,onClose:()=>{i.onClose?.(),this.clearSubMenu()},onComplete:()=>{this._complete()}},this.append(t),(0,o.rD)(this,t,{placement:"right-start",middleware:[(0,o.UU)({fallbackPlacements:["left-start","right-end","left-end"]}),(0,o.cY)(4)]}).then(({x:e,y:i})=>{Object.assign(t.style,{left:`${e}px`,top:`${i}px`})}).catch(console.error),this.subMenu=t})},i=(0,r.qy)`
${e.postfix??p.OTM}
`;return[{type:"select",label:()=>(0,r.qy)`${e.icon?(0,r.qy)`
${e.icon}
`:r.s6}
${e.label?.()??e.name}
${i}`,mouseEnter:t,select:()=>{e.select?.(),e.select?this._complete():t()},class:e.isSelected?"selected-item":""}]},custom:e=>[{type:"ui",render:e.render}]},this.mouseEnterHeader=()=>{this.isSearchMode||this._mouseEnter(-1)},this.#j=m(this,C,void 0),this.#V=(m(this,k),m(this,S,void 0)),this.#z=(m(this,M),m(this,E,void 0)),m(this,I)}static{m(t,x)}};return B=t})(),b=e=>(e.closest("editor-host")??e.closest(".data-view-popup-container"))||document.body,w=(e=document.body)=>{let t=document.createElement("div");return t.style.pointerEvents="auto",t.style.position="absolute",t.style.left="0",t.style.top="0",t.style.width="100%",t.style.height="100%",t.style.zIndex="1001",t.style.fontFamily="var(--affine-font-family)",e.append(t),t},x=(e,t,i)=>{let s=w(i?.container??b(e));return(0,o.ll)(e,t,()=>{(0,o.rD)(e,t,{placement:i?.placement,middleware:i?.middleware??[(0,o.BN)({crossAxis:!0})]}).then(({x:e,y:i})=>{Object.assign(t.style,{left:`${e}px`,top:`${i}px`})}).catch(console.error)}),s.append(t),s.onmousedown=e=>{e.target===s&&(s.remove(),i?.onClose?.())},s.oncontextmenu=e=>{e.preventDefault(),e.target===s&&(s.remove(),i?.onClose?.())},()=>s.remove()},_=(e,t)=>{let i=new y;i.options={...t.options,onClose:()=>{t.options.onClose?.(),s()}};let s=x(e,i,{onClose:t.options.onClose,middleware:t.middleware,container:t.container,placement:t.placement});return{close:s}},C=(e,t,i)=>{_(e,{options:{input:{placeholder:"Search",search:!0},items:t,onClose:i}})}},52222:(e,t,i)=>{i.d(t,{YE:()=>l,Yl:()=>d,mV:()=>a,se:()=>n,tq:()=>h});var s=i(71006);class o{constructor(e,t){this.target=e,this.enable=t,this.getRootService=()=>this.target.std.spec.getService("affine:page"),this.peek=e=>Promise.resolve(this.getRootService().peekViewService?.peek(this.target,e))}get peekable(){return!!this.getRootService().peekViewService&&(!this.enable||this.enable(this.target))}}let r=Symbol("peekable"),a=e=>Reflect.has(e,r)&&e[r]?.peekable,n=(e,t)=>{a(e)&&e[r]?.peek(t)},l=(e={action:["double-click","shift-click"]})=>(t,i)=>{var a;(0,s.Z1)("class"===i.kind),void 0===e.action&&(e.action=["double-click","shift-click"]);let n=Array.isArray(e.action)?e.action:e.action?[e.action]:[];return class extends t{constructor(){super(...arguments),this[a]=new o(this,e.enableOn)}static{a=r}connectedCallback(){super.connectedCallback();let t=(e.selector?this.querySelector(e.selector):this)||this;n.includes("double-click")&&this.disposables.addFromEvent(t,"dblclick",e=>{this[r].peekable&&(e.stopPropagation(),this[r].peek().catch(console.error))}),n.includes("shift-click")&&this.disposables.addFromEvent(t,"click",e=>{e.shiftKey&&this[r].peekable&&(e.stopPropagation(),e.stopImmediatePropagation(),this[r].peek().catch(console.error))})}}},c=e=>{let[t,i]=e.std.command.chain().tryAll(e=>[e.getTextSelection(),e.getBlockSelections()]).getSelectedBlocks({types:["text","block"]}).run();return((t?i.selectedBlocks:[])||[]).filter(a)},d=(e,t)=>{let i=c(e);i.length>0&&t({selectedPeekableBlocks:i})},h=(e,t)=>{let i=c(e).at(0);i&&(n(i),t())}},41295:(e,t,i)=>{i.d(t,{cl:()=>h,p0:()=>d});var s=i(71006),o=i(50620),r=i(41507),a=i(91449),n=i(4564),l=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},c=function(e,t,i){for(var s=arguments.length>2,o=0;o{l.remove()});let c=r?l.shadowRoot:l;(0,s.Z1)(c);let d=0,h=t=>{if(t!==d){console.warn("Potentially infinite recursion! Please clean up the old event listeners before `updatePortal`");return}let i=++d,r=e instanceof Function?e({updatePortal:()=>h(i)}):e;(0,s.Z1)(r),(0,a.XX)(r,c,o)};return h(d),t.append(l),l}function h({computePosition:e,abortController:t,closeOnClickAway:i=!1,...a}){let n=new o.D,l=a.template,c=l instanceof Function?({updatePortal:e})=>l({updatePortal:e,positionSlot:n=new o.D}):l,h=d({...a,signal:t.signal,template:c});if(i&&setTimeout(()=>document.addEventListener("click",e=>{h.contains(e.target)||t.abort()},{signal:t.signal})),!e)return h;let u=h.style.visibility;h.style.visibility="hidden",h.style.position="fixed",h.style.left="0",h.style.top="0",Object.assign(h.style,a.portalStyles);let p=e instanceof Function?e(h):e,{referenceElement:f,...g}=p;(0,s.Z1)(f,"referenceElement is required");let m=()=>{!1!==p.abortWhenRefRemoved&&f instanceof Element&&!(f.checkVisibility?f.checkVisibility():!!f.isConnected&&(!(f instanceof HTMLElement)||null!==f.offsetParent))&&t.abort(),(0,r.rD)(f,h,g).then(e=>{let{x:t,y:i}=e;h.style.left=`${t}px`,h.style.top=`${i}px`,"hidden"===h.style.visibility&&(h.style.visibility=u),n.emit(e)}).catch(console.error)};if(p.autoUpdate){let e=!0===p.autoUpdate?{}:p.autoUpdate,i=(0,r.ll)(f,h,m,e);t.signal.addEventListener("abort",()=>{i()})}else m();return h}(()=>{let e,t,i,s,o,r=[(0,n.EM)("blocksuite-portal")],d=[],h=a.WF,u=[],p=[],f=[],g=[],m=[],v=[];(class extends h{static{t=this}static{let a="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,n.MZ)({attribute:!1})],s=[(0,n.MZ)({attribute:!1})],o=[(0,n.MZ)({attribute:!1})],l(this,null,i,{kind:"accessor",name:"container",static:!1,private:!1,access:{has:e=>"container"in e,get:e=>e.container,set:(e,t)=>{e.container=t}},metadata:a},u,p),l(this,null,s,{kind:"accessor",name:"shadowDom",static:!1,private:!1,access:{has:e=>"shadowDom"in e,get:e=>e.shadowDom,set:(e,t)=>{e.shadowDom=t}},metadata:a},f,g),l(this,null,o,{kind:"accessor",name:"template",static:!1,private:!1,access:{has:e=>"template"in e,get:e=>e.template,set:(e,t)=>{e.template=t}},metadata:a},m,v),l(null,e={value:t},r,{kind:"class",name:t.name,metadata:a},null,d),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),c(t,d)}createRenderRoot(){let e=document.createElement("div"),t=this.shadowDom?e.attachShadow({mode:"open",..."boolean"!=typeof this.shadowDom?this.shadowDom:{}}):e;return e.classList.add("blocksuite-portal"),this.container.append(e),this._portalRoot=e,t}disconnectedCallback(){super.disconnectedCallback(),this._portalRoot?.remove()}render(){return this.template}#r;get container(){return this.#r}set container(e){this.#r=e}#R;get shadowDom(){return this.#R}set shadowDom(e){this.#R=e}#F;get template(){return this.#F}set template(e){this.#F=e}constructor(){super(...arguments),this._portalRoot=null,this.#r=c(this,u,document.body),this.#R=(c(this,p),c(this,f,!0)),this.#F=(c(this,g),c(this,m,(0,a.qy)``)),c(this,v)}})})()},36970:(e,t,i)=>{i.d(t,{s:()=>w});var s=i(7595),o=i(71006),r=i(46317),a=i(73711),n=i(91449),l=i(4564),c=i(83951),d=i(67448),h=i(30955);let u=["code","link"],p=[],f=e=>{if(" "!==e.data)return;if(e.attributes?.link){e.inlineRange.index===e.inlineEditor.yText.length&&delete e.attributes.link;return}let t=e.inlineEditor.getLine(e.inlineRange.index);if(!t)return;let{line:i,lineIndex:s,rangeIndexRelatedToLine:o}=t;if(0!==s)return;let r=i.vTextContent.slice(0,o).split(" "),a=r[r.length-1];if(!(0,h.ZM)(a))return;let n=e.inlineRange.index-a.length;e.inlineEditor.formatText({index:n,length:a.length},{link:a})};function g(e){let{data:t,inlineEditor:i,inlineRange:s}=e,o=i.getDeltasByInlineRange(s);if(t&&t.length>0&&"\n"!==t&&(o.length>1||1===o.length&&0!==s.index)&&!i.isEmbed(o[0][0])){let{attributes:t}=o[0][0];(1!==o.length||s.index===i.yText.length)&&u.forEach(e=>{delete t?.[e]}),p.forEach(e=>{delete t?.[e]}),e.attributes=t??{}}return e}let m=e=>{g(e),f(e)},v=e=>{g(e)};var y=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},b=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,h,u,p,f,g,w,x,_,C,k,S,M,E,I,B,$,T=[(0,l.EM)("rich-text")],O=[],P=(0,s.Tm)(s.ao),H=[],A=[],L=[],D=[],Z=[],j=[],V=[],z=[],R=[],F=[],N=[],q=[],U=[],W=[],G=[],Y=[],K=[],X=[],Q=[],J=[],ee=[],et=[],ei=[],es=[],eo=[],er=[],ea=[],en=[],el=[],ec=[],ed=[],eh=[],eu=[],ep=[];return class extends P{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(P[Symbol.metadata]??null):void 0;i=[(0,l.P)(".inline-editor")],h=[(0,l.MZ)({attribute:!1})],u=[(0,l.MZ)({attribute:!1})],p=[(0,l.MZ)({attribute:!1})],f=[(0,l.MZ)({attribute:!1})],g=[(0,l.MZ)({attribute:!1})],w=[(0,l.MZ)({attribute:!1})],x=[(0,l.MZ)({attribute:!1})],_=[(0,l.MZ)({attribute:!1})],C=[(0,l.MZ)({attribute:!1})],k=[(0,l.MZ)({attribute:!1})],S=[(0,l.MZ)({attribute:!1})],M=[(0,l.MZ)({attribute:!1})],E=[(0,l.MZ)({attribute:!1})],I=[(0,l.MZ)({attribute:!1})],B=[(0,l.MZ)({attribute:!1})],$=[(0,l.MZ)({attribute:!1})],y(this,null,i,{kind:"accessor",name:"_inlineEditorContainer",static:!1,private:!1,access:{has:e=>"_inlineEditorContainer"in e,get:e=>e._inlineEditorContainer,set:(e,t)=>{e._inlineEditorContainer=t}},metadata:s},H,A),y(this,null,h,{kind:"accessor",name:"attributeRenderer",static:!1,private:!1,access:{has:e=>"attributeRenderer"in e,get:e=>e.attributeRenderer,set:(e,t)=>{e.attributeRenderer=t}},metadata:s},L,D),y(this,null,u,{kind:"accessor",name:"attributesSchema",static:!1,private:!1,access:{has:e=>"attributesSchema"in e,get:e=>e.attributesSchema,set:(e,t)=>{e.attributesSchema=t}},metadata:s},Z,j),y(this,null,p,{kind:"accessor",name:"embedChecker",static:!1,private:!1,access:{has:e=>"embedChecker"in e,get:e=>e.embedChecker,set:(e,t)=>{e.embedChecker=t}},metadata:s},V,z),y(this,null,f,{kind:"accessor",name:"enableAutoScrollHorizontally",static:!1,private:!1,access:{has:e=>"enableAutoScrollHorizontally"in e,get:e=>e.enableAutoScrollHorizontally,set:(e,t)=>{e.enableAutoScrollHorizontally=t}},metadata:s},R,F),y(this,null,g,{kind:"accessor",name:"enableClipboard",static:!1,private:!1,access:{has:e=>"enableClipboard"in e,get:e=>e.enableClipboard,set:(e,t)=>{e.enableClipboard=t}},metadata:s},N,q),y(this,null,w,{kind:"accessor",name:"enableFormat",static:!1,private:!1,access:{has:e=>"enableFormat"in e,get:e=>e.enableFormat,set:(e,t)=>{e.enableFormat=t}},metadata:s},U,W),y(this,null,x,{kind:"accessor",name:"enableUndoRedo",static:!1,private:!1,access:{has:e=>"enableUndoRedo"in e,get:e=>e.enableUndoRedo,set:(e,t)=>{e.enableUndoRedo=t}},metadata:s},G,Y),y(this,null,_,{kind:"accessor",name:"inlineEventSource",static:!1,private:!1,access:{has:e=>"inlineEventSource"in e,get:e=>e.inlineEventSource,set:(e,t)=>{e.inlineEventSource=t}},metadata:s},K,X),y(this,null,C,{kind:"accessor",name:"inlineRangeProvider",static:!1,private:!1,access:{has:e=>"inlineRangeProvider"in e,get:e=>e.inlineRangeProvider,set:(e,t)=>{e.inlineRangeProvider=t}},metadata:s},Q,J),y(this,null,k,{kind:"accessor",name:"markdownShortcutHandler",static:!1,private:!1,access:{has:e=>"markdownShortcutHandler"in e,get:e=>e.markdownShortcutHandler,set:(e,t)=>{e.markdownShortcutHandler=t}},metadata:s},ee,et),y(this,null,S,{kind:"accessor",name:"readonly",static:!1,private:!1,access:{has:e=>"readonly"in e,get:e=>e.readonly,set:(e,t)=>{e.readonly=t}},metadata:s},ei,es),y(this,null,M,{kind:"accessor",name:"undoManager",static:!1,private:!1,access:{has:e=>"undoManager"in e,get:e=>e.undoManager,set:(e,t)=>{e.undoManager=t}},metadata:s},eo,er),y(this,null,E,{kind:"accessor",name:"vLineRenderer",static:!1,private:!1,access:{has:e=>"vLineRenderer"in e,get:e=>e.vLineRenderer,set:(e,t)=>{e.vLineRenderer=t}},metadata:s},ea,en),y(this,null,I,{kind:"accessor",name:"verticalScrollContainerGetter",static:!1,private:!1,access:{has:e=>"verticalScrollContainerGetter"in e,get:e=>e.verticalScrollContainerGetter,set:(e,t)=>{e.verticalScrollContainerGetter=t}},metadata:s},el,ec),y(this,null,B,{kind:"accessor",name:"wrapText",static:!1,private:!1,access:{has:e=>"wrapText"in e,get:e=>e.wrapText,set:(e,t)=>{e.wrapText=t}},metadata:s},ed,eh),y(this,null,$,{kind:"accessor",name:"yText",static:!1,private:!1,access:{has:e=>"yText"in e,get:e=>e.yText,set:(e,t)=>{e.yText=t}},metadata:s},eu,ep),y(null,e={value:t},T,{kind:"class",name:t.name,metadata:s},null,O),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}#N;static{this.styles=(0,n.AH)` rich-text { display: block; height: 100%; width: 100%; overflow-x: auto; scroll-margin-top: 50px; scroll-margin-bottom: 30px; } .inline-editor { height: 100%; width: 100%; outline: none; cursor: text; } .inline-editor.readonly { cursor: default; } rich-text .nowrap-lines v-text span, rich-text .nowrap-lines v-element span { white-space: pre !important; } `}_init(){if(this._inlineEditor){console.error("Inline editor already exists.");return}this.enableFormat||(this.attributesSchema=d.z.object({})),this._inlineEditor=new r.hq(this._yText,{isEmbed:e=>this.embedChecker(e),hooks:{beforeinput:m,compositionEnd:v},inlineRangeProvider:this.inlineRangeProvider,vLineRenderer:this.vLineRenderer}),this.attributesSchema&&this._inlineEditor.setAttributeSchema(this.attributesSchema),this.attributeRenderer&&this._inlineEditor.setAttributeRenderer(this.attributeRenderer);let e=this._inlineEditor,t=this.markdownShortcutHandler;if(t){let i=(0,r.BS)(e,{inputRule:{key:[" ","Enter"],handler:e=>t(e,this.undoManager)}});e.disposables.addFromEvent(this.inlineEventSource??this.inlineEditorContainer,"keydown",i)}e.disposables.add(e.slots.inlineRangeUpdate.on(([t])=>{if(!t)return;let i=this.#N||(this.#N=this.verticalScrollContainerGetter?.()||null);e.waitForUpdate().then(()=>{if(!e.mounted)return;let s=e.toDomRange(t);if(s){if(i){let e=i.getBoundingClientRect(),t=s.getBoundingClientRect();t.tope.bottom&&this.scrollIntoView({block:"end"})}if(this.enableAutoScrollHorizontally){let e=this.getBoundingClientRect(),t=s.getBoundingClientRect(),i=this.scrollLeft;t.left+t.width>e.left+e.width&&(i+=t.left+t.width-(e.left+e.width)+2),this.scrollLeft=i}}}).catch(console.error)})),e.mount(this.inlineEditorContainer,this.inlineEventSource,this.readonly)}_unmount(){this.inlineEditor?.mounted&&this.inlineEditor.unmount(),this._inlineEditor=null}get _yText(){return this.yText instanceof a.EY?this.yText.yText:this.yText}connectedCallback(){if(super.connectedCallback(),!this._yText){console.error("rich-text need yText to init.");return}if(!this._yText.doc){console.error("yText should be bind to yDoc.");return}this.undoManager||(this.undoManager=new a.rl.Y.UndoManager(this._yText,{trackedOrigins:new Set([this._yText.doc.clientID])})),this.enableUndoRedo&&(this.disposables.addFromEvent(this,"keydown",e=>{(e.ctrlKey||e.metaKey)&&("z"===e.key||"Z"===e.key)&&(e.shiftKey?this.undoManager.redo():this.undoManager.undo(),e.stopPropagation())}),this.undoManager.on("stack-item-added",this._onStackItemAdded),this.undoManager.on("stack-item-popped",this._onStackItemPopped),this.disposables.add({dispose:()=>{this.undoManager.off("stack-item-added",this._onStackItemAdded),this.undoManager.off("stack-item-popped",this._onStackItemPopped)}})),this.enableClipboard&&(this.disposables.addFromEvent(this,"copy",this._onCopy),this.disposables.addFromEvent(this,"cut",this._onCut),this.disposables.addFromEvent(this,"paste",this._onPaste)),this.updateComplete.then(()=>{this._unmount(),this._init(),this.disposables.add({dispose:()=>{this._unmount()}})}).catch(console.error)}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.inlineEditor?.waitForUpdate(),e}render(){let e=(0,c.H)({"inline-editor":!0,"nowrap-lines":!this.wrapText,readonly:this.readonly});return(0,n.qy)`
`}updated(e){this._inlineEditor&&e.has("readonly")&&this._inlineEditor.setReadonly(this.readonly)}get inlineEditor(){return this._inlineEditor}get inlineEditorContainer(){return(0,o.Z1)(this._inlineEditorContainer),this._inlineEditorContainer}#q;get _inlineEditorContainer(){return this.#q}set _inlineEditorContainer(e){this.#q=e}#U;get attributeRenderer(){return this.#U}set attributeRenderer(e){this.#U=e}#W;get attributesSchema(){return this.#W}set attributesSchema(e){this.#W=e}#G;get embedChecker(){return this.#G}set embedChecker(e){this.#G=e}#Y;get enableAutoScrollHorizontally(){return this.#Y}set enableAutoScrollHorizontally(e){this.#Y=e}#K;get enableClipboard(){return this.#K}set enableClipboard(e){this.#K=e}#X;get enableFormat(){return this.#X}set enableFormat(e){this.#X=e}#Q;get enableUndoRedo(){return this.#Q}set enableUndoRedo(e){this.#Q=e}#J;get inlineEventSource(){return this.#J}set inlineEventSource(e){this.#J=e}#ee;get inlineRangeProvider(){return this.#ee}set inlineRangeProvider(e){this.#ee=e}#et;get markdownShortcutHandler(){return this.#et}set markdownShortcutHandler(e){this.#et=e}#ei;get readonly(){return this.#ei}set readonly(e){this.#ei=e}#es;get undoManager(){return this.#es}set undoManager(e){this.#es=e}#eo;get vLineRenderer(){return this.#eo}set vLineRenderer(e){this.#eo=e}#er;get verticalScrollContainerGetter(){return this.#er}set verticalScrollContainerGetter(e){this.#er=e}#ea;get wrapText(){return this.#ea}set wrapText(e){this.#ea=e}#en;get yText(){return this.#en}set yText(e){this.#en=e}constructor(){super(...arguments),this.#N=null,this._inlineEditor=null,this._onCopy=e=>{let t=this.inlineEditor;if(!t)return;let i=t.getInlineRange();if(!i)return;let s=t.yTextString.slice(i.index,i.index+i.length);e.clipboardData?.setData("text/plain",s),e.preventDefault(),e.stopPropagation()},this._onCut=e=>{let t=this.inlineEditor;if(!t)return;let i=t.getInlineRange();if(!i)return;let s=t.yTextString.slice(i.index,i.index+i.length);t.deleteText(i),t.setInlineRange({index:i.index,length:0}),e.clipboardData?.setData("text/plain",s),e.preventDefault(),e.stopPropagation()},this._onPaste=e=>{let t=this.inlineEditor;if(!t)return;let i=t.getInlineRange();if(!i)return;let s=e.clipboardData?.getData("text/plain")?.replace(/\r?\n|\r/g,"\n");s&&(t.insertText(i,s),t.setInlineRange({index:i.index+s.length,length:0}),e.preventDefault(),e.stopPropagation())},this._onStackItemAdded=e=>{let t=this.inlineEditor?.getInlineRange();t&&e.stackItem.meta.set("richtext-v-range",t)},this._onStackItemPopped=e=>{let t=e.stackItem.meta.get("richtext-v-range");t&&this.inlineEditor?.isValidInlineRange(t)&&this.inlineEditor?.setInlineRange(t)},this.#q=b(this,H,void 0),this.#U=(b(this,A),b(this,L,void 0)),this.#W=(b(this,D),b(this,Z,void 0)),this.#G=(b(this,j),b(this,V,()=>!1)),this.#Y=(b(this,z),b(this,R,!0)),this.#K=(b(this,F),b(this,N,!0)),this.#X=(b(this,q),b(this,U,!0)),this.#Q=(b(this,W),b(this,G,!0)),this.#J=(b(this,Y),b(this,K,void 0)),this.#ee=(b(this,X),b(this,Q,void 0)),this.#et=(b(this,J),b(this,ee,void 0)),this.#ei=(b(this,et),b(this,ei,!1)),this.#es=(b(this,es),b(this,eo,void 0)),this.#eo=(b(this,er),b(this,ea,void 0)),this.#er=(b(this,en),b(this,el,void 0)),this.#ea=(b(this,ec),b(this,ed,!0)),this.#en=(b(this,eh),b(this,eu,void 0)),b(this,ep)}static{b(t,O)}},t})()},97878:(e,t,i)=>{i.d(t,{o:()=>d});var s=i(71006),o=i(99971),r=i(91449),a=i(72938);let n=null,l=e=>{let t=document.createElement("template");if("string"==typeof e)e=e.trim(),t.innerHTML=e;else{let i=String.raw(e.strings,...e.values);t.innerHTML=i}return t.content.firstChild},c=e=>{let t=` position: fixed; z-index: 9999; top: 16px; left: 16px; right: 16px; bottom: 78px; pointer-events: none; display: flex; flex-direction: column-reverse; align-items: center; `,i=l((0,r.qy)`
`),o=(0,a.$n)(e);(0,s.Z1)(o);let n=o.viewportElement;return n?.append(i),i},d=(e,t,i=2500)=>{n||(n=c(e));let s=` max-width: 480px; text-align: center; font-family: ${o.$7.fontSansFamily}; font-size: var(--affine-font-sm); padding: 6px 12px; margin: 10px 0 0 0; color: var(--affine-white); background: var(--affine-tooltip); box-shadow: var(--affine-float-button-shadow); border-radius: 10px; transition: all 230ms cubic-bezier(0.21, 1.02, 0.73, 1); opacity: 0; `,a=l((0,r.qy)`
`);a.textContent=t,n.append(a);let d=[{opacity:0},{opacity:1}],h={duration:230,easing:"cubic-bezier(0.21, 1.02, 0.73, 1)",fill:"forwards"};return a.animate(d,h),setTimeout(()=>{let e=d.reverse();a.animate(e,h).finished.then(()=>{a.style.maxHeight="0",a.style.margin="0",a.style.padding="0",a.addEventListener("transitionend",()=>{a.remove()},{once:!0})}).catch(console.error)},i),a}},45378:(e,t,i)=>{i.d(t,{m:()=>f});var s=i(71006),o=i(41507),r=i(91449),a=i(4564),n=i(54719),l=i(4068),c=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},d=function(e,t,i){for(var s=arguments.length>2,o=0;o{let i=t.arrow?.x,s=t.arrow?.y;return{left:null!=i?`${i}px`:"",top:null!=s?`${s}px`:"",...u[e.split("-")[0]]}},f=(()=>{let e,t,i,u,f,g,m,v,y,b,w=[(0,a.EM)("affine-tooltip")],x=[],_=r.WF,C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],P=[],H=[],A=[],L=[],D=[],Z=[];return class extends _{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(_[Symbol.metadata]??null):void 0;i=[(0,a.MZ)({attribute:!1})],u=[(0,a.MZ)({attribute:!1})],f=[(0,a.MZ)({attribute:!1})],g=[(0,a.MZ)({attribute:!1})],m=[(0,a.MZ)({attribute:!1})],v=[(0,a.MZ)({attribute:"tip-position"})],y=[(0,a.MZ)({attribute:!1})],b=[(0,a.MZ)({attribute:!1})],c(this,null,i,{kind:"accessor",name:"allowInteractive",static:!1,private:!1,access:{has:e=>"allowInteractive"in e,get:e=>e.allowInteractive,set:(e,t)=>{e.allowInteractive=t}},metadata:s},C,k),c(this,null,u,{kind:"accessor",name:"arrow",static:!1,private:!1,access:{has:e=>"arrow"in e,get:e=>e.arrow,set:(e,t)=>{e.arrow=t}},metadata:s},S,M),c(this,null,f,{kind:"accessor",name:"autoFlip",static:!1,private:!1,access:{has:e=>"autoFlip"in e,get:e=>e.autoFlip,set:(e,t)=>{e.autoFlip=t}},metadata:s},E,I),c(this,null,g,{kind:"accessor",name:"hoverOptions",static:!1,private:!1,access:{has:e=>"hoverOptions"in e,get:e=>e.hoverOptions,set:(e,t)=>{e.hoverOptions=t}},metadata:s},B,$),c(this,null,m,{kind:"accessor",name:"offset",static:!1,private:!1,access:{has:e=>"offset"in e,get:e=>e.offset,set:(e,t)=>{e.offset=t}},metadata:s},T,O),c(this,null,v,{kind:"accessor",name:"placement",static:!1,private:!1,access:{has:e=>"placement"in e,get:e=>e.placement,set:(e,t)=>{e.placement=t}},metadata:s},P,H),c(this,null,y,{kind:"accessor",name:"tooltipStyle",static:!1,private:!1,access:{has:e=>"tooltipStyle"in e,get:e=>e.tooltipStyle,set:(e,t)=>{e.tooltipStyle=t}},metadata:s},A,L),c(this,null,b,{kind:"accessor",name:"zIndex",static:!1,private:!1,access:{has:e=>"zIndex"in e,get:e=>e.zIndex,set:(e,t)=>{e.zIndex=t}},metadata:s},D,Z),c(null,e={value:t},w,{kind:"class",name:t.name,metadata:s},null,x),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,r.AH)` :host { display: none; } `}_getStyles(){return(0,r.AH)` ${h} :host { z-index: ${(0,r.iz)(this.zIndex)}; opacity: 0; ${(0,r.iz)(this.style.cssText)} } ${this.allowInteractive?(0,r.AH)``:(0,r.AH)` :host { pointer-events: none; } `} ${this.tooltipStyle} `}connectedCallback(){super.connectedCallback(),this._setUpHoverController()}getPortal(){return this._hoverController.portal}#el;get allowInteractive(){return this.#el}set allowInteractive(e){this.#el=e}#ec;get arrow(){return this.#ec}set arrow(e){this.#ec=e}#ed;get autoFlip(){return this.#ed}set autoFlip(e){this.#ed=e}#eh;get hoverOptions(){return this.#eh}set hoverOptions(e){this.#eh=e}#eu;get offset(){return this.#eu}set offset(e){this.#eu=e}#ep;get placement(){return this.#ep}set placement(e){this.#ep=e}#ef;get tooltipStyle(){return this.#ef}set tooltipStyle(e){this.#ef=e}#eg;get zIndex(){return this.#eg}set zIndex(e){this.#eg=e}constructor(){super(...arguments),this._setUpHoverController=()=>{this._hoverController=new l.n(this,()=>{if(this.hidden)return null;let e={};return{template:({positionSlot:t,updatePortal:i})=>{t.on(t=>{e=this.arrow?p(t):{},i()});let s=Array.from(this.childNodes).map(e=>e.cloneNode(!0));return(0,r.qy)`
`},computePosition:e=>({referenceElement:this.parentElement,placement:this.placement,middleware:[this.autoFlip&&(0,o.UU)({padding:12}),(0,o.cY)((this.arrow?6:0)+this.offset),(0,o.UE)({element:e.shadowRoot.querySelector(".arrow")})],autoUpdate:!0})}},{leaveDelay:0,safeBridge:!1,allowMultiple:!0,...this.hoverOptions});let e=this.parentElement;(0,s.Z1)(e,"Tooltip must have a parent element"),setTimeout(()=>{this._hoverController.setReference(e)},0)},this.#el=d(this,C,!1),this.#ec=(d(this,k),d(this,S,!0)),this.#ed=(d(this,M),d(this,E,!0)),this.#eh=(d(this,I),d(this,B,{})),this.#eu=(d(this,$),d(this,T,4)),this.#ep=(d(this,O),d(this,P,"top")),this.#ef=(d(this,H),d(this,A,(0,r.AH)``)),this.#eg=(d(this,L),d(this,D,"var(--affine-z-index-popover)")),d(this,Z)}static{d(t,x)}},t})()},75404:(e,t,i)=>{i.d(t,{$Z:()=>l,_p:()=>c,kM:()=>h,m7:()=>d});var s=i(73711),o=i(91449),r=i(8834),a=i(72938),n=i(23156);function l(e,t){let i=(0,n.oV)();if(!i)return null;if(i.startContainer!==i.endContainer)return console.warn("Failed to parse query! Current range is not collapsed.",i),null;if(i.startContainer.nodeType!==Node.TEXT_NODE)return console.warn("Failed to parse query! Current range is not a text node.",i),null;let s=e.getInlineRange();return t&&s&&!(s.indext()})=>{let h=e=>{i.slots.inlineRangeUpdate.once(e)},u=e=>{if(!e.defaultPrevented){if((0,r.QI)(e)){if((e.ctrlKey||e.metaKey)&&!e.altKey&&!e.shiftKey&&1===e.key.length)switch(e.key){case"p":a?.(-1),e.stopPropagation(),e.preventDefault();return;case"n":a?.(1),e.stopPropagation(),e.preventDefault();return;case"v":c?.();return}if("Control"===e.key||"Meta"===e.key||"Alt"===e.key){e.stopPropagation();return}l?.();return}if(e.stopPropagation(),!(0,r.QI)(e)&&1===e.key.length||e.isComposing){h(()=>s?.());return}switch(e.key){case"Escape":case"ArrowLeft":case"ArrowRight":l?.();return;case"Backspace":h(()=>o?.());return;case"Enter":if(e.shiftKey){l?.();return}n?.(),e.preventDefault();return;case"Tab":e.shiftKey?a?.(-1):a?.(1),e.preventDefault();return;case"ArrowUp":if(e.shiftKey){l?.();return}a?.(-1),e.preventDefault();return;case"ArrowDown":if(e.shiftKey){l?.();return}a?.(1),e.preventDefault();return;default:return}}};e.addEventListener("keydown",e=>d(e,()=>u(e)),{capture:!0,signal:t}),e.addEventListener("paste",()=>h(()=>s?.()),{signal:t}),e.addEventListener("input",()=>h(()=>s?.()),{signal:t})};function d(e,t,i){if(!i){console.warn("Failed to clean text! Unexpected empty string");return}let o=t instanceof s.zg?(0,a.h9)(e,t):t;if(!o)return;let r=o.getInlineRange();if(!r)return;let n=r.index-i.length,l=o.yText.toString().slice(n,n+i.length);if(l!==i){console.warn(`Failed to clean text! Text mismatch expected: ${i} but actual: ${l}`);return}o.deleteText({index:n,length:i.length}),o.setInlineRange({index:n,length:0})}let h=e=>e?e.includes("{")||e.includes("}")?(console.error("Invalid container name! Please use a valid CSS selector."),(0,o.AH)``):(0,o.AH)` ${(0,o.iz)(e)} { scrollbar-gutter: stable; } ${(0,o.iz)(e)}::-webkit-scrollbar { -webkit-appearance: none; width: 4px; } ${(0,o.iz)(e)}::-webkit-scrollbar-thumb { border-radius: 2px; background-color: #b1b1b1; } ${(0,o.iz)(e)}::-webkit-scrollbar-corner { display: none; } `:(console.error("To prevent style pollution of the whole doc, you must add a container before the scrollbar style."),(0,o.AH)``)},47590:(e,t,i)=>{i.d(t,{Z:()=>f});var s=i(7595),o=i(71006),r=i(91449),a=i(4564),n=i(1497),l=i(35018),c=i(40048),d=i(67066),h=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},u=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,a.EM)("database-convert-view")],l=[],d=(0,s.Tm)(r.WF),f=[],g=[];(class extends d{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;h(this,null,[(0,a.MZ)({attribute:!1})],{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:s},f,g),h(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,r.AH)` :host { position: fixed; inset: 0; z-index: var(--affine-z-index-modal); } .overlay-mask { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.6); z-index: var(--affine-z-index-modal); } .modal-container { position: absolute; z-index: var(--affine-z-index-modal); top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; justify-content: space-between; width: 720px; padding: 24px 40px; border-radius: 24px; background: var(--affine-background-overlay-panel-color); } .modal-header { display: flex; justify-content: space-between; align-items: center; } .modal-header-title { color: var(--affine-text-primary-color); font-size: 20px; font-weight: 600; } .modal-header-close-icon { display: flex; align-items: center; color: var(--affine-icon-color); cursor: pointer; } .modal-header-close-icon svg { width: 24px; height: 24px; } .modal-footer { color: var(--affine-text-secondary-color); font-size: 14px; text-align: center; } .modal-body { padding: 24px 0; } .modal-desc { margin-bottom: 38px; color: var(--affine-text-primary-color); font-size: 14px; } .modal-view-container { display: flex; justify-content: center; gap: 18px; } .modal-view-item { display: flex; flex-direction: column; gap: 6px; cursor: pointer; } .modal-view-item.coming-soon { cursor: not-allowed; } .modal-view-item.coming-soon .modal-view-item-content { pointer-events: none; } .modal-view-item-content:hover { background: var(--affine-hover-color); } .modal-view-item-content:hover .modal-view-item-text, .modal-view-item-content:hover svg { fill: var(--affine-primary-color); color: var(--affine-primary-color); } .modal-view-item-content { display: flex; flex-direction: column; align-items: center; padding: 18px 0; gap: 6px; width: 108px; border: 2px solid var(--affine-border-color); border-radius: 8px; } .modal-view-item-icon { width: 42px; height: 42px; } .modal-view-item-icon svg { width: 42px; height: 42px; fill: var(--affine-black-50); } .modal-view-item-text { font-size: 14px; color: var(--affine-black-50); } .modal-view-item-description { font-size: 12px; color: var(--affine-text-secondary-color); text-align: center; } `}_convertToDatabase(e){let[t,i]=this.host.std.command.chain().getSelectedModels({types:["block","text"]}).run(),{selectedModels:s}=i;if(!s||0===s.length)return;this.doc.captureSync();let r=this.doc.getParent(s[0]);(0,o.Z1)(r);let a=this.doc.addBlock("affine:database",{},r,r.children.indexOf(s[0])),n=this.doc.getBlockById(a);(0,o.Z1)(n),(0,c.gG)(n,e),n.applyColumnUpdate(),this.doc.moveBlocks(s,n),this.host.selection.clear(),this.remove()}render(){return(0,r.qy)`
`}get doc(){return this.host.doc}#n=u(this,f,void 0);get host(){return this.#n}set host(e){this.#n=e}constructor(){super(...arguments),u(this,g)}static{u(t,l)}})})()},93574:(e,t,i)=>{i.d(t,{$R:()=>u,Cd:()=>c,Et:()=>l,Hn:()=>d,PT:()=>f,ei:()=>a,g3:()=>p,m9:()=>n,mh:()=>o,s6:()=>r,u_:()=>s,zu:()=>h});let s="data-block-id",o=800,r=24,a=24,n=2,l=53,c={horizontal:752,horizontalThin:752,list:752,vertical:364,cube:170,cubeThick:170,video:752,figma:752,html:752,syncedDoc:752},d={horizontal:116,horizontalThin:80,list:46,vertical:390,cube:114,cubeThick:132,video:544,figma:544,html:544,syncedDoc:455},h=["affine:embed-github","affine:embed-youtube","affine:embed-figma","affine:embed-linked-doc","affine:embed-synced-doc","affine:embed-html","affine:embed-loom"],u="https://affine-worker.toeverything.workers.dev/api/worker/image-proxy",p="https://affine-worker.toeverything.workers.dev/api/worker/link-preview",f=["EDGELESS-TOOLBAR","AFFINE-DRAG-HANDLE-WIDGET","AFFINE-FORMAT-BAR-WIDGET","AFFINE-BLOCK-SELECTION"]},31971:(e,t,i)=>{i.d(t,{S:()=>r});var s=i(73711),o=i(96448);function r(e){if(e===s.zg)return o.y;{let t=e;for(;Object.getPrototypeOf(t.prototype)!==s.zg.prototype&&null!==Object.getPrototypeOf(t.prototype);)t=Object.getPrototypeOf(t.prototype).constructor;if(null===Object.getPrototypeOf(t.prototype))throw Error("The SuperClass is not a subclass of BlockModel");Object.setPrototypeOf(t.prototype,o.y.prototype)}return e}},18571:(e,t,i)=>{i.d(t,{S:()=>s.S});var s=i(31971)},35632:(e,t,i)=>{i.d(t,{If:()=>c,KI:()=>a,LS:()=>n,Tk:()=>d,Zb:()=>o,jJ:()=>l,mh:()=>r});var s=i(60019);let o=["--affine-note-background-yellow","--affine-note-background-orange","--affine-note-background-red","--affine-note-background-magenta","--affine-note-background-purple","--affine-note-background-blue","--affine-note-background-teal","--affine-note-background-green","--affine-note-background-black","--affine-note-background-grey","--affine-note-background-white"],r=(0,s.xK)(o),a=o[5],n=["","--affine-note-shadow-box","--affine-note-shadow-sticker","--affine-note-shadow-paper","--affine-note-shadow-float","--affine-note-shadow-film"],l=(0,s.xK)(n),c=n[2],d="affine-note, affine-edgeless-note .edgeless-note-page-content, affine-edgeless-text"},76020:(e,t,i)=>{i.d(t,{I:()=>o});var s=i(18571);function o(e){return(0,s.S)(e)}},91721:(e,t,i)=>{i.d(t,{E:()=>l,y:()=>c});var s=i(68419),o=i(73134),r=i(73711),a=i(93574),n=i(18132);function l({name:e,version:t,toModel:i,props:s,transformer:o}){return(0,r.A9)({flavour:`affine:embed-${e}`,props:e=>({index:"a0",xywh:"[0,0,0,0]",rotate:0,...s?.(e)}),metadata:{version:t,role:"content"},toModel:i,transformer:o})}class c{constructor(){this._endpoint=a.g3,this.query=async(e,t)=>{if((e.startsWith("https://x.com/")||e.startsWith("https://www.x.com/")||e.startsWith("https://www.twitter.com/")||e.startsWith("https://twitter.com/"))&&e.includes("/status/")){e="https://api.fxtwitter.com/status/"+/\/status\/(.*)/.exec(e)?.[1];try{let{tweet:i}=await fetch(e,{signal:t}).then(e=>e.json());return{title:i.author.name,icon:i.author.avatar_url,description:i.text,image:i.media?.photos[0].url||i.author.banner_url}}catch(t){return console.error(`Failed to fetch tweet: ${e}`),console.error(t),{}}}else{let i=await fetch(this._endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e}),signal:t}).then(t=>{if(!t||!t.ok)throw new s.Ss(o.O.DefaultRuntimeError,`Failed to fetch link preview: ${e}`);return t}).catch(t=>((0,n.z)(t)||(console.error(`Failed to fetch link preview: ${e}`),console.error(t)),null));if(!i)return{};let r=await i.json();return{title:r.title?this._getStringFromHTML(r.title):null,description:r.description?this._getStringFromHTML(r.description):null,icon:r.favicons?.[0],image:r.images?.[0]}}},this.setEndpoint=e=>{this._endpoint=e}}_getStringFromHTML(e){let t=document.createElement("div");return t.innerHTML=e,t.textContent}}},40495:(e,t,i)=>{i.d(t,{AL:()=>l,O1:()=>o,ON:()=>a,Yc:()=>n,fl:()=>c,or:()=>r});var s=i(91449);let o=(0,s.qy)` `,r=(0,s.qy)``,a=(0,s.qy)` `,n=(0,s.qy)` `,l=(0,s.qy)` `,c=(0,s.qy)` `},19668:(e,t,i)=>{i.d(t,{e:()=>o});var s=i(91449);let o=(0,s.qy)` `},69849:(e,t,i)=>{i.d(t,{$J:()=>eD,AU:()=>eA,B2:()=>$,BA:()=>x,Bj:()=>Y,CF:()=>a,CW:()=>ee,C_:()=>j,Ci:()=>c,Cs:()=>H,D2:()=>b,DL:()=>er,E1:()=>ea,EW:()=>B,Ec:()=>e_,FH:()=>V,FU:()=>eY,GJ:()=>em,GX:()=>f,Go:()=>e3,H0:()=>ed,HH:()=>eG,HN:()=>z,Hm:()=>K,Hx:()=>ec,I6:()=>m,ID:()=>e0,IR:()=>N,Jp:()=>ta,K:()=>Z,K4:()=>e1,KQ:()=>eX,KY:()=>eE,Kp:()=>ey,L0:()=>ep,LT:()=>eM,M8:()=>X,Mz:()=>eg,OS:()=>Q,OT:()=>eV,OV:()=>P,QG:()=>A,Qv:()=>eo,RV:()=>eN,Rj:()=>J,SB:()=>ez,Sr:()=>tr,UY:()=>tn,Ui:()=>ef,Uw:()=>te,VN:()=>eu,Wc:()=>eF,X1:()=>eS,Xf:()=>ek,Y2:()=>to,Y3:()=>ti,Yg:()=>el,Yl:()=>M,Ys:()=>W,Yu:()=>d,Z4:()=>eI,ZM:()=>ex,Ze:()=>eJ,_U:()=>et,aI:()=>l,ad:()=>T,b8:()=>ev,c1:()=>L,cF:()=>_,d3:()=>eb,dH:()=>S,dw:()=>e5,e9:()=>E,eQ:()=>eC,eo:()=>eL,g:()=>eW,gZ:()=>q,iE:()=>e9,jC:()=>ej,jN:()=>k,kv:()=>ts,mI:()=>eP,mS:()=>g,mi:()=>eq,n4:()=>F,n6:()=>e4,n7:()=>eR,nC:()=>h,nF:()=>n,o1:()=>O,o7:()=>I,oA:()=>e8,oO:()=>p,ol:()=>w,pg:()=>v,pl:()=>u,qK:()=>y,rZ:()=>C,sG:()=>R,sS:()=>e6,sZ:()=>eH,sd:()=>eB,tP:()=>es,tW:()=>e$,tg:()=>eZ,u2:()=>D,u4:()=>eh,uY:()=>eU,uj:()=>tt,vE:()=>G,vN:()=>ew,v_:()=>e2,vq:()=>en,wB:()=>r,wC:()=>U,wH:()=>eO,xz:()=>eT,y3:()=>ei,z4:()=>e7,zN:()=>eK,zu:()=>eQ});var s=i(91449),o=i(23725);let r=o.wBL({width:"24",height:"24"});(0,s.qy)` `,(0,s.qy)` `,o.xfq({width:"20",height:"20"});let a=o.qUP({width:"24",height:"24"}),n=o.nFg({width:"20",height:"20"}),l=o.CIh({width:"24",height:"24"}),c=o.Uhd({width:"24",height:"24"}),d=o.cFS({width:"24",height:"24"}),h=o.N0f({width:"24",height:"24"}),u=o.O4E({width:"24",height:"24"}),p=o.JmJ({width:"24",height:"24"}),f=o.EIO({width:"24",height:"24"}),g=o.eoT({width:"20",height:"20"}),m=o.Zes({width:"24",height:"24"}),v=o.ws({width:"20",height:"20"}),y=o.BfH({width:"24",height:"24"}),b=o.cEz({width:"16",height:"16"}),w=o.c11({width:"24",height:"24"});o.xfq({width:"24",height:"24"});let x=o.xfq({width:"20",height:"20"}),_=o.cFy({width:"20",height:"20"}),C=o.rZj({width:"24",height:"24"}),k=o.jNf({width:"24",height:"24"}),S=o.dHM({width:"20",height:"20"}),M=o.YlR({width:"20",height:"20"}),E=o.e9L({width:"20",height:"20"}),I=o.o7e({width:"20",height:"20"}),B=o.EW9({width:"20",height:"20"}),$=(0,s.qy)` `,T=(0,s.qy)` `,O=(0,s.qy)` `,P=(0,s.qy)` `,H=(0,s.qy)` `,A=o.QGg({width:"24",height:"24"}),L=o.c11({width:"24",height:"24"}),D=o.u20({width:"24",height:"24"}),Z=(0,s.qy)` `,j=o.jNK({width:"24",height:"24"}),V=o.FHP({width:"20",height:"20"}),z=o.HNp({width:"20",height:"20"}),R=o.cyP({width:"20",height:"20"}),F=o.N0f({width:"20",height:"20"}),N=o.cAq({width:"20",height:"20"}),q=o.WFt({width:"20",height:"20"}),U=o.kjd({width:"20",height:"20"}),W=o.O4E({width:"20",height:"20"}),G=o.vbr({width:"20",height:"20"}),Y=o.njB({width:"20",height:"20"}),K=o.HNH({width:"20",height:"20"}),X=o.M80({width:"20",height:"20"});o.K3f({width:"20",height:"20"}),o.lL2({width:"20",height:"20"});let Q=o.OSm({width:"20",height:"20"}),J=o.QlO({width:"20",height:"20"}),ee=o.kqb({width:"20",height:"20"}),et=o.zPo({width:"20",height:"20"}),ei=o.y3_({width:"20",height:"20"}),es=o.tPq({width:"20",height:"20"});o.v_L({width:"16",height:"16"});let eo=o.v_L({width:"24",height:"24"}),er=o.P$Z({width:"20",height:"20"}),ea=o.CbU({width:"20",height:"20"}),en=(0,s.qy)` `,el=(0,s.qy)` `,ec=o.v_L({width:"20",height:"20"}),ed=o.H0W({width:"20",height:"20"}),eh=o.H0W({width:"24",height:"24"}),eu=o.VNq({width:"20",height:"20"}),ep=o.L0c({width:"20",height:"20"}),ef=o.Ui8({width:"20",height:"20"}),eg=o.Lfm({width:"20",height:"20"});o.Vrn({width:"16",height:"16"});let em=o.b8b({width:"16",height:"16"}),ev=o.b8b({width:"20",height:"20"}),ey=(0,s.qy)` `,eb=o.IDF({width:"20",height:"20"}),ew=(0,s.qy)` `,ex=(0,s.qy)` `,e_=(0,s.qy)` `,eC=(0,s.qy)` `,ek=(0,s.qy)` `,eS=(0,s.qy)` `,eM=(0,s.qy)` `;(0,s.qy)` `;let eE=(0,s.qy)` `,eI=o.jNK({width:"24",height:"24"}),eB=o.Fzz({width:"20",height:"20"}),e$=o.cEz({width:"20",height:"20"}),eT=o.Tje({width:"20",height:"20"}),eO=o.CVU({width:"20",height:"20"}),eP=o.TdU({width:"20",height:"20"});o.mK9({width:"20",height:"20"});let eH=o.jaP({width:"20",height:"20"}),eA=o.d7y({width:"20",height:"20"}),eL=o.SAc({width:"16",height:"16"}),eD=o.rWB({width:"20",height:"20"}),eZ=o.Vx1({width:"20",height:"20"}),ej=o.$2o({width:"20",height:"20"}),eV=o.OTM({width:"32",height:"32"}),ez=o.SBc({width:"20",height:"20"}),eR=o.n7i({width:"20",height:"20"}),eF=o.aJy({width:"20",height:"20"}),eN=o.d$q({width:"20",height:"20"}),eq=o.mib({width:"20",height:"20"}),eU=o.uYI({width:"20",height:"20"}),eW=o.A1x({width:"20",height:"20"}),eG=o.fFF({width:"20",height:"20"}),eY=o.tE0({width:"24",height:"24"}),eK=o.QlO({width:"24",height:"24"}),eX=o.Jps({width:"16",height:"16",style:"color:#77757D;"}),eQ=o.OTM({width:"16",height:"16",style:"color:#77757D;"}),eJ=o.Zes({width:"20",height:"20"}),e1=(0,s.qy)` `,e0=o.IDF({width:"20",height:"20"}),e2=o.v_L({width:"20",height:"20"}),e5=(0,s.qy)` `,e7=o.ziP({width:"20",height:"20"}),e3=o.JQk({width:"20",height:"20"}),e4=o.C9h({width:"20",height:"20",style:"transform: rotate(0.5turn); transform-origin: center;"}),e6=o.C9h({width:"20",height:"20"}),e8=(0,s.qy)` `,e9=(0,s.qy)` `,te=(0,s.qy)` `,tt=(0,s.qy)` `,ti=o._GB({width:"16",height:"16"}),ts=o.Upg({width:"16",height:"16"}),to=o.Y2f({width:"20",height:"20"}),tr=o.eqL({width:"20",height:"20"}),ta=o.Jps({width:"20",height:"20"}),tn=o.S1N({width:"24",height:"24",style:"color: white;"})},69147:(e,t,i)=>{i.d(t,{O1o:()=>s.O1,orQ:()=>s.or,N7w:()=>el.N7,Y2f:()=>r.Y2,uYI:()=>r.uY,RV:()=>r.RV,HH6:()=>r.HH,Wcf:()=>r.Wc,SBc:()=>r.SB,n7i:()=>r.n7,mib:()=>r.mi,gaN:()=>r.g,Tje:()=>el.Tj,ZLN:()=>el.ZL,SAc:()=>el.SA,oik:()=>el.oi,Jps:()=>r.Jp,zII:()=>el.zI,OTM:()=>r.OT,cEz:()=>el.cE,Kpk:()=>r.Kp,Ey0:()=>el.Ey,D21:()=>r.D2,$oz:()=>el.$o,tWR:()=>r.tW,sdS:()=>r.sd,RyS:()=>el.Ry,ITz:()=>el.IT,KRn:()=>el.KR,jCn:()=>r.jC,lOw:()=>el.lO,USm:()=>X,I5t:()=>el.I5,loI:()=>el.lo,Mwl:()=>el.Mw,Rjd:()=>r.Rj,sGb:()=>r.sG,zNy:()=>r.zN,_Uo:()=>r._U,CW5:()=>r.CW,TdU:()=>el.Td,w0d:()=>el.w0,fNc:()=>el.fN,yni:()=>el.yn,d7y:()=>el.d7,e9L:()=>r.e9,za1:()=>el.z,UdY:()=>el.Ud,eqL:()=>o.e,s3U:()=>el.s3,BAN:()=>el.BA,jaP:()=>el.j,eQl:()=>r.eQ,Ec4:()=>r.Ec,d3e:()=>r.d3,qUP:()=>el.qU,YlR:()=>r.Yl,JmJ:()=>el.Jm,UYC:()=>el.UY,mSu:()=>r.mS,JvT:()=>el.Jv,Myu:()=>J,s6$:()=>Q,oSV:()=>l,M80:()=>r.M8,H0W:()=>r.H0,qK6:()=>r.qK,n4k:()=>r.n4,gZ8:()=>r.gZ,wCH:()=>r.wC,IRZ:()=>r.IR,$JY:()=>r.$J,nFg:()=>r.nF,jNf:()=>r.jN,BQZ:()=>el.BQ,SoJ:()=>el.So,Nrq:()=>el.Nr,WXD:()=>el.WX,TXg:()=>el.TX,ma5:()=>el.m,KcF:()=>el.Kc,NTw:()=>ei,wlz:()=>el.wl,BA1:()=>r.BA,z52:()=>es,amD:()=>eo.am,yOR:()=>el.yO,u4h:()=>r.u4,HNp:()=>r.HN,qYV:()=>el.qY,hhn:()=>el.hh,FYP:()=>el.FY,kvU:()=>r.kv,Y3l:()=>r.Y3,mID:()=>r.mI,AUQ:()=>r.AU,sZq:()=>r.sZ,jNK:()=>r.C_,FHP:()=>r.FH,aiU:()=>el.ai,hhC:()=>el.AE,y_r:()=>el.y_,i68:()=>et,olE:()=>r.ol,DLR:()=>r.DL,Qvf:()=>r.Qv,E1b:()=>r.E1,j5m:()=>ee,mjz:()=>el.mj,gZg:()=>el.gZ,gb9:()=>el.gb,v1n:()=>el.v1,vrT:()=>el.vr,rZj:()=>r.rZ,c11:()=>r.c1,cyi:()=>el.cy,YsG:()=>r.Ys,Bjt:()=>r.Bj,Hmh:()=>r.Hm,vEB:()=>r.vE,fNY:()=>el.v4,aIb:()=>r.aI,CFr:()=>r.CF,NAP:()=>eo.NA,EW9:()=>r.EW,b8b:()=>r.b8,o17:()=>r.o1,adS:()=>r.ad,Cso:()=>r.Cs,B2L:()=>r.B2,tgi:()=>r.tg,OVp:()=>r.OV,wBL:()=>r.wB,xz0:()=>r.xz,wH8:()=>r.wH,pg7:()=>r.pg,eoI:()=>r.eo,dHM:()=>r.dH,t64:()=>el.t6,P3Z:()=>en,L0c:()=>r.L0,VNq:()=>r.VN,Ui8:()=>r.Ui,zcx:()=>el.zc,q_Z:()=>el.q_,N$i:()=>el.N$,FlE:()=>el.Fl,t5i:()=>el.Mq,KaZ:()=>r.K,o7e:()=>r.o7,qpS:()=>el.qp,CiQ:()=>r.Ci,xPL:()=>el.xP,cqr:()=>el.cq,UmY:()=>n});var s=i(40495),o=i(19668),r=i(69849),a=i(91449);function n(e){switch(e){case"img":return d;case"jpg":return h;case"jpeg":return u;case"png":return p;case"webp":return f;case"tiff":return g;case"gif":return m;case"svg":return v;case"eps":return y;case"pdf":return b;case"doc":return w;case"docx":return x;case"txt":return _;case"csv":return C;case"xls":return k;case"xlsx":return S;case"ppt":return M;case"pptx":return E;case"fig":return I;case"ai":return B;case"psd":return $;case"indd":return T;case"aep":return O;case"mp3":return P;case"wav":return H;case"mp4":return A;case"mpeg":return L;case"avi":return D;case"mkv":return Z;case"html":return j;case"css":return V;case"rss":return z;case"sql":return R;case"js":return F;case"json":return N;case"java":return q;case"xml":return U;case"exe":return W;case"dmg":return G;case"zip":return Y;case"rar":return K;default:return c}}let l=(0,a.qy)` `,c=(0,a.qy)` `,d=(0,a.qy)` `,h=(0,a.qy)` `,u=(0,a.qy)` `,p=(0,a.qy)` `,f=(0,a.qy)` `,g=(0,a.qy)` `,m=(0,a.qy)` `,v=(0,a.qy)` `,y=(0,a.qy)` `,b=(0,a.qy)` `,w=(0,a.qy)` `,x=(0,a.qy)` `,_=(0,a.qy)` `,C=(0,a.qy)` `,k=(0,a.qy)` `,S=(0,a.qy)` `,M=(0,a.qy)` `,E=(0,a.qy)` `,I=(0,a.qy)` `,B=(0,a.qy)` `,$=(0,a.qy)` `,T=(0,a.qy)` `,O=(0,a.qy)` `,P=(0,a.qy)` `,H=(0,a.qy)` `,A=(0,a.qy)` `,L=(0,a.qy)` `,D=(0,a.qy)` `,Z=(0,a.qy)` `,j=(0,a.qy)` `,V=(0,a.qy)` `,z=(0,a.qy)` `,R=(0,a.qy)` `,F=(0,a.qy)` `,N=(0,a.qy)` `,q=(0,a.qy)` `,U=(0,a.qy)` `,W=(0,a.qy)` `,G=(0,a.qy)` `,Y=(0,a.qy)` `,K=(0,a.qy)` `,X=(0,a.qy)` `,Q=(0,a.qy)` `,J=(0,a.qy)` `,ee=(0,a.qy)` `,et=(0,a.qy)` `,ei=(0,a.qy)` `,es=(0,a.qy)` `;var eo=i(421),er=i(34988);let ea=(0,a.JW)``,en=(0,er.K)(ea,16);var el=i(67066)},421:(e,t,i)=>{i.d(t,{NA:()=>a,am:()=>r,id:()=>o});var s=i(91449);let o=(0,s.qy)` `,r=(0,s.qy)` `,a=(0,s.qy)` `;(0,s.qy)` `},67066:(e,t,i)=>{i.d(t,{$9:()=>eT,$I:()=>eB,$o:()=>k,AE:()=>ex,BA:()=>er,BQ:()=>l,E:()=>X,EI:()=>eb,ET:()=>ei,Ey:()=>ed,FY:()=>es,Fl:()=>H,I5:()=>x,IT:()=>G,Jm:()=>ey,Jv:()=>ev,KR:()=>N,Kc:()=>n,Mq:()=>A,Mw:()=>R,N$:()=>a,N7:()=>en,NQ:()=>el,NR:()=>z,Nr:()=>d,Nv:()=>eV,O0:()=>eD,Pl:()=>eP,Pt:()=>ec,Ry:()=>f,SA:()=>ea,So:()=>c,TX:()=>u,Td:()=>$,Tj:()=>eC,UY:()=>q,Ud:()=>ee,WI:()=>j,WX:()=>h,XG:()=>eI,ZL:()=>Q,ai:()=>ew,bd:()=>e$,bp:()=>eO,cE:()=>e_,cq:()=>L,cy:()=>_,d7:()=>P,dd:()=>eA,dv:()=>J,fN:()=>b,gZ:()=>g,gb:()=>F,hh:()=>ez,i$:()=>eE,iS:()=>ej,ik:()=>eM,j:()=>O,jf:()=>eZ,lO:()=>w,lo:()=>I,m:()=>p,mj:()=>D,oi:()=>em,qU:()=>U,qY:()=>B,q_:()=>eu,qp:()=>M,s3:()=>Y,s9:()=>eL,t6:()=>E,uc:()=>m,v1:()=>ek,v4:()=>V,vK:()=>y,ve:()=>et,vq:()=>eH,vr:()=>T,w$:()=>K,w0:()=>Z,wl:()=>ef,xP:()=>W,yO:()=>S,y_:()=>eo,yn:()=>v,z:()=>C,zI:()=>eg,zc:()=>eh});var s=i(23725),o=i(91449),r=i(34988);let a=s.N$i({width:"20",height:"20"}),n=s.Z$r({width:"20",height:"20"}),l=s.BQZ({width:"20",height:"20"}),c=s.SoJ({width:"20",height:"20"}),d=s.Nrq({width:"20",height:"20"}),h=s.WXD({width:"20",height:"20"}),u=s.TXg({width:"20",height:"20"}),p=s.ma5({width:"20",height:"20"}),f=s.RyS({width:"20",height:"20"}),g=s.gZg({width:"20",height:"20"}),m=s.ucD({width:"24",height:"24"}),v=s.ucD({width:"20",height:"20"}),y=s.vKo({width:"24",height:"24"}),b=s.vKo({width:"20",height:"20"}),w=s.Syo({width:"20",height:"20"}),x=s.I5t({width:"20",height:"20"}),_=s.cyi({width:"20",height:"20"}),C=s.za1({width:"20",height:"20"}),k=s.$oz({width:"20",height:"20"}),S=s.yOR({width:"20",height:"20"}),M=s._PQ({width:"20",height:"20"}),E=s.Xnc({width:"20",height:"20"}),I=s.loI({width:"20",height:"20"}),B=s.qYV({width:"20",height:"20"}),$=s.TdU({width:"20",height:"20"}),T=s.vrT({width:"20",height:"20"}),O=s.jaP({width:"20",height:"20"}),P=s.d7y({width:"20",height:"20"}),H=s.FlE({width:"20",height:"20"}),A=s.t5i({width:"20",height:"20"}),L=s.cqr({width:"20",height:"20"}),D=s.mjz({width:"20",height:"20"}),Z=s.USm({width:"24",height:"24"}),j=s.WIv({width:"20",height:"20"}),V=s.NAP({width:"20",height:"20"}),z=s.VQ$({width:"16",height:"16"}),R=s.eqL({width:"20",height:"20"}),F=s.PHA({width:"20",height:"20"}),N=s.KRn({width:"20",height:"20"}),q=s.JmJ({width:"20",height:"20"});s.t5Y({width:"20",height:"20"});let U=s.qUP({width:"20",height:"20"}),W=s.xPL({width:"20",height:"20"}),G=s.ITz({width:"20",height:"20"}),Y=s.s3U({width:"20",height:"20"}),K=s.w$A({width:"20",height:"20"}),X=s.Ea5({width:"20",height:"20"});s.tCQ({width:"20",height:"20"}),s.RGD({width:"20",height:"20"});let Q=s.SAc({width:"20",height:"20"}),J=s.v_L({width:"1.25em",height:"1.25em",style:"vertical-align: middle; font-size: inherit; margin-bottom: 0.1em;"}),ee=s.v_L({width:"20",height:"20"}),et=s.v_L({width:"16",height:"16"}),ei=s.Qol({width:"1.25em",height:"1.25em",style:"vertical-align: middle; font-size: inherit; margin-bottom: 0.1em;"}),es=s.FYP({width:"20",height:"20"}),eo=s.c11({width:"20",height:"20"}),er=s.w4L({width:"16",height:"16"}),ea=s.SAc({width:"24",height:"24"}),en=s.c11({width:"24",height:"24"}),el=s.l88({width:"20",height:"20"}),ec=s.PtA({width:"20",height:"20"}),ed=s.PtA({width:"16",height:"16"}),eh=(0,o.qy)` `,eu=(0,o.qy)` `,ep=(0,o.JW)` `,ef=(0,r.K)(ep,20),eg=s.zII({width:"24",height:"24"}),em=s.oik({width:"24",height:"24"}),ev=s.JvT({width:"24",height:"24"}),ey=s.JmJ({width:"24",height:"24"}),eb=s.EIO({width:"24",height:"24"}),ew=s.aiU({width:"24",height:"24"}),ex=s.hhC({width:"24",height:"24"}),e_=s.cEz({width:"20",height:"20"}),eC=s.Tje({width:"20",height:"20"}),ek=s.v1n({width:"20",height:"20"}),eS=e=>(0,o.qy)` `,eM=eS("white"),eE=eS("black"),eI=(0,o.qy)` `,eB=(0,o.qy)` `,e$=(0,o.qy)` `,eT=(0,o.qy)` `,eO=(0,o.qy)` `,eP=(0,o.qy)` `,eH=(0,o.qy)` `,eA=(0,o.qy)` `,eL=(0,o.qy)` `,eD=(0,o.qy)` `,eZ=(0,o.qy)` `,ej=s.Qol({width:"16",height:"16"}),eV=s.FYP({width:"16",height:"16"}),ez=s.Qol({width:"20",height:"20"})},34988:(e,t,i)=>{i.d(t,{K:()=>o});var s=i(91449);function o(e,t=24){return(0,s.qy)` ${e} `}},66050:(e,t,i)=>{i.d(t,{Q:()=>a,z:()=>s});var s,o=i(31980);!function(e){e.Dark="dark",e.Light="light"}(s||(s={}));let r="transparent";class a{constructor(){this.mode$=(0,o.vP)(s.Light)}static #em;static #ev;#ey;static get computedStyle(){let e=a.#em;return e||(e=window.getComputedStyle(document.documentElement),a.#em=e),e}static generateColorProperty(e,t="transparent"){return(t=t.startsWith("--")?t.endsWith(r)?r:`var(${t})`:t,"string"==typeof e)?(e.startsWith("--")?e.endsWith(r)?r:`var(${e})`:e)??t:e?e.light&&e.dark?`light-dark(${e.light}, ${e.dark})`:e.normal??t:t}static getColorValue(e,t=r,i){return"object"==typeof e&&(e=e[a.mode]??e.normal??t),e||(e=t??r),i&&e.startsWith("--")&&!(e=e.endsWith(r)?r:a.getPropertyValue(e))&&(e=t.startsWith("--")?a.getPropertyValue(t):t),e}static getPropertyValue(e){return e.startsWith("--")?e.endsWith(r)?r:a.computedStyle.getPropertyValue(e).trim()||e:e}static get instance(){if(!a.#ev){let e=new a;e.observe(document.documentElement),a.#ev=e}return a.#ev}static get mode(){return a.instance.mode$.peek()}static subscribe(e){return a.instance.mode$.subscribe(e)}disconnect(){this.#ey?.disconnect()}observe(e){let t=()=>{let t=e.dataset.theme;t&&this.mode$.peek()!==t&&(this.mode$.value=t)};this.#ey?.disconnect(),this.#ey=new MutationObserver(t),this.#ey.observe(e,{attributes:!0,attributeFilter:["data-theme"]}),t()}}},38509:(e,t,i)=>{var s,o,r;i.d(t,{D9:()=>s,ko:()=>r,yN:()=>o}),function(e){e[e.Eight=8]="Eight",e[e.Four=4]="Four",e[e.Six=6]="Six",e[e.Ten=10]="Ten",e[e.Twelve=12]="Twelve",e[e.Two=2]="Two"}(s||(s={})),function(e){e[e.FreeHand=0]="FreeHand",e[e.Polygonal=1]="Polygonal"}(o||(o={})),function(e){e.DocAndEdgeless="both",e.DocOnly="doc",e.EdgelessOnly="edgeless"}(r||(r={}))},13428:(e,t,i)=>{i.d(t,{i:()=>s});function s(e){let t=e.keys,i=t.map(t=>e[t]);return Object.fromEntries(t.map((e,t)=>[e,i[t]]))}},72895:(e,t,i)=>{i.d(t,{j:()=>r});var s=i(41507);let o="data-show";function r(e,t,i=()=>{},{mainAxis:a,crossAxis:n,rootBoundary:l,ignoreShift:c}={}){let d,h="hidden",u=window.getComputedStyle(t).maxHeight;function p(){let i={rootBoundary:"function"==typeof l?l():l};(0,s.rD)(e,t,{middleware:[(0,s.cY)({mainAxis:a??14,crossAxis:n??0}),(0,s.RK)({allowedPlacements:["top","bottom"],...i}),(0,s.BN)(i),(0,s.Ej)({...i,apply({availableHeight:e}){t.style.maxHeight=u?`min(${u}, ${e}px)`:`${e}px`}})]}).then(({x:e,y:i,middlewareData:s})=>{c||(e+=s.shift?.x??0,i+=s.shift?.y??0),Object.assign(t.style,{position:"absolute",zIndex:1,left:`${e}px`,top:`${i}px`})}).catch(console.error)}let f=(r=!1)=>{let a="show"===h;(!a||r)&&(a||(t.setAttribute(o,""),i({display:h="show"})),d?.(),d=(0,s.ll)(e,t,p,{animationFrame:!0}))},g=()=>{"hidden"!==h&&(t.removeAttribute(o),i({display:h="hidden"}),d?.())},m=function(e,t){let i=i=>{i.composedPath().includes(e)||t()};return document.addEventListener("click",i),{dispose:()=>{document.removeEventListener("click",i)}}}(e,()=>g());return{get state(){return h},show:f,hide:g,toggle:()=>{t.hasAttribute(o)?g():f()},dispose:()=>{d?.(),m.dispose()}}}},8834:(e,t,i)=>{i.d(t,{Ak:()=>p,BQ:()=>a,GR:()=>f,Oo:()=>u,QI:()=>d,dG:()=>c,f9:()=>l,fh:()=>o,on:()=>h,q5:()=>n});var s,o,r=i(63820);function a(e){return r.pz||r.vL?e.ctrlKey||e.metaKey:e.ctrlKey}function n(e){return(s.AUXILIARY&e.buttons)===s.AUXILIARY}function l(e){return(s.SECONDARY&e.buttons)===s.SECONDARY}function c(e){e.stopPropagation()}function d(e){return e.ctrlKey||e.metaKey||e.altKey}function h(e,t,i,s){return e.addEventListener(t,i,s),()=>{e.removeEventListener(t,i,s)}}function u(e,t,i,s){let o=e=>{r(),i(e)},r=()=>{e.removeEventListener(t,o,s)};return e.addEventListener(t,o,s),r}function p(e,t){return requestAnimationFrame(()=>{if(void 0===t){e();return}t.isConnected&&e()})}function f(e,t){let i;let s=[];return(...o)=>{s=o,void 0===i&&(i=p(()=>{i=void 0,e(...s)},t))}}!function(e){e[e.AUXILIARY=4]="AUXILIARY",e[e.FIFTH=16]="FIFTH",e[e.FORTH=8]="FORTH",e[e.NO_BUTTON=0]="NO_BUTTON",e[e.PRIMARY=1]="PRIMARY",e[e.SECONDARY=2]="SECONDARY"}(s||(s={})),function(e){e[e.AUXILIARY=1]="AUXILIARY",e[e.FIFTH=4]="FIFTH",e[e.FORTH=3]="FORTH",e[e.MAIN=0]="MAIN",e[e.SECONDARY=2]="SECONDARY"}(o||(o={}))},7489:(e,t,i)=>{i.d(t,{UE:()=>n,WN:()=>l,YF:()=>h,p6:()=>a});var s=i(68419),o=i(73134);let r=[{description:"Images",accept:{"image/*":[".avif",".gif",".jpeg",".jpg",".png",".tif",".tiff",".webp"]}},{description:"Videos",accept:{"video/*":[".avi",".mp4",".mpeg",".ogg",".webm",".3gp",".3g2"]}},{description:"Audios",accept:{"audio/*":[".aac",".mid",".midi",".mp3",".oga",".opus",".wav",".weba",".3gp",".3g2"]}},{description:"Markdown",accept:{"text/markdown":[".md",".markdown"]}},{description:"Html",accept:{"text/html":[".html",".htm"]}},{description:"Zip",accept:{"application/zip":[".zip"]}}];async function a({acceptType:e="Any",multiple:t=!1}={}){if("showOpenFilePicker"in window&&(()=>{try{return window.self===window.top}catch{return!1}})()&&window.showOpenFilePicker)try{let i=r.find(t=>t.description===e);if("Any"!==e&&!i)throw new s.Ss(o.O.DefaultRuntimeError,`Unexpected acceptType "${e}"`);let a=await window.showOpenFilePicker({types:i?[i]:void 0,multiple:t});if(!t)return await a[0].getFile();return await Promise.all(a.map(async e=>await e.getFile()))}catch(e){return console.error("Error opening file"),console.error(e),null}return new Promise(i=>{let s=document.createElement("input");s.classList.add("affine-upload-input"),s.style.display="none",s.type="file",t&&(s.multiple=!0),"Any"!==e&&(s.accept=Object.keys(r.find(t=>t.description===e)?.accept??"").join(",")),document.body.append(s),s.addEventListener("change",()=>{if(s.remove(),!s.files){i(null);return}if(t){i(Array.from(s.files));return}i(s.files[0])}),s.addEventListener("cancel",()=>{i(null)}),"showPicker"in HTMLInputElement.prototype?s.showPicker():s.click()})}async function n(){return await a({acceptType:"Images",multiple:!0})||[]}function l(e,t){let i=URL.createObjectURL(e),s=document.createElement("a"),o=new MouseEvent("click");s.download=t,s.href=i,s.dispatchEvent(o),s.remove(),URL.revokeObjectURL(i)}let c=new Map,d=new Map;function h(){return{saveAttachmentData:(e,t)=>{c.size>100&&(console.warn("Clear the temp attachment data. It may cause filename loss when converting between image and attachment."),c.clear()),c.set(e,t)},getAttachmentData:e=>{let t=c.get(e);return c.delete(e),t},saveImageData:(e,t)=>{d.size>100&&(console.warn("Clear temp image data. It may cause image width and height loss when converting between image and attachment."),d.clear()),d.set(e,t)},getImageData:e=>{let t=d.get(e);return d.delete(e),t}}}},74597:(e,t,i)=>{i.d(t,{u:()=>s});let s=e=>{e=e.trim();let t=[],i=Object.create(null);for(let i=0;i{i.d(t,{z:()=>s});function s(e){return e instanceof Error&&"AbortError"===e.name}},60019:(e,t,i)=>{i.d(t,{D9:()=>s.D9,ko:()=>s.ko,rw:()=>l.r,Km:()=>p.Km,xw:()=>p.xw,Au:()=>n.Au,UL:()=>n.UL,Ip:()=>c,j0:()=>o.j,Ux:()=>u.U,xK:()=>g,H1:()=>n.H1,Zr:()=>p.Zr,DG:()=>n.DG,X7:()=>n.X7,bL:()=>n.bL,N8:()=>n.N8,hF:()=>n.hF,oV:()=>p.oV,RX:()=>n.RX,$$:()=>n.$$,jl:()=>n.jl,UE:()=>h.UE,h9:()=>n.h9,BE:()=>n.BE,wH:()=>n.wH,$n:()=>n.$n,mD:()=>n.mD,kW:()=>p.kW,Xn:()=>n.Xn,QI:()=>d.QI,a6:()=>a.a,Ar:()=>n.Ar,zU:()=>n.zU,q5:()=>d.q5,f9:()=>d.f9,BQ:()=>d.BQ,op:()=>a.o,on:()=>d.on,Oo:()=>d.Oo,p6:()=>h.p6,Ak:()=>d.Ak,GR:()=>d.GR,xb:()=>p.xb});var s=i(38509),o=i(72895),r=i(71006),a=i(92820),n=i(72938),l=i(64094);function c(e,t,i,s=[],o=1,d=null){let h=t.doc.getSchemaByFlavour("affine:database");(0,r.Z1)(h);let u=h.model.children??[],p=!0;if(u.length&&(s.length?p=s.map(n.BE).every(e=>u.includes(e.flavour)):d&&(p=u.includes(d))),!p&&!(0,a.o)(t,["affine:database"])){let e=i.closest("affine-database");e&&(i=e,t=(0,n.BE)(i))}let f="none",g=3*o,{rect:m,flag:v}=(0,n.$$)(e,t,i);if(v===n.rY.EmptyDatabase){let e=l.r.fromDOMRect(m);return e.top-=g/2,e.height=g,{type:f="database",rect:e,modelState:{model:t,rect:m,element:i}}}if(v===n.rY.Database){let s=Math.abs(m.top-e.y)1?f.z.union(e.map(e=>f.z.literal(e))):1===e.length?f.z.literal(e[0]):f.z.never()}},43462:(e,t,i)=>{i.d(t,{U:()=>s});function s(e,t={}){let i=e.createDoc({id:t.id});i.load();let o=t.title??"",r=i.addBlock("affine:page",{title:new i.Text(o)});e.setDocMeta(i.id,{title:o}),i.addBlock("affine:surface",{},r);let a=i.addBlock("affine:note",{},r);return i.addBlock("affine:paragraph",{},a),i.resetHistory(),i}},62602:(e,t,i)=>{function s(e,t){let i={};return e.forEach(e=>{let s=t(e);null!==s&&(i[s]||(i[s]=0),i[s]+=1)}),i}function o(e,t){if(!e.length)return null;let i=e[0],s=t(i);for(let o=1;os&&(s=a,i=r)}return i}function r(e,t,i){let s=0;for(let o=0;o=i)return!0;return!1}function a(e,t){let i={};for(let s of e){let e="function"==typeof t?t(s):s[t];i[e]||(i[e]=[]),i[e].push(s)}return i}function n(e,t){return t.reduce((t,i)=>(t[i]=e[i],t),{})}function l(e,t){return t.reduce((t,i)=>(t.push(e[i]),t),[])}function c(e){return Object.keys(e)}function d(e){return Object.values(e)}function h(e){let t;if(Array.isArray(e))return e[e.length-1];for(let i of e)t=i;return t}function u(e,t){if(Array.isArray(e))return e[e.length-t];let i=[...e];return i[i.length-t]}i.d(t,{$z:()=>a,E7:()=>u,HP:()=>c,HV:()=>h,I8:()=>r,ME:()=>l,Sk:()=>o,Tr:()=>s,Up:()=>n,zu:()=>d})},82750:(e,t,i)=>{function s(e,t,i=1e-4){return Math.abs(e-t)i?i:e}function r(e,t,i){return i-=t,e=(e-t+i)%i,t+(Number.isNaN(e)?0:e)}function a(e,t=!0,i=1){let s=t?1e3:1024;if(Math.abs(e)=s&&rr,bn:()=>a,f3:()=>s,qE:()=>o})},92820:(e,t,i)=>{i.d(t,{a:()=>function e(t,i,s){let o=t.getParent(i);return null!==o&&(s===o.flavour||e(t,o,s))},o:()=>Q});var s=i(56278);let o=e=>{if("string"!=typeof e)throw TypeError("invalid pattern");if(e.length>65536)throw TypeError("pattern is too long")},r={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},a=e=>e.replace(/[[\]\\-]/g,"\\$&"),n=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),l=e=>e.join(""),c=(e,t)=>{if("["!==e.charAt(t))throw Error("not in a brace expression");let i=[],s=[],o=t+1,c=!1,d=!1,h=!1,u=!1,p=t,f="";e:for(;of?i.push(a(f)+"-"+a(n)):n===f&&i.push(a(n)),f="",o++;continue}if(e.startsWith("-]",o+1)){i.push(a(n+"-")),o+=2;continue}if(e.startsWith("-",o+1)){f=n,o+=2;continue}i.push(a(n)),o++}if(pt?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),h=new Set(["!","?","+","*","@"]),u=e=>h.has(e),p="(?!\\.)",f=new Set(["[","."]),g=new Set(["..","."]),m=new Set("().*{}+?[]^$\\!"),v=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),y="[^/]",b=y+"*?",w=y+"+?";class x{type;#eb;#ew;#ex=!1;#e_=[];#eC;#ek;#eS;#eM=!1;#eE;#eI;#eB=!1;constructor(e,t,i={}){this.type=e,e&&(this.#ew=!0),this.#eC=t,this.#eb=this.#eC?this.#eC.#eb:this,this.#eE=this.#eb===this?i:this.#eb.#eE,this.#eS=this.#eb===this?[]:this.#eb.#eS,"!"!==e||this.#eb.#eM||this.#eS.push(this),this.#ek=this.#eC?this.#eC.#e_.length:0}get hasMagic(){if(void 0!==this.#ew)return this.#ew;for(let e of this.#e_)if("string"!=typeof e&&(e.type||e.hasMagic))return this.#ew=!0;return this.#ew}toString(){return void 0!==this.#eI?this.#eI:this.type?this.#eI=this.type+"("+this.#e_.map(e=>String(e)).join("|")+")":this.#eI=this.#e_.map(e=>String(e)).join("")}#e$(){let e;if(this!==this.#eb)throw Error("should only call on root");if(this.#eM)return this;for(this.toString(),this.#eM=!0;e=this.#eS.pop();){if("!"!==e.type)continue;let t=e,i=t.#eC;for(;i;){for(let s=t.#ek+1;!i.type&&s"string"==typeof e?e:e.toJSON()):[this.type,...this.#e_.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#eb||this.#eb.#eM&&this.#eC?.type==="!")&&e.push({}),e}isStart(){if(this.#eb===this)return!0;if(!this.#eC?.isStart())return!1;if(0===this.#ek)return!0;let e=this.#eC;for(let t=0;t{let[s,o,r,a]="string"==typeof t?x.#eO(t,this.#ew,i):t.toRegExpSource(e);return this.#ew=this.#ew||r,this.#ex=this.#ex||a,s}).join(""),o="";if(this.isStart()&&"string"==typeof this.#e_[0]&&!(1===this.#e_.length&&g.has(this.#e_[0]))){let i=t&&f.has(s.charAt(0))||s.startsWith("\\.")&&f.has(s.charAt(2))||s.startsWith("\\.\\.")&&f.has(s.charAt(4)),r=!t&&!e&&f.has(s.charAt(0));o=i?"(?!(?:^|/)\\.\\.?(?:$|/))":r?p:""}let r="";return this.isEnd()&&this.#eb.#eM&&this.#eC?.type==="!"&&(r="(?:$|\\/)"),[o+s+r,d(s),this.#ew=!!this.#ew,this.#ex]}let i="*"===this.type||"+"===this.type,s="!"===this.type?"(?:(?!(?:":"(?:",o=this.#eP(t);if(this.isStart()&&this.isEnd()&&!o&&"!"!==this.type){let e=this.toString();return this.#e_=[e],this.type=null,this.#ew=void 0,[e,d(this.toString()),!1,!1]}let r=!i||e||t||!p?"":this.#eP(!0);return r===o&&(r=""),r&&(o=`(?:${o})(?:${r})*?`),["!"===this.type&&this.#eB?(this.isStart()&&!t?p:"")+w:s+o+("!"===this.type?"))"+(!this.isStart()||t||e?"":p)+b+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&r?")":"*"===this.type&&r?")?":`)${this.type}`),d(o),this.#ew=!!this.#ew,this.#ex]}#eP(e){return this.#e_.map(t=>{if("string"==typeof t)throw Error("string type in extglob ast??");let[i,s,o,r]=t.toRegExpSource(e);return this.#ex=this.#ex||r,i}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static #eO(e,t,i=!1){let s=!1,o="",r=!1;for(let a=0;a(o(t),(!!i.nocomment||"#"!==t.charAt(0))&&new X(t,i).match(e)),C=/^\*+([^+@!?\*\[\(]*)$/,k=e=>t=>!t.startsWith(".")&&t.endsWith(e),S=e=>t=>t.endsWith(e),M=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),E=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),I=/^\*+\.\*+$/,B=e=>!e.startsWith(".")&&e.includes("."),$=e=>"."!==e&&".."!==e&&e.includes("."),T=/^\.\*+$/,O=e=>"."!==e&&".."!==e&&e.startsWith("."),P=/^\*+$/,H=e=>0!==e.length&&!e.startsWith("."),A=e=>0!==e.length&&"."!==e&&".."!==e,L=/^\?+([^+@!?\*\[\(]*)?$/,D=([e,t=""])=>{let i=z([e]);return t?(t=t.toLowerCase(),e=>i(e)&&e.toLowerCase().endsWith(t)):i},Z=([e,t=""])=>{let i=R([e]);return t?(t=t.toLowerCase(),e=>i(e)&&e.toLowerCase().endsWith(t)):i},j=([e,t=""])=>{let i=R([e]);return t?e=>i(e)&&e.endsWith(t):i},V=([e,t=""])=>{let i=z([e]);return t?e=>i(e)&&e.endsWith(t):i},z=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(".")},R=([e])=>{let t=e.length;return e=>e.length===t&&"."!==e&&".."!==e},F="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",N={win32:{sep:"\\"},posix:{sep:"/"}},q="win32"===F?N.win32.sep:N.posix.sep;_.sep=q;let U=Symbol("globstar **");_.GLOBSTAR=U,_.filter=(e,t={})=>i=>_(i,e,t);let W=(e,t={})=>Object.assign({},e,t);_.defaults=e=>{if(!e||"object"!=typeof e||!Object.keys(e).length)return _;let t=_;return Object.assign((i,s,o={})=>t(i,s,W(e,o)),{Minimatch:class extends t.Minimatch{constructor(t,i={}){super(t,W(e,i))}static defaults(i){return t.defaults(W(e,i)).Minimatch}},AST:class extends t.AST{constructor(t,i,s={}){super(t,i,W(e,s))}static fromGlob(i,s={}){return t.AST.fromGlob(i,W(e,s))}},unescape:(i,s={})=>t.unescape(i,W(e,s)),escape:(i,s={})=>t.escape(i,W(e,s)),filter:(i,s={})=>t.filter(i,W(e,s)),defaults:i=>t.defaults(W(e,i)),makeRe:(i,s={})=>t.makeRe(i,W(e,s)),braceExpand:(i,s={})=>t.braceExpand(i,W(e,s)),match:(i,s,o={})=>t.match(i,s,W(e,o)),sep:t.sep,GLOBSTAR:U})};let G=(e,t={})=>(o(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e))?[e]:s(e);_.braceExpand=G,_.makeRe=(e,t={})=>new X(e,t).makeRe(),_.match=(e,t,i={})=>{let s=new X(t,i);return e=e.filter(e=>s.match(e)),s.options.nonull&&!e.length&&e.push(t),e};let Y=/[?*]|[+@!]\(.*?\)|\[|\]/,K=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class X{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){o(e),t=t||{},this.options=t,this.pattern=e,this.platform=t.platform||F,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||!1===t.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==t.windowsNoMagicRoot?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if("string"!=typeof t)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0)){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let s=this.globParts.map((e,t,i)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=""===e[0]&&""===e[1]&&("?"===e[2]||!Y.test(e[2]))&&!Y.test(e[3]),i=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(i)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,s),this.set=s.filter(e=>-1===e.indexOf(!1)),this.isWindows)for(let e=0;e=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;-1!==(t=e.indexOf("**",t+1));){let i=t;for(;"**"===e[i+1];)i++;i!==t&&e.splice(t,i-t)}return e})}levelOneOptimize(e){return e.map(e=>0===(e=e.reduce((e,t)=>{let i=e[e.length-1];return"**"===t&&"**"===i||(".."===t&&i&&".."!==i&&"."!==i&&"**"!==i?e.pop():e.push(t)),e},[])).length?[""]:e)}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;is&&i.splice(s+1,o-s);let r=i[s+1],a=i[s+2],n=i[s+3];if(".."!==r||!a||"."===a||".."===a||!n||"."===n||".."===n)continue;t=!0,i.splice(s,1);let l=i.slice(0);l[s]="**",e.push(l),s--}if(!this.preserveMultipleSlashes){for(let e=1;ee.length)}partsMatch(e,t,i=!1){let s=0,o=0,r=[],a="";for(;sa?t=t.slice(n):a>n&&(e=e.slice(a)))}}let{optimizationLevel:o=1}=this.options;o>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var r=0,a=0,n=e.length,l=t.length;r>> no match, partial?",e,h,t,u),h===n))return!0;return!1}if("string"==typeof c?(o=d===c,this.debug("string match",c,d,o)):(o=c.test(d),this.debug("pattern match",c,d,o)),!o)return!1}if(r===n&&a===l)return!0;if(r===n)return i;if(a===l)return r===n-1&&""===e[r];throw Error("wtf?")}braceExpand(){return G(this.pattern,this.options)}parse(e){let t;o(e);let i=this.options;if("**"===e)return U;if(""===e)return"";let s=null;(t=e.match(P))?s=i.dot?A:H:(t=e.match(C))?s=(i.nocase?i.dot?E:M:i.dot?S:k)(t[1]):(t=e.match(L))?s=(i.nocase?i.dot?Z:D:i.dot?j:V)(t):(t=e.match(I))?s=i.dot?$:B:(t=e.match(T))&&(s=O);let r=x.fromGlob(e,this.options).toMMPattern();return s&&"object"==typeof r&&Reflect.defineProperty(r,"test",{value:s}),r}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,i=t.noglobstar?"[^/]*?":t.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",s=new Set(t.nocase?["i"]:[]),o=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(""))s.add(t);return"string"==typeof e?K(e):e===U?U:e._src});return t.forEach((e,s)=>{let o=t[s+1],r=t[s-1];e===U&&r!==U&&(void 0===r?void 0!==o&&o!==U?t[s+1]="(?:\\/|"+i+"\\/)?"+o:t[s]=i:void 0===o?t[s-1]=r+"(?:\\/|"+i+")?":o!==U&&(t[s-1]=r+"(?:\\/|\\/"+i+"\\/)"+o,t[s+1]=U))}),t.filter(e=>e!==U).join("/")}).join("|"),[r,a]=e.length>1?["(?:",")"]:["",""];o="^"+r+o+a+"$",this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...s].join(""))}catch(e){this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;let i=this.options;this.isWindows&&(e=e.split("\\").join("/"));let s=this.slashSplit(e);this.debug(this.pattern,"split",s);let o=this.set;this.debug(this.pattern,"set",o);let r=s[s.length-1];if(!r)for(let e=s.length-2;!r&&e>=0;e--)r=s[e];for(let e=0;e_(e.flavour,t))}_.AST=x,_.Minimatch=X,_.escape=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),_.unescape=d},72938:(e,t,i)=>{i.d(t,{$$:()=>V,$n:()=>p,Ar:()=>m,Au:()=>h,BE:()=>H,DG:()=>y,H1:()=>O,HA:()=>c,KW:()=>x,N8:()=>P,NN:()=>f,RL:()=>function e(t,i,s={}){if(i.id in s)return console.error("Can't get next block! There's a loop in the block tree!"),null;s[i.id]=!0;let o=i.doc;if(i.children.length)return i.children[0];let r=i;for(;r;){let i=o.getNext(r);if(i){if((0,n.o)(i,["affine:note"])){if(m(t))return null;return e(t,i)}return i}r=o.getParent(r)}return null},RX:()=>S,UL:()=>d,X7:()=>b,Xn:()=>R,bL:()=>L,dV:()=>v,dz:()=>C,h9:()=>_,hF:()=>T,jl:()=>Z,mD:()=>u,rY:()=>s,wH:()=>A,zB:()=>k,zU:()=>g});var s,o=i(71006),r=i(93574),a=i(82750),n=i(92820);let l=`[${r.u_}]`;function c(e,t){let i=t=>{let i=t.doc.getParent(t);if(!i)return null;let s=i.children.indexOf(t);if(s>0){let e=i.children[s-1];for(;e.children.length>0;)e=e.children[e.children.length-1];return e}return m(e)&&(0,n.o)(i,["affine:note"])?null:i},s={},o=e=>{if(e.id in s)return console.error("Can't get previous block! There's a loop in the block tree!"),null;s[e.id]=!0;let t=i(e);return t?"content"!==t.role||(0,n.o)(t,["affine:frame"])?o(t):t:null};return o(t)}function d(e){let t=[],i=e;for(;i;)t.unshift(i.id),i=i.doc.getParent(i);return t}function h(e,t){if(!(0,n.o)(e,["affine:image","affine:frame"]))return t.getBlock(e.id);{let i=e,s=null;for(;i;){if(!(0,n.o)(i,["affine:surface"])){s=i.id;break}i=i.doc.getParent(i)}return t.getBlock(s||e.id)}}function u(e){let t=f(e);return t?t:e.closest("affine-edgeless-root")||null}function p(e){return e.querySelector("affine-page-root")??e.querySelector("affine-edgeless-root")}function f(e){return e.closest("affine-page-root")}function g(e){return Array.from(e.children).some(e=>"affine-page-root"===e.tagName.toLowerCase())}function m(e){return Array.from(e.children).some(e=>"affine-edgeless-root"===e.tagName.toLowerCase())}function v(e){if(!g(e))return null;let t=e.doc;if(!t.root)return console.error("Failed to get root doc"),null;let i=e.view.viewFromPath("block",[t.root.id]);return i&&i.closest("affine-page-root")===i?i.viewportElement:(console.error("Failed to get viewport element!"),null)}function y(e,t){return t?b(e,t.id):null}function b(e,t){return e.view.getBlock(t)}async function w(e,t){let i=e.doc.root?.id;if(!i)return null;let s=e.view.getBlock(i);return s?(await s.updateComplete,e.view.getBlock(t)):null}async function x(e,t){let i=await w(e,t);return i?(await i.updateComplete,i?.querySelector("rich-text")||null):null}function _(e,t){if((0,n.o)(t,["affine:database"]))return null;let i=function(e,t){let i=e.view.getBlock(t);return i?.querySelector("rich-text")||null}(e,t.id);return i?i.inlineEditor:null}function C(e){let t=e.closest(l);return(0,o.Z1)(t,"Cannot find block element by element"),H(t)}function k(e){let t=e.closest(".affine-page-viewport");return t?t.querySelector("doc-title"):null}function S(e){let t=k(e);if(!t)return null;let i=t.querySelector("rich-text");return(0,o.Z1)(i),i.inlineEditor}function M(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY}function E(e){return e.hasAttribute(r.u_)}function I(e){return!(0,n.o)(e.model,["affine:page","affine:note","affine:surface"])}function B({tagName:e}){return"AFFINE-DATABASE-TABLE"===e||"AFFINE-DATABASE"===e}function $({classList:e}){return e.contains("note-background")}function T(e,t=null,i=1){let s;let{y:o}=e,n=null,l=null,c=null,d=0,h=1;if(t){let{snapToEdge:o={x:!0,y:!1}}=t;s=t.container;let n=t.rect||s?.getBoundingClientRect();n&&(o.x&&(e.x=Math.min(Math.max(e.x,n.left)+r.s6*i-1,n.right-r.s6*i-1)),o.y&&(1!==i&&console.warn("scale is not supported yet"),e.y=(0,a.qE)(e.y,n.top+1,n.bottom-1)))}if(n=D(document.elementsFromPoint(e.x,e.y),s)){if(B(n)){l=n.getBoundingClientRect();let t=j(n);if(t){if(!(c=t.getBoundingClientRect()).height||e.yc.bottom)return n;c=null}}else{if(l=A(n),!(c=n.querySelector(".affine-block-children-container")?.firstElementChild?.getBoundingClientRect())||!c.height||l.x=0&&d<=16||(d=e.y-l.top)>=0&&d<=16)return n;l=null,n=null}while(h<=8)return n}function O(e,t,i){let s=Array.from(e.querySelectorAll(i)).filter(t=>t.host===e.host).filter(t=>t!==e),o=Number.POSITIVE_INFINITY,r=null;if(!s.length)return null;for(let e of s){let i=e.getBoundingClientRect();if(0===i.height||t.y>i.bottom||t.y0===i||!M(t,e)&&(t=e,!0))}function D(e,t){let i=e.length,s=null,o=0;for(;oc.bottom)return r;let d=document.elementsFromPoint(e.x,e.y),h=d.length,u=0;for(;ue.classList.contains(t))}!function(e){e[e.Normal=0]="Normal",e[e.Database=1]="Database",e[e.EmptyDatabase=2]="EmptyDatabase"}(s||(s={}))},64094:(e,t,i)=>{i.d(t,{r:()=>o});var s=i(46427);class o{constructor(e,t,i,o){let[r,a]=e<=i?[e,i]:[i,e],[n,l]=t<=o?[t,o]:[o,t];this.min=new s.b(r,n),this.max=new s.b(a,l)}static fromDOM(e){return o.fromDOMRect(e.getBoundingClientRect())}static fromDOMRect({left:e,top:t,right:i,bottom:s}){return o.fromLTRB(e,t,i,s)}static fromLTRB(e,t,i,s){return new o(e,t,i,s)}static fromLWTH(e,t,i,s){return new o(e,i,e+t,i+s)}static fromPoint(e){return o.fromPoints(e.clone(),e)}static fromPoints(e,t){let i=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y),r=Math.min(t.x,e.x),a=Math.min(t.y,e.y);return o.fromLWTH(r,i,a,s)}static fromXY(e,t){return o.fromPoint(new s.b(e,t))}center(){return new s.b((this.left+this.right)/2,(this.top+this.bottom)/2)}clamp(e){return s.b.clamp(e,this.min,this.max)}clone(){let{left:e,top:t,right:i,bottom:s}=this;return new o(e,t,i,s)}contains({min:e,max:t}){return this.isPointIn(e)&&this.isPointIn(t)}equals({min:e,max:t}){return this.min.equals(e)&&this.max.equals(t)}extend_with(e){this.min=s.b.min(this.min,e),this.max=s.b.max(this.max,e)}extend_with_x(e){this.min.x=Math.min(this.min.x,e),this.max.x=Math.max(this.max.x,e)}extend_with_y(e){this.min.y=Math.min(this.min.y,e),this.max.y=Math.max(this.max.y,e)}intersect(e){return o.fromPoints(s.b.max(this.min,e.min),s.b.min(this.max,e.max))}intersects({left:e,top:t,right:i,bottom:s}){return this.left<=i&&e<=this.right&&this.top<=s&&t<=this.bottom}isPointDown({x:e,y:t}){return this.bottom=e}isPointIn({x:e,y:t}){return this.left<=e&&e<=this.right&&this.top<=t&&t<=this.bottom}isPointLeft({x:e,y:t}){return e=t}isPointRight({x:e,y:t}){return e>this.right&&this.top<=t&&this.bottom>=t}isPointUp({x:e,y:t}){return t=e}toDOMRect(){let{left:e,top:t,width:i,height:s}=this;return new DOMRect(e,t,i,s)}get bottom(){return this.max.y}set bottom(e){this.max.y=e}get height(){return this.max.y-this.min.y}set height(e){this.max.y=this.min.y+e}get left(){return this.min.x}set left(e){this.min.x=e}get right(){return this.max.x}set right(e){this.max.x=e}get top(){return this.min.y}set top(e){this.min.y=e}get width(){return this.max.x-this.min.x}set width(e){this.max.x=this.min.x+e}}},74351:(e,t,i)=>{i.d(t,{B$:()=>O,G6:()=>w,QH:()=>k,Zp:()=>H,ah:()=>P,eD:()=>x,fG:()=>b,rq:()=>_,zX:()=>y});var s=i(7595),o=i(94098),r=i(71006),a=i(73711),n=i(91449),l=i(96448),c=i(17742),d=i(35739),h=i(59242),u=i(61677),p=i(28290),f=i(93574),g=i(38509),m=i(13428),v=i(92820);let y=(0,n.AH)` .affine-embed-doc-content-note-blocks affine-divider, .affine-embed-doc-content-note-blocks affine-divider > * { margin-top: 0px !important; margin-bottom: 0px !important; padding-top: 8px; padding-bottom: 8px; } .affine-embed-doc-content-note-blocks affine-paragraph, .affine-embed-doc-content-note-blocks affine-list { margin-top: 4px !important; margin-bottom: 4px !important; padding: 0 2px; } .affine-embed-doc-content-note-blocks affine-paragraph *, .affine-embed-doc-content-note-blocks affine-list * { margin-top: 0px !important; margin-bottom: 0px !important; padding-top: 0; padding-bottom: 0; line-height: 20px; font-size: var(--affine-font-xs); font-weight: 400; } .affine-embed-doc-content-note-blocks affine-list .affine-list-block__prefix { height: 20px; } .affine-embed-doc-content-note-blocks affine-paragraph .quote { padding-left: 15px; padding-top: 8px; padding-bottom: 8px; } .affine-embed-doc-content-note-blocks affine-paragraph:has(.h1), .affine-embed-doc-content-note-blocks affine-paragraph:has(.h2), .affine-embed-doc-content-note-blocks affine-paragraph:has(.h3), .affine-embed-doc-content-note-blocks affine-paragraph:has(.h4), .affine-embed-doc-content-note-blocks affine-paragraph:has(.h5), .affine-embed-doc-content-note-blocks affine-paragraph:has(.h6) { margin-top: 6px !important; margin-bottom: 4px !important; padding: 0 2px; } .affine-embed-doc-content-note-blocks affine-paragraph:has(.h1) *, .affine-embed-doc-content-note-blocks affine-paragraph:has(.h2) *, .affine-embed-doc-content-note-blocks affine-paragraph:has(.h3) *, .affine-embed-doc-content-note-blocks affine-paragraph:has(.h4) *, .affine-embed-doc-content-note-blocks affine-paragraph:has(.h5) *, .affine-embed-doc-content-note-blocks affine-paragraph:has(.h6) * { margin-top: 0px !important; margin-bottom: 0px !important; padding-top: 0; padding-bottom: 0; line-height: 20px; font-size: var(--affine-font-xs); font-weight: 600; } .affine-embed-linked-doc-block.horizontal { affine-paragraph, affine-list { margin-top: 0 !important; margin-bottom: 0 !important; max-height: 40px; overflow: hidden; display: flex; } affine-paragraph .quote { padding-top: 4px; padding-bottom: 4px; height: 28px; } affine-paragraph .quote::after { height: 20px; margin-top: 4px !important; margin-bottom: 4px !important; } } `;function b(e,t){let i=e.std.spec.getService("affine:page").notificationService;return i?i.prompt({title:"Create linked doc",message:"Enter a title for the new doc.",placeholder:"Untitled",autofill:t,confirmText:"Confirm",cancelText:"Cancel"}):Promise.resolve(void 0)}function w(e){let t=e[0];if((0,v.o)(t,["affine:paragraph"])&&t.type.startsWith("h"))return t.text.toString()}function x(e,t){let i=e.std.spec.getService("affine:page").notificationService;if(!i)return;let s=new AbortController,o=()=>{t.history.off("stack-item-added",a),t.history.off("stack-item-popped",n),l.dispose()},r=()=>{s.abort(),o()},a=t.history.on("stack-item-added",r),n=t.history.on("stack-item-popped",r),l=e.slots.unmounted.on(r);i.notify({title:"Linked doc created",message:"You can click undo to recovery block content",accent:"info",duration:1e4,action:{label:"Undo",onClick:()=>{t.undo(),o()}},abort:s.signal,onClose:o})}function _(e){let t=e.linkedDoc;(0,r.Z1)(t,`Trying to load page ${e.model.pageId} in linked page block, but the page is not found.`),function(e){e.isBannerEmpty=!0;let t=e.std.spec.getService("affine:surface-ref");(0,r.Z1)(t,"Surface ref service not found."),e.surfaceRefService=t,e.cleanUpSurfaceRefRenderer();let i=e.linkedDoc;(0,r.Z1)(i,`Trying to load page ${e.model.pageId} in linked page block, but the page is not found.`),e.surfaceRefRenderer=e.surfaceRefService.getRenderer(s.yX.id(e.path),i),e.surfaceRefRenderer.slots.mounted.on(()=>{"edgeless"===e.editorMode?I(e).catch(t=>{console.error(t),e.isError=!0}):B(e).catch(t=>{console.error(t),e.isError=!0})}),e.surfaceRefRenderer.mount()}(e),M(e).catch(t=>{console.error(t),e.isError=!0})}function C(e){let t=e.root?.children.filter(e=>v.o(e,["affine:note"])&&e.displayMode!==g.ko.EdgelessOnly);return t&&t.length?t:null}function k(e,t){if(!e)return!0;if("page"===t){let t=C(e);return!t||!t.length||t.every(e=>e.children.every(e=>"affine:paragraph"===e.flavour&&(!e.text||0===e.text.length)))}{let t=(0,p.J)(e);return!t?.elementModels.length&&!(e.blockSize>2)}}function S(e){return!!(0,v.o)(e,["affine:divider"])||!!(0,v.o)(e,["affine:paragraph","affine:list"])&&!!e.text?.toString().length}async function M(e){e.isNoteContentEmpty=!0;let t=e.linkedDoc;(0,r.Z1)(t,`Trying to load page ${e.model.pageId} in linked page block, but the page is not found.`);let i=C(t);if(!i)return;let s=i.flatMap(e=>e.children.filter(S));if(!s.length)return;e.isNoteContentEmpty=!1;let o=e.model.style,l=await e.noteContainer;for(;l.firstChild;)l.firstChild.remove();let c=document.createElement("div");if(c.classList.add("affine-embed-doc-content-note-blocks"),c.contentEditable="false",l.append(c),"horizontal"===o)s.splice(1);else{let e=Math.floor(f.Hn[o]/20);s.length>e&&s.splice(e)}let d=s.map(e=>e.id),u=[];d.map(e=>{let i=e;for(;i&&!u.includes(i);)u.push(i),i=t.blockCollection.crud.getParent(i)});let p={mode:"strict",match:u.map(e=>({id:e,viewType:a.lv.Display}))},g=t.blockCollection.getDoc({query:p}),m=h.f.getInstance().getSpec("page:preview"),v=e.host.renderSpecPortal(g,m.value),y=document.createDocumentFragment();(0,n.XX)(v,y),c.append(y),c.querySelectorAll('[contenteditable="true"]').forEach(e=>{e.contentEditable="false"})}async function E(e,t){let i=await e.bannerContainer;if(i){for(;i.firstChild;)i.firstChild.remove();t instanceof HTMLElement?i.append(t):(0,n.XX)(t,i)}}async function I(e){let t=e.surfaceRefRenderer;(0,r.Z1)(t,"Surface ref renderer is not found.");let i=t.surfaceRenderer,s=document.createElement("div");await E(e,s),i.attach(s);let a=Array.from(t.surfaceModel?.elementModels??[]).map(e=>o.z.deserialize(e.xywh)),n=(0,u.ql)(a);n?(i.viewport.onResize(),i.viewport.setViewportByBound(n)):e.isBannerEmpty=!0}async function B(e){let t=e.linkedDoc;(0,r.Z1)(t,`Trying to load page ${e.model.pageId} in linked page block, but the page is not found.`);let i=C(t);if(!i){e.isBannerEmpty=!0;return}let s=i.flatMap(e=>e.children.filter(e=>(0,v.o)(e,["affine:image"])))[0];if(s){await $(e,s);return}e.isBannerEmpty=!0}async function $(e,t){let i=t.sourceId;if(!i)return;let s=e.linkedDoc?.blobSync;if(!s)return;let o=await s.get(i);if(!o)return;let r=URL.createObjectURL(o),a=document.createElement("img");a.src=r,await E(e,a),e.isBannerEmpty=!1}function T(e,t,i){let s=(0,m.i)(t),o=e.addBlock(t.flavour,s,i),r=t.children;r.length>0&&r.forEach(t=>{T(e,t,o)})}function O(e,t,i){let s=t[0];(0,r.Z1)(s);let o=i||w(t),a=function(e,t,i){let s=e.collection.createDoc({});return s.load(()=>{let o=s.addBlock("affine:page",{title:new e.Text(i)});s.addBlock("affine:surface",{},o);let r=s.addBlock("affine:note",{},o);t.forEach(e=>{T(s,e,r)})}),s}(e,t,o);return e.addSiblingBlocks(s,[{flavour:"affine:embed-linked-doc",pageId:a.id}],"before"),t.forEach(t=>e.deleteBlock(t)),a}function P(e,t,i){let s=e.collection.createDoc({});return s.load(()=>{let o=s.addBlock("affine:page",{title:new e.Text(i)});s.addBlock("affine:surface",{},o);let r=(0,m.i)(t),a=s.addBlock("affine:note",{...r,hidden:!1,displayMode:g.ko.DocAndEdgeless},o);t.children.forEach(e=>{T(s,e,a)})}),s}function H(e,t,i){let s=e.doc.collection.createDoc({});return s.load(()=>{let o=s.addBlock("affine:page",{title:new e.doc.Text(i)}),r=s.addBlock("affine:surface",{},o),a=(0,p.J)(s);if(!a)return;let n=(0,c.ym)(t),h=new Map;n.forEach(e=>{let t=e.id;if(e instanceof l.y){let i=(0,m.i)(e);(0,d._h)(e)?(t=s.addBlock("affine:note",i,o),e.children.forEach(e=>{T(s,e,t)})):t=s.addBlock(e.flavour,i,r)}else{let i=(0,c.TB)(e,h);t=a.addElement(i)}h.set(e.id,t)})}),e.spec.getService("affine:page").docModeService.setMode("edgeless",s.id),s}},28103:(e,t,i)=>{i.d(t,{B:()=>s});let s=e=>{let t=e;for(;t&&!o(t);)t=t.parentElement;return t??document.body},o=e=>{let t=window.getComputedStyle(e).overflowY;return"scroll"===t||"auto"===t}},23156:(e,t,i)=>{i.d(t,{Km:()=>c,Zr:()=>h,kW:()=>g,oV:()=>f,q3:()=>u,xb:()=>p,xw:()=>l});var s=i(63820),o=i(71006),r=i(92820),a=i(72938),n=i(64094);async function l(e,t,i){let s=await (0,a.KW)(e,t.id);if(!s)return;await s.updateComplete;let o=s.inlineEditor;o&&o.setInlineRange(i)}async function c(e,t,i=0){let s=e.std.selection;s.setGroup("note",[s.create("text",{from:{blockId:t,index:i,length:0},to:null})]),await e.updateComplete}function d(e,t){if(s.$M){let i=document.caretPositionFromPoint(e,t),s=document.createRange();return s.setStart(i.offsetNode,i.offset),s}let i=document.caretRangeFromPoint(e,t);if(!i)return null;let o=i?.getClientRects();return o&&2===o.length&&i.startOffset===i.endOffset&&t0&&(i.setStart(i.startContainer,i.startOffset-1),i.setEnd(i.endContainer,i.endOffset-1)),i}function h(e,t=1/0,i=0){let s=(0,a.RX)(e);s&&(t>s.yText.length&&(t=s.yText.length),s.setInlineRange({index:t,length:i}))}function u(e,t,i="end",s=1){if((0,r.o)(t,["affine:note","affine:page"])){console.error("Can't focus note or doc!");return}let o=e.view.viewFromPath("block",(0,a.UL)(t)),l=o?.querySelector("[contenteditable]");l&&function(e,t="end",i=1){(0,a.NN)(e)&&e.querySelector("v-line")?.scrollIntoView({block:"nearest"});let{left:s,right:o}=n.r.fromDOM(e),r=null;switch(t){case"start":r=function(e){let t=document.createRange(),i=e.firstChild;for(;i?.firstChild;)i=i.firstChild;return i&&(t.setStart(i,0),t.setEnd(i,0)),t}(e);break;case"end":r=function(e){let t=document.createRange(),i=e.lastChild;for(;i?.lastChild;)i=i.lastChild;return i&&(t.setStart(i,i.textContent?.length||0),t.setEnd(i,i.textContent?.length||0)),t}(e);break;default:{let{x:a,y:l}=t,c=a,h=function(e,t,i=1){let s=t.closest(".affine-page-viewport"),{top:o,bottom:r}=n.r.fromDOM(t),{clientHeight:a}=document.documentElement,l=(Number(window.getComputedStyle(t).lineHeight.replace(/\D+$/,""))||16)*i;switch(r{e=t.getBoundingClientRect().bottom})),e-l/2}case!1:{let e=o;return s&&o>a-100&&(s.scrollTop=s.scrollTop+(o+100-a),requestAnimationFrame(()=>{e=t.getBoundingClientRect().top})),e+l/2}}}(l,e,i);a<=s&&(c=s+1),a>=o&&(c=o-1),r=d(c,h)}}p(r)}(l,i,s)}function p(e){let t=window.getSelection();(0,o.Z1)(t),t.removeAllRanges(),e&&t.addRange(e)}function f(e=window.getSelection()){return e?0===e.rangeCount?null:(e.rangeCount>1&&console.warn("getCurrentNativeRange may be wrong, rangeCount > 1"),e.getRangeAt(0)):(console.error("Failed to get current range, selection is null"),null)}function g(e,t){let i=d(e,t);i?.startContainer instanceof Node&&p(i)}},30955:(e,t,i)=>{i.d(t,{AY:()=>c,XH:()=>u,Yr:()=>p,ZM:()=>h,l2:()=>l,yz:()=>f});var s=i(67066),o=i(66050);let r=["http","https","ftp","sftp","mailto","tel"],a=/^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/,n=RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)(?:\\S+(?::\\S*)?@)?(?:(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,6}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");function l(e){return r.find(t=>e.startsWith(t+":"))?e:a.test(e)?"mailto:"+e:"http://"+e}function c(e){if(!e)return!1;let t=l(e);if(t===e){try{new URL(t)}catch{return!1}return!0}return n.test(t)}let d=["com","org","net","edu","gov","co","io","me","moe","mil","top","dev","xyz","info","cat","ru","de","jp","uk","pro"];function h(e){return!!c(e)&&!!function(e){let t=e.hostname.split(".").pop();return!!t&&d.includes(t)}(new URL(l(e)))}function u(e){return c(e.getData("text/plain"))}function p(){return"light"===o.Q.mode?{LoadingIcon:s.ik,EmbedCardBannerIcon:s.XG,EmbedCardHorizontalIcon:s.bd,EmbedCardListIcon:s.bp,EmbedCardVerticalIcon:s.vq,EmbedCardCubeIcon:s.s9}:{LoadingIcon:s.i$,EmbedCardBannerIcon:s.$I,EmbedCardHorizontalIcon:s.$9,EmbedCardListIcon:s.Pl,EmbedCardVerticalIcon:s.dd,EmbedCardCubeIcon:s.O0}}function f(e){try{return new URL(e).hostname}catch{return e}}},49077:(e,t,i)=>{i.d(t,{OH:()=>l,Fl:()=>a,z_:()=>n});var s=i(73711),o=i(31971);class r extends s.S4{async fromSnapshot(e){let t=await super.fromSnapshot(e),i=t.props.sourceId;return!e.assets.isEmpty()&&i&&await e.assets.writeToBlob(i),t}async toSnapshot(e){let t=super.toSnapshot(e),i=e.model.sourceId;return i&&await e.assets.readFromBlob(i),t}}let a=["cubeThick","horizontalThin"],n={name:"",size:0,type:"application/octet-stream",sourceId:void 0,caption:void 0,embed:!1,style:a[1],index:"a0",xywh:"[0,0,0,0]",rotate:0},l=(0,s.A9)({flavour:"affine:attachment",props:()=>n,metadata:{version:1,role:"content",parent:["affine:note","affine:surface","affine:edgeless-text","affine:paragraph","affine:list"]},transformer:()=>new r,toModel:()=>new c});class c extends(0,o.S)(s.zg){}},22366:(e,t,i)=>{i.d(t,{DD:()=>n,HO:()=>r});var s=i(73711),o=i(18571);let r=["vertical","horizontal","list","cube"],a={style:r[1],url:"",caption:null,description:null,icon:null,image:null,title:null,index:"a0",xywh:"[0,0,0,0]",rotate:0},n=(0,s.A9)({flavour:"affine:bookmark",props:()=>a,metadata:{version:1,role:"content",parent:["affine:note","affine:surface","affine:edgeless-text","affine:paragraph","affine:list"]},toModel:()=>new l});class l extends(0,o.S)(s.zg){}},65828:(e,t,i)=>{i.d(t,{c:()=>r});var s=i(73711),o=i(10859);let r=(0,s.A9)({flavour:"affine:code",props:e=>({text:e.Text(),language:o.Kc,wrap:!1,caption:""}),metadata:{version:1,role:"content",parent:["affine:note","affine:paragraph","affine:list","affine:edgeless-text"],children:[]}})},10859:(e,t,i)=>{i.d(t,{Kc:()=>r,XR:()=>a,dA:()=>o,n0:()=>s});let s="dark-plus",o="light-plus",r="Plain Text",a={id:r,name:r,aliases:["plaintext","txt","text"],import:()=>Promise.resolve({default:[]})}},87196:(e,t,i)=>{i.d(t,{S:()=>a});var s=i(73711),o=i(73297);class r extends s.zg{constructor(){super()}applyViewsUpdate(){this.doc.updateBlock(this,{views:this.views})}deleteView(e){this.doc.captureSync(),this.doc.transact(()=>{this.views=this.views.filter(t=>t.id!==e)})}duplicateView(e){let t=this.doc.generateBlockId();return this.doc.transact(()=>{let i=this.views.findIndex(t=>t.id===e),s=this.views[i];s&&this.views.splice(i+1,0,JSON.parse(JSON.stringify({...s,id:t})))}),t}moveViewTo(e,t){this.doc.transact(()=>{this.views=(0,o.b)(this.views,t=>t.id===e,e=>(0,o.q)(t,e))}),this.applyViewsUpdate()}updateView(e,t){this.doc.transact(()=>{this.views=this.views.map(i=>i.id!==e?i:{...i,...t(i)})}),this.applyViewsUpdate()}}let a=(0,s.A9)({flavour:"affine:data-view",props:()=>({views:[],title:"",columns:[],cells:{}}),metadata:{role:"hub",version:1,parent:["affine:note"],children:["affine:paragraph","affine:list"]},toModel:()=>new r})},21984:(e,t,i)=>{i.d(t,{GA:()=>E,Mp:()=>M});var s=i(35018),o=i(42766),r=i(70008),a=i(25420),n=i(65967),l=i(57178),c=i(75973),d=i(63820),h=i(71006),u=i(91449),p=i(4564),f=i(3874),g=i(72938),m=i(30955),v=i(1634),y=i(61575),b=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},w=function(e,t,i){for(var s=arguments.length>2,o=0;o div { flex-grow: 1; } .data-view-header-area-icon { height: max-content; display: flex; align-items: center; margin-right: 8px; padding: 2px; border-radius: 4px; margin-top: 2px; background-color: var(--affine-background-secondary-color); } .data-view-header-area-icon svg { width: 14px; height: 14px; fill: var(--affine-icon-color); color: var(--affine-icon-color); } `,_=(()=>{let e,t,i=y.v,s=[],o=[],r=[],a=[];return class extends i{static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;e=[(0,p.P)("rich-text")],t=[(0,p.MZ)({attribute:!1})],b(this,null,e,{kind:"accessor",name:"richText",static:!1,private:!1,access:{has:e=>"richText"in e,get:e=>e.richText,set:(e,t)=>{e.richText=t}},metadata:n},s,o),b(this,null,t,{kind:"accessor",name:"showIcon",static:!1,private:!1,access:{has:e=>"showIcon"in e,get:e=>e.showIcon,set:(e,t)=>{e.showIcon=t}},metadata:n},r,a),n&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=x}renderIcon(){if(!this.showIcon)return;let e=this.view.header$.value.iconColumn;if(!e)return;let t=this.view.cellGetValue(this.cell.rowId,e);if(t)return(0,f.qy)`
${t}
`}get attributeRenderer(){return this.inlineManager?.getRenderer()}get attributesSchema(){return this.inlineManager?.getSchema()}get inlineEditor(){(0,h.Z1)(this.richText);let e=this.richText.inlineEditor;return(0,h.Z1)(e),e}get inlineManager(){return this.service?.inlineManager}get service(){return this.view.getContext(v.x)?.std.spec.getService("affine:database")}get titleColumn(){let e=this.view.header$.value.titleColumn;return(0,h.Z1)(e),this.view.columnGet(e)}get topContenteditableElement(){let e=this.closest("affine-database");return e?.topContenteditableElement}#eH=w(this,s,void 0);get richText(){return this.#eH}set richText(e){this.#eH=e}#eA=(w(this,o),w(this,r,!1));get showIcon(){return this.#eA}set showIcon(e){this.#eA=e}constructor(){super(...arguments),w(this,a)}}})(),C=(()=>{let e,t,i=[(0,p.EM)("data-view-header-area-text")],s=[],o=_;return class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;b(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),w(t,s)}render(){return(0,f.qy)`${this.renderIcon()} `}},t})(),k=(()=>{let e,t,i=[(0,p.EM)("data-view-header-area-text-editing")],s=[],o=_;return class extends o{static{t=this}constructor(){super(...arguments),this._onCopy=e=>{let t=this.inlineEditor;(0,h.Z1)(t);let i=t.getInlineRange();if(!i)return;let s=t.yTextString.slice(i.index,i.index+i.length);e.clipboardData?.setData("text/plain",s),e.preventDefault(),e.stopPropagation()},this._onCut=e=>{let t=this.inlineEditor;(0,h.Z1)(t);let i=t.getInlineRange();if(!i)return;let s=t.yTextString.slice(i.index,i.index+i.length);t.deleteText(i),t.setInlineRange({index:i.index,length:0}),e.clipboardData?.setData("text/plain",s),e.preventDefault(),e.stopPropagation()},this._onPaste=async e=>{let t=this.inlineEditor;(0,h.Z1)(t);let i=t.getInlineRange();if(!i)return;let s=e.clipboardData?.getData("text/plain")?.replace(/\r?\n|\r/g,"\n");if(s){if(e.preventDefault(),e.stopPropagation(),(0,m.AY)(s)){let e=this.std,o=await e?.spec.getService("affine:page").quickSearchService?.searchDoc({userInput:s,skipSelection:!0});o&&"docId"in o?(t.insertText(i," ",{reference:{type:"LinkedPage",pageId:o.docId}}),t.setInlineRange({index:i.index+1,length:0})):(t.insertText(i,s,{link:s}),t.setInlineRange({index:i.index+s.length,length:0}))}else t.insertText(i,s),t.setInlineRange({index:i.index+s.length,length:0})}}}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;b(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),w(t,s)}get std(){let e=this.view.getContext(v.x);return e?.std}connectedCallback(){super.connectedCallback();let e=e=>{"a"===e.key&&(d.vL?e.metaKey:e.ctrlKey)&&(e.stopPropagation(),e.preventDefault(),this.inlineEditor.selectAll())};this.addEventListener("keydown",e),this.disposables.add(()=>{this.removeEventListener("keydown",e)})}firstUpdated(e){super.firstUpdated(e),this.disposables.addFromEvent(this.richText,"copy",this._onCopy),this.disposables.addFromEvent(this.richText,"cut",this._onCut),this.disposables.addFromEvent(this.richText,"paste",e=>{this._onPaste(e).catch(console.error)}),this.richText.updateComplete.then(()=>{this.inlineEditor.focusEnd(),this.disposables.add(this.inlineEditor.slots.inlineRangeUpdate.on(([e])=>{e?this.isEditing||this.selectCurrentCell(!0):this.isEditing&&this.selectCurrentCell(!1)}))}).catch(console.error)}render(){return(0,f.qy)`${this.renderIcon()} this.topContenteditableElement?.host?(0,g.dV)(this.topContenteditableElement.host):null} class="data-view-header-area-rich-text can-link-doc" >`}},t})(),S=c.I.renderConfig({icon:(0,n.w)("TitleIcon"),cellRenderer:{view:(0,a.T)((0,r.d)(C),e=>({...e,showIcon:e.cell.view instanceof l.u})),edit:(0,a.T)((0,r.d)(k),e=>({...e,showIcon:e.cell.view instanceof l.u}))}}),M=[s.Xx.dateColumnConfig,s.Xx.numberColumnConfig,s.Xx.progressColumnConfig,s.Xx.selectColumnConfig,s.Xx.multiSelectColumnConfig,s.Xx.linkColumnConfig,s.Xx.checkboxColumnConfig,o.YV],E=Object.fromEntries([...M,s.Xx.imageColumnConfig,S].map(e=>[e.type,e]))},42766:(e,t,i)=>{i.d(t,{YV:()=>M});var s=i(63820),o=i(71006),r=i(73711),a=i(91449),n=i(4564),l=i(71323),c=i(3874),d=i(72938),h=i(1634),u=i(43503),p=i(70008),f=i(65967),g=i(82750),m=i(51704),v=i(99023),y=i(7548);let b=e=>e instanceof r.EY?e.yText:e,w=(0,m.D)("rich-text").modelConfig({name:"Text",type:()=>v.Gt.create(),defaultData:()=>({}),cellToString:e=>e?.toString()??"",cellFromString:e=>({value:new r.EY(e)}),cellToJson:e=>e?.toString()??null,onUpdate:(e,t,i)=>{let s=b(e);return s.observe(i),i(),{dispose:()=>{s.unobserve(i)}}},isEmpty:e=>null==e||0===e.length});w.addConvert("select",(e,t)=>{let i={},s=e=>{if(i[e])return i[e];let t={id:(0,r.Ak)(),value:e,color:(0,y.y)()};return i[e]=t,t};return{cells:t.map(e=>{let t=e?.toString().split(","),i=t?.[0]?.trim();if(i)return s(i).id}),column:{options:Object.values(i)}}}),w.addConvert("multi-select",(e,t)=>{let i={},s=e=>{if(i[e])return i[e];let t={id:(0,r.Ak)(),value:e,color:(0,y.y)()};return i[e]=t,t};return{cells:t.map(e=>{let t=[],i=e?.toString().split(",");return i?.forEach(e=>{(e=e.trim())&&t.push(s(e).id)}),t}),column:{options:Object.values(i)}}}),w.addConvert("number",(e,t)=>({column:{decimal:0,format:"number"},cells:t.map(e=>{let t=e?parseFloat(e.toString()):NaN;return isNaN(t)?void 0:t})})),w.addConvert("progress",(e,t)=>({column:{},cells:t.map(e=>{let t=e?parseInt(e.toString()):NaN;return isNaN(t)?void 0:(0,g.qE)(t,0,100)})})),w.addConvert("checkbox",(e,t)=>{let i=["yes","true"];return{column:{},cells:t.map(e=>!!(e&&i.includes(e.toString().toLowerCase()))||void 0)}});var x=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},_=function(e,t,i){for(var s=arguments.length>2,o=0;o"boolean"==typeof t&&t===r[e]?[e,!t]:[e,t]));e.formatText(i,a,{mode:"merge"}),s.blur(),e.syncInlineRange()}let k=(()=>{let e,t,i=[(0,n.EM)("affine-database-rich-text-cell")],s=[],d=u.v,p=[],f=[];return class extends d{static{t=this}static{let o="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;x(this,null,[(0,n.P)("rich-text")],{kind:"accessor",name:"_richTextElement",static:!1,private:!1,access:{has:e=>"_richTextElement"in e,get:e=>e._richTextElement,set:(e,t)=>{e._richTextElement=t}},metadata:o},p,f),x(null,e={value:t},i,{kind:"class",name:t.name,metadata:o},null,s),t=e.value,o&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static{this.styles=(0,a.AH)` affine-database-rich-text-cell { display: flex; align-items: center; width: 100%; user-select: none; } .affine-database-rich-text { display: flex; flex-direction: column; justify-content: center; width: 100%; height: 100%; outline: none; font-size: var(--data-view-cell-text-size); line-height: var(--data-view-cell-text-line-height); word-break: break-all; } .affine-database-rich-text v-line { display: flex !important; align-items: center; height: 100%; width: 100%; } .affine-database-rich-text v-line > div { flex-grow: 1; } `}render(){return this.service?this.value&&this.value instanceof r.EY?(0,l.D)(this.value,(0,c.qy)``):(0,c.qy)`
`:a.s6}get attributeRenderer(){return this.inlineManager?.getRenderer()}get attributesSchema(){return this.inlineManager?.getSchema()}get inlineEditor(){(0,o.Z1)(this._richTextElement);let e=this._richTextElement.inlineEditor;return(0,o.Z1)(e),e}get inlineManager(){return this.service?.inlineManager}get service(){return this.view.getContext(h.x)?.std.spec.getService("affine:database")}get topContenteditableElement(){let e=this.closest("affine-database");return e?.topContenteditableElement}#eL=_(this,p,null);get _richTextElement(){return this.#eL}set _richTextElement(e){this.#eL=e}constructor(){super(...arguments),_(this,f)}static{_(t,s)}},t})(),S=(()=>{let e,t,i=[(0,n.EM)("affine-database-rich-text-cell-editing")],l=[],p=u.v,f=[],g=[];return class extends p{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;x(this,null,[(0,n.P)("rich-text")],{kind:"accessor",name:"_richTextElement",static:!1,private:!1,access:{has:e=>"_richTextElement"in e,get:e=>e._richTextElement,set:(e,t)=>{e._richTextElement=t}},metadata:s},f,g),x(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,a.AH)` affine-database-rich-text-cell-editing { display: flex; align-items: center; width: 100%; min-width: 1px; cursor: text; } .affine-database-rich-text { display: flex; flex-direction: column; justify-content: center; width: 100%; height: 100%; outline: none; } .affine-database-rich-text v-line { display: flex !important; align-items: center; height: 100%; width: 100%; } .affine-database-rich-text v-line > div { flex-grow: 1; } `}connectedCallback(){super.connectedCallback(),this.value&&"string"!=typeof this.value||this._initYText(this.value);let e=e=>{"a"===e.key&&(s.vL?e.metaKey:e.ctrlKey)&&(e.stopPropagation(),e.preventDefault(),this.inlineEditor.selectAll())};this.addEventListener("keydown",e),this.disposables.addFromEvent(this,"keydown",e)}firstUpdated(){this._richTextElement?.updateComplete.then(()=>{this.disposables.add(this.inlineEditor.slots.keydown.on(this._handleKeyDown)),this.inlineEditor.focusEnd()}).catch(console.error)}render(){return this.service?(0,c.qy)`this.topContenteditableElement?.host?(0,d.dV)(this.topContenteditableElement.host):null} class="affine-database-rich-text inline-editor" >`:a.s6}get attributeRenderer(){return this.inlineManager?.getRenderer()}get attributesSchema(){return this.inlineManager?.getSchema()}get inlineEditor(){(0,o.Z1)(this._richTextElement);let e=this._richTextElement.inlineEditor;return(0,o.Z1)(e),e}get inlineManager(){return this.service?.inlineManager}get service(){return this.view.getContext(h.x)?.std.spec.getService("affine:database")}get topContenteditableElement(){let e=this.closest("affine-database");return e?.topContenteditableElement}#eL;get _richTextElement(){return this.#eL}set _richTextElement(e){this.#eL=e}constructor(){super(...arguments),this._handleKeyDown=e=>{if("Escape"!==e.key){if("Tab"===e.key){e.preventDefault();return}e.stopPropagation()}if("Enter"===e.key&&!e.isComposing){e.shiftKey?this._onSoftEnter():this.selectCurrentCell(!1),e.preventDefault();return}let t=this.inlineEditor;switch(e.key){case"B":case"b":(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C(this.inlineEditor,{bold:!0}));break;case"I":case"i":(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C(this.inlineEditor,{italic:!0}));break;case"U":case"u":(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C(this.inlineEditor,{underline:!0}));break;case"S":case"s":(e.metaKey||e.ctrlKey)&&e.shiftKey&&(e.preventDefault(),C(t,{strike:!0}));break;case"E":case"e":(e.metaKey||e.ctrlKey)&&e.shiftKey&&(e.preventDefault(),C(t,{code:!0}))}},this._initYText=e=>{let t=new r.EY(e);this.onChange(t)},this._onSoftEnter=()=>{if(this.value&&this.inlineEditor){let e=this.inlineEditor.getInlineRange();(0,o.Z1)(e),new r.EY(this.inlineEditor.yText).replace(e.index,e.length,"\n"),this.inlineEditor.setInlineRange({index:e.index+1,length:0})}},this.#eL=_(this,f,null),_(this,g)}static{_(t,l)}},t})(),M=w.renderConfig({icon:(0,f.w)("TextIcon"),cellRenderer:{view:(0,p.d)(k),edit:(0,p.d)(S)}})},75973:(e,t,i)=>{i.d(t,{I:()=>r});var s=i(51704),o=i(99023);let r=(0,s.D)("title").modelConfig({name:"Title",type:()=>o.Gt.create(),defaultData:()=>({}),cellToString:e=>e?.toString()??"",cellFromString:e=>({value:e}),cellToJson:e=>e?.toString()??null,onUpdate:(e,t,i)=>(e.yText.observe(i),i(),{dispose:()=>{e.yText.unobserve(i)}}),valueUpdate:(e,t,i)=>"string"==typeof i?(e.replace(0,e.length,i),e):null==i?(e.replace(0,e.length,""),e):i,isEmpty:e=>null==e||0===e.length})},1634:(e,t,i)=>{i.d(t,{x:()=>s});let s=Symbol("editor-host")},43503:(e,t,i)=>{i.d(t,{v:()=>l});var s=i(7595),o=i(31980),r=i(4564),a=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},n=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,l=(0,o.Jb)((0,s.Tm)(s.ao)),c=[],d=[],h=[],u=[],p=[],f=[];return class extends l{static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;e=[(0,r.MZ)({attribute:!1})],t=[(0,r.MZ)({attribute:!1})],i=[(0,r.MZ)({attribute:!1})],a(this,null,e,{kind:"accessor",name:"cell",static:!1,private:!1,access:{has:e=>"cell"in e,get:e=>e.cell,set:(e,t)=>{e.cell=t}},metadata:s},c,d),a(this,null,t,{kind:"accessor",name:"isEditing",static:!1,private:!1,access:{has:e=>"isEditing"in e,get:e=>e.isEditing,set:(e,t)=>{e.isEditing=t}},metadata:s},h,u),a(this,null,i,{kind:"accessor",name:"selectCurrentCell",static:!1,private:!1,access:{has:e=>"selectCurrentCell"in e,get:e=>e.selectCurrentCell,set:(e,t)=>{e.selectCurrentCell=t}},metadata:s},p,f),s&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}beforeEnterEditMode(){return!0}blurCell(){return!0}connectedCallback(){super.connectedCallback(),this.style.width="100%",this._disposables.addFromEvent(this,"click",e=>{this.isEditing&&e.stopPropagation()}),this._disposables.addFromEvent(this,"copy",e=>{this.isEditing&&(e.stopPropagation(),this.onCopy(e))}),this._disposables.addFromEvent(this,"cut",e=>{this.isEditing&&(e.stopPropagation(),this.onCut(e))}),this._disposables.addFromEvent(this,"paste",e=>{this.isEditing&&(e.stopPropagation(),this.onPaste(e))})}focusCell(){return!0}forceUpdate(){this.requestUpdate()}onChange(e){this.cell.setValue(e)}onCopy(e){}onCut(e){}onEnterEditMode(){}onExitEditMode(){}onPaste(e){}get column(){return this.cell.column}get readonly(){return this.readonly$.value}get row(){return this.cell.row}get value(){return this.value$.value}get view(){return this.cell.view}#eD;get cell(){return this.#eD}set cell(e){this.#eD=e}#eZ;get isEditing(){return this.#eZ}set isEditing(e){this.#eZ=e}#ej;get selectCurrentCell(){return this.#ej}set selectCurrentCell(e){this.#ej=e}constructor(){super(...arguments),this.readonly$=(0,o.EW)(()=>this.cell.column.readonly$.value),this.value$=(0,o.EW)(()=>this.cell.value$.value),this.#eD=n(this,c,void 0),this.#eZ=(n(this,d),n(this,h,void 0)),this.#ej=(n(this,u),n(this,p,void 0)),n(this,f)}}})()},51704:(e,t,i)=>{i.d(t,{D:()=>r});var s=i(70008);class o{constructor(e,t){this.type=e,this.ops=t,this.convertMap=new Map,this.create=(e,t)=>({type:this.type,name:e,statCalcOp:"none",data:t??this.ops.defaultData()}),this.registerConvert=(e,t)=>{this.convertMap.set(e,t)}}convertCell(e,t,i){return this.convertMap.get(e)?.(t,i)}createWithId(e,t,i){return{id:e,type:this.type,name:t,data:i??this.ops.defaultData()}}dataType(e){return this.ops.type(e)}defaultData(){return this.ops.defaultData()}formatValue(e,t){return void 0===e?void 0:this.ops.formatValue?.(e,t)??e}fromString(e,t){return this.ops.cellFromString(e,t)}toJson(e,t){return this.ops.cellToJson(e,t)}toString(e,t){return this.ops.cellToString(e,t)}get name(){return this.ops.name}}let r=e=>({type:e,modelConfig:t=>{let i=new o(e,t);return{type:e,model:i,create:i.create,addConvert:i.registerConvert,renderConfig:t=>({type:e,model:i,renderer:(0,s.Y)({...t,type:e})})}}})},61575:(e,t,i)=>{i.d(t,{v:()=>s.v});var s=i(43503);i(51704)},59634:(e,t,i)=>{i.d(t,{r:()=>n});var s=i(73711),o=i(99023),r=i(50307),a=i(7548);let n=(0,i(51704).D)("multi-select").modelConfig({name:"Multi-select",type:e=>(0,r.cX)(o.l0.create({tags:e.options})),defaultData:()=>({options:[]}),addGroup:(e,t)=>({options:[...t.options,{id:(0,s.Ak)(),value:e,color:(0,a.y)()}]}),formatValue:e=>Array.isArray(e)?e.filter(e=>null!=e):[],cellToString:(e,t)=>e?.map(e=>t.options.find(t=>t.id===e)?.value).join(","),cellFromString:(e,t)=>{let i=Object.fromEntries(t.options.map(e=>[e.value,e])),o=e.split(",").map(e=>e.trim()).filter(e=>e),r=[];return o.forEach(e=>{if(i[e])r.push(i[e].id);else{let i={id:(0,s.Ak)(),value:e,color:(0,a.y)()};t.options.push(i),r.push(i.id)}}),{value:r,data:t}},cellToJson:e=>e??null,isEmpty:e=>null==e||0===e.length});n.addConvert("select",(e,t)=>({column:e,cells:t.map(e=>e?.[0])})),n.addConvert("rich-text",(e,t)=>{let i=Object.fromEntries(e.options.map(e=>[e.id,e]));return{column:{},cells:t.map(e=>new s.EY(e?.map(e=>i[e]?.value??"").join(",")).yText)}})},6125:(e,t,i)=>{i.d(t,{H:()=>a});var s=i(73711),o=i(82750),r=i(99023);let a=(0,i(51704).D)("number").modelConfig({name:"Number",type:()=>r.Qc.create(),defaultData:()=>({decimal:0,format:"number"}),cellToString:e=>e?.toString()??"",cellFromString:e=>{let t=e?Number(e):NaN;return{value:isNaN(t)?null:t}},cellToJson:e=>e??null,isEmpty:e=>null==e});a.addConvert("rich-text",(e,t)=>({column:{},cells:t.map(e=>new s.EY(e?.toString()).yText)})),a.addConvert("progress",(e,t)=>({column:{},cells:t.map(e=>(0,o.qE)(e??0,0,100))}))},78946:(e,t,i)=>{i.d(t,{C:()=>a});var s=i(73711),o=i(99023),r=i(7548);let a=(0,i(51704).D)("select").modelConfig({name:"Select",type:e=>o.l0.create({tags:e.options}),defaultData:()=>({options:[]}),addGroup:(e,t)=>({options:[...t.options,{id:(0,s.Ak)(),value:e,color:(0,r.y)()}]}),cellToString:(e,t)=>t.options.find(t=>t.id===e)?.value??"",cellFromString:(e,t)=>{if(!e)return{value:null,data:t};let i=Object.fromEntries(t.options.map(e=>[e.value,e])),o=e.split(",").map(e=>e.trim()).filter(e=>e)[0],a=null,n=i[o];if(n)a=n.id;else{let e={id:(0,s.Ak)(),value:o,color:(0,r.y)()};t.options.push(e),a=e.id}return{value:a,data:t}},cellToJson:e=>e??null,isEmpty:e=>null==e});a.addConvert("multi-select",(e,t)=>({column:e,cells:t.map(e=>e?[e]:void 0)})),a.addConvert("rich-text",(e,t)=>{let i=Object.fromEntries(e.options.map(e=>[e.id,e]));return{column:{},cells:t.map(e=>new s.EY(e?i[e]?.value:"").yText)}})},54399:(e,t,i)=>{i.d(t,{p:()=>o});var s=i(99023);let o=(0,i(51704).D)("text").modelConfig({name:"Plain-Text",type:()=>s.si.create(),defaultData:()=>({}),cellToString:e=>e??"",cellFromString:e=>({value:e}),cellToJson:e=>e??null,isEmpty:e=>null==e||0===e.length})},70008:(e,t,i)=>{i.d(t,{Y:()=>r,d:()=>o});var s=i(25721);let o=e=>(0,s.Z4)(e),r=e=>e},29072:(e,t,i)=>{i.d(t,{BZ:()=>c,Jz:()=>h,RL:()=>d,hh:()=>u,us:()=>n});var s=i(68419),o=i(73134),r=i(52676),a=i(42764);let n=(e,t)=>"ref"===t.type?e.find(e=>e.id===t.name)?.type:r.E.find(e=>e.data.name===t.propertyFuncName)?.type.rt,l=(e,t)=>{let i=n(e,t);if(!i)throw new s.Ss(o.O.DatabaseBlockError,"can't resolve ref type");return a.p.match(i)?.name},c=(e,t)=>({type:"filter",left:t,function:l(e,t),args:[]}),d=e=>{let t={type:"ref",name:e[0].id},i=l(e,t);if(!i)throw new s.Ss(o.O.DatabaseBlockError,"can't match any filter");return{type:"filter",left:t,function:i,args:[]}},h=e=>({type:"group",op:"and",conditions:[d(e)]}),u={type:"group",op:"and",conditions:[]}},1200:(e,t,i)=>{i.d(t,{F:()=>s,S:()=>o});let s=()=>` --data-view-cell-text-size:14px; --data-view-cell-text-line-height:22px; `,o=e=>` ${e}{ ${s()} } .with-data-view-css-variable{ ${s()} font-family: var(--affine-font-family) } .dv-pd-2{ padding:2px; } .dv-pd-4{ padding:4px; } .dv-pd-8{ padding:8px; } .dv-hover:hover{ background-color: var(--affine-hover-color); cursor: pointer; } .dv-icon-16 svg{ width: 16px; height: 16px; color: var(--affine-icon-color); fill: var(--affine-icon-color); } .dv-icon-20 svg{ width: 20px; height: 20px; color: var(--affine-icon-color); fill: var(--affine-icon-color); } .dv-border{ border: 1px solid var(--affine-border-color); } .dv-round-4{ border-radius: 4px; } .dv-round-8{ border-radius: 8px; } .dv-color-2{ color: var(--affine-text-secondary-color); } .dv-shadow-2{ box-shadow: var(--affine-shadow-2) } .dv-divider-h{ height: 1px; background-color: var(--affine-divider-color); margin: 8px 0; } `},16921:(e,t,i)=>{i.d(t,{A:()=>o});var s=i(12552);let o=(e,t,i)=>{let o=s.H.match(e.model.dataType(i))?.name;return null!=o?{type:"groupBy",columnId:t,name:o}:void 0}},90044:(e,t,i)=>{i.d(t,{R:()=>a,e:()=>r});var s=i(73297),o=i(12552);class r{constructor(e,t,i,s,o){this.groupBy=e,this.viewManager=s,this.ops=o,this.updateData=e=>{this.viewManager.columnUpdateData(this.columnId,e)},this.groupMap=Object.fromEntries(t.defaultKeys(i).map(({key:e,value:s})=>[e,{key:e,name:t.groupName(i,s),helper:this,type:i,value:s,rows:[]}])),this.viewManager.rows$.value.forEach(s=>{let o=this.viewManager.cellGetJsonValue(s,e.columnId);t.valuesGroup(o,i).forEach(({key:e,value:o})=>{this.groupMap[e]||(this.groupMap[e]={key:e,name:t.groupName(i,o),helper:this,value:o,rows:[],type:i}),this.groupMap[e].rows.push(s)})});let r=o.sortGroup(Object.keys(this.groupMap));r.forEach(e=>{this.groupMap[e].rows=o.sortRow(e,this.groupMap[e].rows)}),this.groups=r.map(e=>this.groupMap[e])}addToGroup(e,t){let i=this.columnId,s=(this.groupConfig()?.addToGroup??(e=>e))(this.groupMap[t].value,this.viewManager.cellGetJsonValue(e,i));this.viewManager.cellUpdateValue(e,i,s)}changeCardSort(e,t){this.ops.changeRowSort(this.groups.map(e=>e.key),e,t)}changeGroupSort(e){this.ops.changeGroupSort(e)}defaultGroupProperty(e){return{key:e,hide:!1,manuallyCardSort:[]}}groupConfig(){return o.H.findData(e=>e.name===this.groupBy.name)}moveCardTo(e,t,i,o){if(t!==i){let s;let o=this.columnId,r=this.groupConfig()?.removeFromGroup??(()=>void 0),a=null!=t?this.groupMap[t]:void 0;a&&(s=r(a.value,this.viewManager.cellGetJsonValue(e,o))),s=(this.groupConfig()?.addToGroup??(e=>e))(this.groupMap[i].value,s),this.viewManager.cellUpdateValue(e,o,s)}let r=this.groupMap[i].rows.filter(t=>t!==e),a=(0,s.q)(o,r,e=>e);r.splice(a,0,e),this.changeCardSort(i,r)}moveGroupTo(e,t){let i=this.groups.map(e=>e.key);i.splice(i.findIndex(t=>t===e),1);let o=(0,s.q)(t,i,e=>e);i.splice(o,0,e),this.changeGroupSort(i)}removeFromGroup(e,t){let i=this.columnId,s=(this.groupConfig()?.removeFromGroup??(()=>void 0))(this.groupMap[t].value,this.viewManager.cellGetJsonValue(e,i));this.viewManager.cellUpdateValue(e,i,s)}updateValue(e,t){e.forEach(e=>{this.viewManager.cellUpdateValue(e,this.columnId,t)})}get addGroup(){return this.viewManager.columnGetMeta(this.column.type)?.model.ops.addGroup}get column(){return this.viewManager.columnGet(this.groupBy.columnId)}get columnId(){return this.groupBy.columnId}get data(){return this.viewManager.columnGetData(this.columnId)}get dataType(){return this.viewManager.columnGetDataType(this.groupBy.columnId)}get type(){return this.viewManager.columnGetType(this.columnId)}}let a=(e,t,i)=>{let s=new Map(e.map(e=>[t(e),e])),o=[];for(let e of i){let t=s.get(e);t&&(s.delete(e),o.push(t))}return o.push(...s.values()),o}},12552:(e,t,i)=>{i.d(t,{H:()=>s});let s=new(i(39514)).P},1497:(e,t,i)=>{i.r(t),i.d(t,{ArrowLeftBigIcon:()=>C,CenterPeekIcon:()=>j,CheckBoxIcon:()=>S,ConvertIcon:()=>O,CrossIcon:()=>b,DatabaseAddColumn:()=>g,DatabaseDragIcon:()=>m,DatabaseDuplicate:()=>r,DatabaseExpand:()=>v,DatabaseInsertLeft:()=>a,DatabaseInsertRight:()=>n,DatabaseKanbanViewIcon:()=>$,DatabaseMoveLeft:()=>l,DatabaseMoveRight:()=>c,DatabaseMultiSelect:()=>d,DatabaseNumber:()=>h,DatabaseProgress:()=>p,DatabaseSearchClose:()=>f,DatabaseSearchIcon:()=>o,DatabaseSelect:()=>u,DatabaseTableViewClose:()=>y,DatabaseTableViewIcon:()=>T,DateTime:()=>M,DecreaseDecimalPlacesIcon:()=>Z,DeleteIcon:()=>x,DoneIcon:()=>L,FilterIcon:()=>P,GroupingIcon:()=>H,ImageIcon:()=>E,IncreaseDecimalPlacesIcon:()=>D,InfoIcon:()=>A,LinkIcon:()=>B,MoreHorizontalIcon:()=>_,PlusIcon:()=>w,TextIcon:()=>k,TitleIcon:()=>I});var s=i(91449);let o=(0,s.qy)` `,r=(0,s.qy)` `,a=(0,s.qy)` `,n=(0,s.qy)` `,l=(0,s.qy)` `,c=(0,s.qy)` `,d=(0,s.qy)` `,h=(0,s.qy)` `,u=(0,s.qy)` `,p=(0,s.qy)` `,f=(0,s.qy)` `,g=(0,s.qy)` `,m=(0,s.qy)` `,v=(0,s.qy)` `,y=(0,s.qy)` `,b=(0,s.qy)` `,w=(0,s.qy)` `,x=(0,s.qy)` `,_=(0,s.qy)` `,C=(0,s.qy)` `,k=(0,s.qy)` `,S=(0,s.qy)` `,M=(0,s.qy)` `,E=(0,s.qy)` `,I=(0,s.qy)` `,B=(0,s.qy)` `,$=(0,s.qy)` `,T=(0,s.qy)` `,O=(0,s.qy)` `,P=(0,s.qy)` `,H=(0,s.qy)` `,A=(0,s.qy)` `,L=(0,s.qy)` `,D=(0,s.qy)` `,Z=(0,s.qy)` `,j=(0,s.qy)` `},55134:(e,t,i)=>{i.d(t,{G:()=>d});var s=i(7595),o=i(67448);let r=o.z.union([o.z.object({viewId:o.z.string(),type:o.z.literal("table"),selectionType:o.z.literal("area"),rowsSelection:o.z.object({start:o.z.number(),end:o.z.number()}),columnsSelection:o.z.object({start:o.z.number(),end:o.z.number()}),focus:o.z.object({rowIndex:o.z.number(),columnIndex:o.z.number()}),isEditing:o.z.boolean()}),o.z.object({viewId:o.z.string(),type:o.z.literal("table"),selectionType:o.z.literal("row"),rows:o.z.array(o.z.object({id:o.z.string(),groupKey:o.z.string().optional()}))})]),a=o.z.object({selectionType:o.z.literal("cell"),groupKey:o.z.string(),cardId:o.z.string(),columnId:o.z.string(),isEditing:o.z.boolean()}),n=o.z.object({selectionType:o.z.literal("card"),cards:o.z.array(o.z.object({groupKey:o.z.string(),cardId:o.z.string()}))}),l=o.z.object({selectionType:o.z.literal("group"),groupKeys:o.z.array(o.z.string())}),c=o.z.object({blockId:o.z.string(),viewSelection:o.z.union([r,a,n,l])});class d extends s.qZ{static{this.group="note"}static{this.type="database"}constructor({blockId:e,viewSelection:t}){super({blockId:e}),this.viewSelection=t}static fromJSON(e){return c.parse(e),new d({blockId:e.blockId,viewSelection:e.viewSelection})}equals(e){return e instanceof d&&this.blockId===e.blockId}getSelection(e){return this.viewSelection.type===e?this.viewSelection:void 0}toJSON(){return{type:"database",blockId:this.blockId,viewSelection:this.viewSelection}}get viewId(){return this.viewSelection.viewId}}},35018:(e,t,i)=>{i.d(t,{PL:()=>eG,U$:()=>tD,Gl:()=>eY.G,Xx:()=>eW,Z4:()=>e5.Z4,F5:()=>e5.F5,qf:()=>tZ.q,ep:()=>e5.ep,q_:()=>sL,tB:()=>rs}),i(61575);var s=i(91449),o=i(4564),r=i(80796),a=i(65967),n=i(43503),l=i(70008),c=i(73711),d=i(99023),h=i(51704);let u=(0,h.D)("checkbox").modelConfig({name:"Checkbox",type:()=>d.dG.create(),defaultData:()=>({}),cellToString:e=>e?"True":"False",cellFromString:e=>({value:"False"!==e}),cellToJson:e=>e??null,isEmpty:()=>!1});u.addConvert("rich-text",(e,t)=>({column:{},cells:t.map(e=>new c.EY(e?"Yes":"No").yText)}));var p=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},f=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-checkbox-cell")],a=[],l=n.v,c=[],d=[];return class extends l{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;p(this,null,[(0,o.P)(".affine-database-checkbox")],{kind:"accessor",name:"_checkbox",static:!1,private:!1,access:{has:e=>"_checkbox"in e,get:e=>e._checkbox,set:(e,t)=>{e._checkbox=t}},metadata:s},c,d),p(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,a),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-database-checkbox-cell { display: block; width: 100%; cursor: pointer; } .affine-database-checkbox-container { height: 100%; } .affine-database-checkbox { display: flex; align-items: center; height: var(--data-view-cell-text-line-height); width: 100%; position: relative; } .affine-database-checkbox svg { width: 16px; height: 16px; } `}beforeEnterEditMode(){let e=!this.value;return this.onChange(e),e&&(0,r.RY)(this._checkbox,{left:-2}).catch(console.error),!1}onCopy(e){e.preventDefault()}onCut(e){e.preventDefault()}onPaste(e){e.preventDefault()}render(){let e=this.value??!1,t=e?(0,r.xY)():(0,r.wb)();return(0,s.qy)`
${t}
`}#eV=f(this,c,void 0);get _checkbox(){return this.#eV}set _checkbox(e){this.#eV=e}constructor(){super(...arguments),f(this,d)}static{f(t,a)}},t})(),m=u.renderConfig({icon:(0,a.w)("CheckBoxIcon"),cellRenderer:{view:(0,l.d)(g)}});var v=i(41507),y=i(99971),b=i(18342),w=i(7595),x=i(70131),_=i(59878),C=i(26299),k=i(83951),S=i(54719);let M=(0,s.JW)` `,E=(0,s.AH)` :host { display: block; } .date-picker { background: var(--affine-background-overlay-panel-color); border-radius: 12px; box-sizing: border-box; box-shadow: var(--affine-menu-shadow); display: flex; flex-direction: column; gap: var(--gap-v); font-family: var(--affine-font-family); } /* small action */ .date-picker-small-action { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 4px; } .interactive.date-picker-small-action, .interactive.action-label.today { color: var(--affine-icon-color); } .date-picker-small-action:hover { color: var(--affine-icon-hover-color); background: var(--affine-icon-hover-background); } .date-picker-small-action.left > svg { transform: rotate(0deg); } .date-picker-small-action.right > svg { transform: rotate(180deg); } .date-picker-small-action.down > svg { transform: rotate(-90deg); } /* action-header */ .date-picker-header { display: flex; align-items: center; justify-content: space-between; } .date-picker-header__buttons { display: flex; } .date-picker-header__date { display: flex; align-items: center; gap: 4px; color: var(--affine-text-primary-color); font-weight: 600; padding: 2px; border-radius: 4px; font-size: 14px; line-height: 22px; } .date-picker-header__date > div { padding: 0px 4px; } .date-picker-header__action { display: flex; align-items: center; gap: 16px; color: var(--affine-icon-color); } .date-picker-header__action.with-slot { gap: 4px; } .date-picker-header__action .action-label { font-size: 12px; padding: 0px 4px; height: 20px; border-radius: 4px; transition: all 0.23s ease; max-width: 100px; } .date-picker-header__action .action-label > span { display: inline-flex; justify-content: center; align-items: center; width: 100%; text-align: center; white-space: nowrap; overflow: hidden; } /** days header */ .days-header { display: flex; gap: var(--gap-h); } .days-header > div { color: var(--affine-text-secondary-color); font-weight: 500; font-size: 12px; cursor: default; } /** week */ .date-picker-weeks { display: flex; flex-direction: column; gap: var(--gap-v); } .date-picker-week { display: flex; gap: var(--gap-h); } /** cell */ .date-cell { width: var(--cell-size); height: var(--cell-size); display: flex; align-items: center; justify-content: center; user-select: none; border-radius: 8px; } .date-cell[data-date] { font-weight: 400; font-size: 14px; } .date-cell.date-cell--not-curr-month { opacity: 0.1; } .date-cell.date-cell--today { color: var(--affine-primary-color); font-weight: 600; } .date-cell.date-cell--selected { background: var(--affine-primary-color); color: var(--affine-pure-white); font-weight: 500; } /** interactive */ .interactive { cursor: pointer; /* transition: background 0.23s ease, color 0.23s ease; */ user-select: none; position: relative; border: none; background-color: unset; font-family: var(--affine-font-family); color: var(--affine-text-primary-color); } /* --hover */ .interactive::after, .interactive::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; transition: background 0.23s ease; } .interactive::after { opacity: 1; background: transparent; } .interactive:hover::after { background: var(--affine-hover-color); } /* --focus */ .interactive::before { opacity: 0; transition: none; box-shadow: 0 0 0 3px var(--affine-primary-color); } /* .interactive:active, */ .interactive:focus-visible { outline: none; outline: 1px solid var(--affine-primary-color); } /* .interactive:active::before, */ .interactive:focus-visible::before { opacity: 0.5; } /** disabled */ .interactive[disabled] { cursor: not-allowed; opacity: 0.5; } /** Month Select */ .date-picker-month { --btn-width: 36px; } .date-picker-year { --btn-width: 46px; } .date-picker-month, .date-picker-year { display: grid; grid-template-columns: repeat(3, var(--btn-width)); gap: 18px 32px; justify-content: space-between; } .date-picker-month button, .date-picker-year button { height: 34px; width: fit-content; padding: 4px; border-radius: 8px; font-size: 15px; display: flex; align-items: center; justify-content: center; width: var(--btn-width); } .date-picker-month button.active, .date-picker-year button.active { color: var(--affine-primary-color); /* background: var(--affine-primary-color); */ font-weight: 600; } .date-picker .date-picker-header { padding: 0px; transition: padding 0.23s ease; } .date-picker--mode-month, .date-picker--mode-year { gap: 26px; } .date-picker--mode-month .date-picker-header, .date-picker--mode-year .date-picker-header { /* padding: 0 10px; */ } `;function I(e){var t;return e instanceof Date?e:("string"==typeof e&&(t=e,/^\d+$/.test(t))&&(e=+e),e?new Date(e):new Date)}function B(e,t,i){let[s,o]=[e,t].sort();return Math.min(Math.max(i,s),o)}var $=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},T=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c,d,h,u,p,f,g,m,v=[(0,o.EM)("date-picker")],y=[],b=(0,w.Tm)(s.WF),H=[],A=[],L=[],D=[],Z=[],j=[],V=[],z=[],R=[],F=[],N=[],q=[],U=[],W=[],G=[],Y=[],K=[],X=[],Q=[],J=[],ee=[],et=[],ei=[],es=[],eo=[],er=[];return class extends b{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(b[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],c=[(0,o.MZ)({attribute:!1})],d=[(0,o.MZ)({type:Number})],h=[(0,o.MZ)({type:Number})],u=[(0,o.MZ)({attribute:!1})],p=[(0,o.MZ)({attribute:!1})],f=[(0,o.MZ)({type:Number})],g=[(0,o.MZ)({type:Number})],m=[(0,o.MZ)({type:Number})],$(this,null,i,{kind:"accessor",name:"_matrix",static:!1,private:!1,access:{has:e=>"_matrix"in e,get:e=>e._matrix,set:(e,t)=>{e._matrix=t}},metadata:s},H,A),$(this,null,r,{kind:"accessor",name:"_mode",static:!1,private:!1,access:{has:e=>"_mode"in e,get:e=>e._mode,set:(e,t)=>{e._mode=t}},metadata:s},L,D),$(this,null,a,{kind:"accessor",name:"_monthCursor",static:!1,private:!1,access:{has:e=>"_monthCursor"in e,get:e=>e._monthCursor,set:(e,t)=>{e._monthCursor=t}},metadata:s},Z,j),$(this,null,n,{kind:"accessor",name:"_monthPickYearCursor",static:!1,private:!1,access:{has:e=>"_monthPickYearCursor"in e,get:e=>e._monthPickYearCursor,set:(e,t)=>{e._monthPickYearCursor=t}},metadata:s},V,z),$(this,null,l,{kind:"accessor",name:"_yearCursor",static:!1,private:!1,access:{has:e=>"_yearCursor"in e,get:e=>e._yearCursor,set:(e,t)=>{e._yearCursor=t}},metadata:s},R,F),$(this,null,c,{kind:"accessor",name:"_yearMatrix",static:!1,private:!1,access:{has:e=>"_yearMatrix"in e,get:e=>e._yearMatrix,set:(e,t)=>{e._yearMatrix=t}},metadata:s},N,q),$(this,null,d,{kind:"accessor",name:"gapH",static:!1,private:!1,access:{has:e=>"gapH"in e,get:e=>e.gapH,set:(e,t)=>{e.gapH=t}},metadata:s},U,W),$(this,null,h,{kind:"accessor",name:"gapV",static:!1,private:!1,access:{has:e=>"gapV"in e,get:e=>e.gapV,set:(e,t)=>{e.gapV=t}},metadata:s},G,Y),$(this,null,u,{kind:"accessor",name:"onChange",static:!1,private:!1,access:{has:e=>"onChange"in e,get:e=>e.onChange,set:(e,t)=>{e.onChange=t}},metadata:s},K,X),$(this,null,p,{kind:"accessor",name:"onEscape",static:!1,private:!1,access:{has:e=>"onEscape"in e,get:e=>e.onEscape,set:(e,t)=>{e.onEscape=t}},metadata:s},Q,J),$(this,null,f,{kind:"accessor",name:"padding",static:!1,private:!1,access:{has:e=>"padding"in e,get:e=>e.padding,set:(e,t)=>{e.padding=t}},metadata:s},ee,et),$(this,null,g,{kind:"accessor",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:s},ei,es),$(this,null,m,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:s},eo,er),$(null,e={value:t},v,{kind:"class",name:t.name,metadata:s},null,y),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=E}get _cardStyle(){return{"--cell-size":`${this.size}px`,"--gap-h":`${this.gapH}px`,"--gap-v":`${this.gapV}px`,"min-width":`${this.cardWidth}px`,"min-height":`${this.cardHeight}px`,padding:`${this.padding}px`}}_cellRenderer(e){let t=(0,k.H)({interactive:!0,"date-cell":!0,"date-cell--today":e.isToday,"date-cell--not-curr-month":e.notCurrentMonth,"date-cell--selected":!!e.selected}),i=`${e.date.getFullYear()}-${e.date.getMonth()}-${e.date.getDate()}(${e.date.getDay()})`;return(0,s.qy)``}_dateContent(){return(0,s.qy)`
${this._navAction(()=>this._moveMonth(-1),()=>this._moveMonth(1),(0,s.qy)``)}
${this._dayHeaderRenderer()}
${this._matrix.map(e=>(0,s.qy)`
${e.map(e=>this._cellRenderer(e))}
`)}
`}_dayHeaderRenderer(){return(0,s.qy)`
${O.map(e=>(0,s.qy)`
${e}
`)}
`}_getMatrix(){this._matrix=(function(e){let t=I(e),i=function(e){let t=I(e);return new Date(t.getFullYear(),t.getMonth(),1)}(t),s=function(e){let t=I(e);return new Date(t.getFullYear(),t.getMonth()+1,0)}(t),o=new Date(i);o.setDate(i.getDate()-i.getDay());let r=new Date(s);r.setDate(s.getDate()+(6-s.getDay()));let a=[],n=[],l=new Date(o);for(;l<=r;)n.push(new Date(l)),7===n.length&&(a.push(n),n=[]),l.setDate(l.getDate()+1);return a})(this._cursor).map(e=>e.map(e=>{let t=(0,x.r)(e,this._cursor)?0:-1;return{date:e,label:e.getDate().toString(),isToday:(0,_.c)(e),notCurrentMonth:!(0,C.t)(e,this._cursor),selected:!!this.value&&(0,x.r)(e,I(this.value)),tabIndex:t}}))}_getYearMatrix(){let e=Math.floor((this._yearCursor-this._minYear)/12),t=this._minYear+12*e;this._yearMatrix=Array.from({length:t+12-t},(e,i)=>t+i).filter(e=>e>=this._minYear&&e<=this._maxYear)}_modeDecade(e){this._yearCursor=B(this._minYear,this._maxYear,this._yearCursor+e),this._getYearMatrix()}_monthContent(){return(0,s.qy)`
${this._navAction({action:()=>this._monthPickYearCursor--,disable:this._monthPickYearCursor<=this._minYear},{action:()=>this._monthPickYearCursor++,disable:this._monthPickYearCursor>=this._maxYear})}
${P.map((e,t)=>{let i=!!this.value&&(0,C.t)(this.value,new Date(this._monthPickYearCursor,t,1)),o=(0,k.H)({"month-cell":!0,interactive:!0,active:i});return(0,s.qy)``})}
`}_moveMonth(e){this._cursor.setMonth(this._cursor.getMonth()+e),this._getMatrix()}_navAction(e,t,i){let o="function"==typeof e?e:e.action,r="function"==typeof t?t:t.action,a="function"!=typeof e&&e.disable,n="function"!=typeof t&&t.disable,l=(0,k.H)({"date-picker-header__action":!0,"with-slot":!!i});return(0,s.qy)`
${i??s.s6}
`}_onChange(e,t=!0){this._cursor=e,this.value=e.getTime(),this._getMatrix(),t&&this.onChange?.(e)}_switchMode(e){return e[this._mode]??s.s6}_yearContent(){let e=this._yearMatrix[0],t=this._yearMatrix[this._yearMatrix.length-1];return(0,s.qy)`
${this._navAction({action:()=>this._modeDecade(-12),disable:e<=this._minYear},{action:()=>this._modeDecade(12),disable:t>=this._maxYear})}
${this._yearMatrix.map(e=>{let t=e===this._cursor.getFullYear(),i=(0,k.H)({"year-cell":!0,interactive:!0,active:t});return(0,s.qy)``})}
`}closeMonthSelector(){this._mode="date"}closeYearSelector(){this._mode="date"}connectedCallback(){super.connectedCallback(),this.value&&(this._cursor=I(this.value)),this._getMatrix()}firstUpdated(){this._disposables.addFromEvent(this,"keydown",e=>{e.stopPropagation();let t=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"];t.includes(e.key)&&this.isDateCellFocused()&&(e.preventDefault(),"ArrowLeft"===e.key?this._cursor.setDate(this._cursor.getDate()-1):"ArrowRight"===e.key?this._cursor.setDate(this._cursor.getDate()+1):"ArrowUp"===e.key?this._cursor.setDate(this._cursor.getDate()-7):"ArrowDown"===e.key&&this._cursor.setDate(this._cursor.getDate()+7),this._getMatrix(),setTimeout(this.focusDateCell.bind(this))),t.includes(e.key)&&this.isMonthCellFocused()&&(e.preventDefault(),"ArrowLeft"===e.key?this._monthCursor=(this._monthCursor-1+12)%12:"ArrowRight"===e.key?this._monthCursor=(this._monthCursor+1)%12:"ArrowUp"===e.key?this._monthCursor=(this._monthCursor-3+12)%12:"ArrowDown"===e.key&&(this._monthCursor=(this._monthCursor+3)%12),setTimeout(this.focusMonthCell.bind(this))),t.includes(e.key)&&this.isYearCellFocused()&&(e.preventDefault(),"ArrowLeft"===e.key?this._modeDecade(-1):"ArrowRight"===e.key?this._modeDecade(1):"ArrowUp"===e.key?this._modeDecade(-3):"ArrowDown"===e.key&&this._modeDecade(3),setTimeout(this.focusYearCell.bind(this))),"Tab"===e.key&&setTimeout(()=>{let t=this.shadowRoot?.activeElement,i=this.shadowRoot?.querySelector("button");e.shiftKey||t||i?.focus(),e.shiftKey&&!this.shadowRoot?.contains(t)&&this.focusDateCell()}),"Escape"===e.key&&this.onEscape?.(I(this.value))},!0)}focusDateCell(){let e=this.shadowRoot?.querySelector('button.date-cell[tabindex="0"]');e?.focus()}focusMonthCell(){let e=this.shadowRoot?.querySelector('button.month-cell[tabindex="0"]');e?.focus()}focusYearCell(){let e=this.shadowRoot?.querySelector('button.year-cell[tabindex="0"]');e?.focus()}isDateCellFocused(){let e=this.shadowRoot?.activeElement;return e?.classList.contains("date-cell")}isMonthCellFocused(){let e=this.shadowRoot?.activeElement;return e?.classList.contains("month-cell")}isYearCellFocused(){let e=this.shadowRoot?.activeElement;return e?.classList.contains("year-cell")}openMonthSelector(){this._monthCursor=this.month,this._monthPickYearCursor=this.year,this._mode="month"}openYearSelector(){this._yearCursor=B(this._minYear,this._maxYear,this.year),this._mode="year",this._getYearMatrix()}render(){let e=(0,k.H)({"date-picker":!0,[`date-picker--mode-${this._mode}`]:!0}),t=(0,S.W)({"min-height":`${this.minHeight}px`});return(0,s.qy)`
${this._switchMode({date:this._dateContent(),month:this._monthContent(),year:this._yearContent()})}
`}toggleMonthSelector(){"month"===this._mode?this.closeMonthSelector():this.openMonthSelector()}toggleYearSelector(){"year"===this._mode?this.closeYearSelector():this.openYearSelector()}updated(e){e.has("value")&&(this.value?this._onChange(I(this.value),!1):this._getMatrix())}get cardHeight(){return 7*this.size+2*this.padding+6*this.gapV-2}get cardWidth(){return 7*this.size+2*this.padding+6*this.gapH}get date(){return this._cursor.getDate()}get day(){return this._cursor.getDay()}get dayLabel(){return O[this.day]}get minHeight(){return 8*this.size+2*this.padding+7*this.gapV-2}get month(){return this._cursor.getMonth()}get monthLabel(){return P[this.month]}get year(){return this._cursor.getFullYear()}get yearLabel(){return this.year}#ez;get _matrix(){return this.#ez}set _matrix(e){this.#ez=e}#eR;get _mode(){return this.#eR}set _mode(e){this.#eR=e}#eF;get _monthCursor(){return this.#eF}set _monthCursor(e){this.#eF=e}#eN;get _monthPickYearCursor(){return this.#eN}set _monthPickYearCursor(e){this.#eN=e}#eq;get _yearCursor(){return this.#eq}set _yearCursor(e){this.#eq=e}#eU;get _yearMatrix(){return this.#eU}set _yearMatrix(e){this.#eU=e}#eW;get gapH(){return this.#eW}set gapH(e){this.#eW=e}#eG;get gapV(){return this.#eG}set gapV(e){this.#eG=e}#eY;get onChange(){return this.#eY}set onChange(e){this.#eY=e}#eK;get onEscape(){return this.#eK}set onEscape(e){this.#eK=e}#eX;get padding(){return this.#eX}set padding(e){this.#eX=e}#eQ;get size(){return this.#eQ}set size(e){this.#eQ=e}#eJ;get value(){return this.#eJ}set value(e){this.#eJ=e}constructor(){super(...arguments),this._cursor=new Date,this._maxYear=2099,this._minYear=1970,this.#ez=T(this,H,[]),this.#eR=(T(this,A),T(this,L,"date")),this.#eF=(T(this,D),T(this,Z,0)),this.#eN=(T(this,j),T(this,V,0)),this.#eq=(T(this,z),T(this,R,0)),this.#eU=(T(this,F),T(this,N,[])),this.#eW=(T(this,q),T(this,U,10)),this.#eG=(T(this,W),T(this,G,8)),this.#eY=(T(this,Y),T(this,K,void 0)),this.#eK=(T(this,X),T(this,Q,void 0)),this.#eX=(T(this,J),T(this,ee,20)),this.#eQ=(T(this,et),T(this,ei,28)),this.#eJ=(T(this,es),T(this,eo,void 0)),T(this,er)}static{T(t,y)}},t})();var A=i(41295);let L=(0,h.D)("date").modelConfig({name:"Date",type:()=>d.vi.create(),defaultData:()=>({}),cellToString:e=>e?.toString()??"",cellFromString:e=>({value:isNaN(Date.parse(e))?null:+new Date(e)}),cellToJson:e=>e??null,isEmpty:e=>null==e});var D=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},Z=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-date-cell")],r=[],a=n.v;return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;D(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-database-date-cell { width: 100%; } .affine-database-date { display: flex; align-items: center; width: 100%; padding: 0; border: none; font-family: ${(0,s.iz)(y.$7.fontSansFamily)}; color: var(--affine-text-primary-color); font-weight: 400; background-color: transparent; font-size: var(--data-view-cell-text-size); line-height: var(--data-view-cell-text-line-height); height: var(--data-view-cell-text-line-height); } input.affine-database-date[type='date']::-webkit-calendar-picker-indicator { display: none; } `}render(){let e=this.value?(0,b.GP)(new Date(this.value),"yyyy/MM/dd"):"";return e?(0,s.qy)`
${e}
`:""}static{Z(t,r)}},t})(),V=(()=>{let e,t,i=[(0,o.EM)("affine-database-date-cell-editing")],r=[],a=n.v,l=[],c=[];return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;D(this,null,[(0,o.wk)()],{kind:"accessor",name:"tempValue",static:!1,private:!1,access:{has:e=>"tempValue"in e,get:e=>e.tempValue,set:(e,t)=>{e.tempValue=t}},metadata:s},l,c),D(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-database-date-cell-editing { width: 100%; cursor: text; } .affine-database-date:focus { outline: none; } `}firstUpdated(){this.openDatePicker()}onExitEditMode(){this.updateValue(),this._prevPortalAbortController?.abort()}render(){return(0,s.qy)`
${this.dateString}
`}get dateString(){let e=this.tempValue??this.value;return e?(0,b.GP)(e,"yyyy/MM/dd"):""}#e1;get tempValue(){return this.#e1}set tempValue(e){this.#e1=e}constructor(){super(...arguments),this._prevPortalAbortController=null,this.openDatePicker=()=>{if(this._prevPortalAbortController&&!this._prevPortalAbortController.signal.aborted)return;this._prevPortalAbortController?.abort();let e=new AbortController;e.signal.addEventListener("abort",()=>{this.selectCurrentCell(!1)},{once:!0}),this._prevPortalAbortController=e,(0,A.cl)({abortController:e,closeOnClickAway:!0,computePosition:{referenceElement:this,placement:"bottom",middleware:[(0,v.cY)(10),(0,v.UU)()]},template:()=>{let t=new H;return t.value=this.value??Date.now(),t.onChange=e=>{this.tempValue=e},t.onEscape=()=>{e.abort()},requestAnimationFrame(()=>t.focusDateCell()),t}}).style.zIndex="1002"},this.updateValue=()=>{let e=this.tempValue;e&&(this.onChange(e.getTime()),this.tempValue=void 0)},this.#e1=Z(this,l,void 0),Z(this,c)}static{Z(t,r)}},t})(),z=L.renderConfig({icon:(0,a.w)("DateTime"),cellRenderer:{view:(0,l.d)(j),edit:(0,l.d)(V)}}),R=(0,h.D)("image").modelConfig({name:"image",type:()=>d.ae.create(),defaultData:()=>({}),cellToString:e=>e??"",cellFromString:e=>({value:e}),cellToJson:e=>e??null,isEmpty:e=>null==e});var F=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},N=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-image-cell")],r=[],a=n.v;return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;F(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-database-image-cell { width: 100%; height: 100%; display: flex; align-items: center; } affine-database-image-cell img { width: 20px; height: 20px; } `}render(){return(0,s.qy)``}static{N(t,r)}},t})(),U=R.renderConfig({icon:(0,a.w)("ImageIcon"),cellRenderer:{view:(0,l.d)(q)}});var W=i(71006),G=i(3874),Y=i(69147),K=i(30955),X=i(1634),Q=i(29734),J=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ee=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-link-node")],r=[],a=w.ao,n=[],l=[];(class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;J(this,null,[(0,o.MZ)({attribute:!1})],{kind:"accessor",name:"link",static:!1,private:!1,access:{has:e=>"link"in e,get:e=>e.link,set:(e,t)=>{e.link=t}},metadata:s},n,l),J(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .link-node { word-break: break-all; color: var(--affine-link-color); fill: var(--affine-link-color); cursor: pointer; font-weight: normal; font-style: normal; text-decoration: none; } `}render(){return(0,K.AY)(this.link)?(0,s.qy)`${this.link}`:(0,s.qy)`${this.link}`}#e0=ee(this,n,void 0);get link(){return this.#e0}set link(e){this.#e0=e}constructor(){super(...arguments),ee(this,l)}static{ee(t,r)}})})();let et=(0,h.D)("link").modelConfig({name:"Link",type:()=>d.si.create(),defaultData:()=>({}),cellToString:e=>e?.toString()??"",cellFromString:e=>({value:e}),cellToJson:e=>e??null,isEmpty:e=>null==e||0==e.length});var ei=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},es=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-link-cell")],r=[],a=n.v,l=[],c=[];return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;ei(this,null,[(0,o.wk)()],{kind:"accessor",name:"docId",static:!1,private:!1,access:{has:e=>"docId"in e,get:e=>e.docId,set:(e,t)=>{e.docId=t}},metadata:s},l,c),ei(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-database-link-cell { width: 100%; user-select: none; } affine-database-link-cell:hover .affine-database-link-icon { visibility: visible; } .affine-database-link { display: flex; position: relative; align-items: center; width: 100%; height: 100%; outline: none; overflow: hidden; font-size: var(--data-view-cell-text-size); line-height: var(--data-view-cell-text-line-height); word-break: break-all; } affine-database-link-node { flex: 1; word-break: break-all; } .affine-database-link-icon { position: absolute; right: 0; display: flex; align-items: center; visibility: hidden; cursor: pointer; background: var(--affine-background-primary-color); border-radius: 4px; } .affine-database-link-icon:hover { background: var(--affine-hover-color); } .affine-database-link-icon svg { width: 16px; height: 16px; fill: var(--affine-icon-color); } .data-view-link-column-linked-doc { text-decoration: underline; text-decoration-color: var(--affine-divider-color); transition: text-decoration-color 0.2s ease-out; cursor: pointer; } .data-view-link-column-linked-doc:hover { text-decoration-color: var(--affine-icon-color); } `}render(){let e=this.value??"",t=this.docId&&this.std?.collection.getDoc(this.docId)?.meta?.title;return(0,G.qy)` `}updated(){if(this.value!==this.preValue){let e=this.std;if(this.preValue=this.value,!this.value||!(0,K.AY)(this.value)){this.docId=void 0;return}let t=e?.spec.getService("affine:page").quickSearchService?.searchDoc({userInput:this.value,skipSelection:!0});t?.then(e=>{if(e&&"docId"in e){this.docId=e.docId;return}this.docId=void 0}).catch(()=>{this.docId=void 0})}}get std(){let e=this.view.getContext(X.x);return e?.std}#e2;get docId(){return this.#e2}set docId(e){this.#e2=e}constructor(){super(...arguments),this._onClick=e=>{e.stopPropagation();let t=this.value??"";if(!t||!(0,K.AY)(t)){this.selectCurrentCell(!0);return}if((0,K.AY)(t)){let t=e.target.querySelector(".link-node");t&&(e.preventDefault(),t.click());return}},this._onEdit=e=>{e.stopPropagation(),this.selectCurrentCell(!0)},this.openDoc=e=>{if(e.stopPropagation(),!this.docId)return;let t=this.std,i=t?.doc.root?.id;if(!i)return;let s=t?.view.viewFromPath("block",[i]);(0,W.Z1)(s),s.slots.docLinkClicked.emit({docId:this.docId})},this.#e2=es(this,l,void 0),es(this,c)}static{es(t,r)}},t})(),er=(()=>{let e,t,i=[(0,o.EM)("affine-database-link-cell-editing")],r=[],a=n.v,l=[],c=[];return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;ei(this,null,[(0,o.P)(".affine-database-link-editing")],{kind:"accessor",name:"_container",static:!1,private:!1,access:{has:e=>"_container"in e,get:e=>e._container,set:(e,t)=>{e._container=t}},metadata:s},l,c),ei(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-database-link-cell-editing { width: 100%; cursor: text; } .affine-database-link-editing { display: flex; align-items: center; width: 100%; padding: 0; border: none; font-family: ${(0,s.iz)(y.$7.fontSansFamily)}; color: var(--affine-text-primary-color); font-weight: 400; background-color: transparent; font-size: var(--data-view-cell-text-size); line-height: var(--data-view-cell-text-line-height); word-break: break-all; } .affine-database-link-editing:focus { outline: none; } `}firstUpdated(){this._focusEnd()}onExitEditMode(){this._setValue()}render(){let e=this.value??"";return(0,G.qy)``}#e5;get _container(){return this.#e5}set _container(e){this.#e5=e}constructor(){super(...arguments),this._focusEnd=()=>{let e=this._container.value.length;this._container.focus(),this._container.setSelectionRange(e,e)},this._onKeydown=e=>{"Enter"!==e.key||e.isComposing||(this._setValue(),setTimeout(()=>{this.selectCurrentCell(!1)}))},this._setValue=(e=this._container.value)=>{let t=e;(0,K.AY)(e)&&(t=(0,K.l2)(e)),this.onChange(t),this._container.value=t},this.#e5=es(this,l,void 0),es(this,c)}static{es(t,r)}},t})(),ea=et.renderConfig({icon:(0,a.w)("LinkIcon"),cellRenderer:{view:(0,l.d)(eo),edit:(0,l.d)(er)}});var en=i(64051),el=i(22805),ec=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ed=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n=[(0,o.EM)("affine-multi-tag-view")],l=[],c=(0,w.Tm)(w.ao),d=[],h=[],u=[],p=[],f=[],g=[];(class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.P)(".affine-select-cell-container")],a=[(0,o.MZ)({attribute:!1})],ec(this,null,i,{kind:"accessor",name:"options",static:!1,private:!1,access:{has:e=>"options"in e,get:e=>e.options,set:(e,t)=>{e.options=t}},metadata:s},d,h),ec(this,null,r,{kind:"accessor",name:"selectContainer",static:!1,private:!1,access:{has:e=>"selectContainer"in e,get:e=>e.selectContainer,set:(e,t)=>{e.selectContainer=t}},metadata:s},u,p),ec(this,null,a,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:s},f,g),ec(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-multi-tag-view { display: flex; align-items: center; width: 100%; height: 100%; min-height: 22px; } .affine-select-cell-container * { box-sizing: border-box; } .affine-select-cell-container { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; width: 100%; font-size: var(--affine-font-sm); } .affine-select-cell-container .select-selected { height: 22px; font-size: 14px; line-height: 22px; padding: 0 8px; border-radius: 4px; white-space: nowrap; background: var(--affine-tag-white); overflow: hidden; text-overflow: ellipsis; } `}render(){let e=this.value,t=new Map(this.options?.map(e=>[e.id,e]));return(0,G.qy)`
${(0,el.u)(e,e=>{let i=t.get(e);if(!i)return;let s=(0,S.W)({backgroundColor:i.color});return(0,G.qy)`${i.value}`})}
`}#z=ed(this,d,[]);get options(){return this.#z}set options(e){this.#z=e}#e7=(ed(this,h),ed(this,u,void 0));get selectContainer(){return this.#e7}set selectContainer(e){this.#e7=e}#eJ=(ed(this,p),ed(this,f,[]));get value(){return this.#eJ}set value(e){this.#eJ=e}constructor(){super(...arguments),ed(this,g)}static{ed(t,l)}})})();var eh=i(59634),eu=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ep=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-multi-select-cell")],s=[],r=n.v;return class extends r{static{t=this}static{let o="function"==typeof Symbol&&Symbol.metadata?Object.create(r[Symbol.metadata]??null):void 0;eu(null,e={value:t},i,{kind:"class",name:t.name,metadata:o},null,s),t=e.value,o&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),ep(t,s)}render(){return(0,G.qy)` `}},t})(),eg=(()=>{let e,t,i=[(0,o.EM)("affine-database-multi-select-cell-editing")],s=[],r=n.v;return class extends r{static{t=this}constructor(){super(...arguments),this._editComplete=()=>{this.selectCurrentCell(!1)},this._onChange=e=>{this.onChange(e)},this._onOptionsChange=e=>{this.column.updateData(t=>({...t,options:e}))},this.popTagSelect=()=>{this._disposables.add({dispose:(0,en.o)(this.querySelector("affine-multi-tag-view")??this,{options:this._options,onOptionsChange:this._onOptionsChange,value:this._value,onChange:this._onChange,onComplete:this._editComplete,minWidth:400})})}}static{let o="function"==typeof Symbol&&Symbol.metadata?Object.create(r[Symbol.metadata]??null):void 0;eu(null,e={value:t},i,{kind:"class",name:t.name,metadata:o},null,s),t=e.value,o&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),ep(t,s)}get _options(){return this.column.data$.value.options}get _value(){return this.value??[]}firstUpdated(){this.popTagSelect()}render(){return(0,G.qy)` `}},t})(),em=eh.r.renderConfig({icon:(0,a.w)("DatabaseMultiSelect"),cellRenderer:{view:(0,l.d)(ef),edit:(0,l.d)(eg)}});var ev=i(63820),ey=i(6125);let eb=e=>({style:"currency",currency:e,currencyDisplay:"symbol"}),ew={number:{style:"decimal",useGrouping:!1},numberWithCommas:{style:"decimal",useGrouping:!0},percent:{style:"percent",useGrouping:!1},currencyINR:eb("INR"),currencyYen:eb("JPY"),currencyCNY:eb("CNY"),currencyUSD:eb("USD"),currencyEUR:eb("EUR"),currencyGBP:eb("GBP")};function ex(e,t,i){let s={...ew[t]};return void 0!==i&&Object.assign(s,{minimumFractionDigits:i,maximumFractionDigits:i}),new Intl.NumberFormat(navigator.language,s).format(e)}var e_=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},eC=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-number-cell")],r=[],a=n.v;return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;e_(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-database-number-cell { display: block; width: 100%; } .affine-database-number { display: flex; align-items: center; justify-content: flex-end; width: 100%; padding: 0; border: none; font-family: ${(0,s.iz)(y.$7.fontSansFamily)}; font-size: var(--data-view-cell-text-size); line-height: var(--data-view-cell-text-line-height); color: var(--affine-text-primary-color); font-weight: 400; background-color: transparent; } `}_getFormattedString(){let e=this.view.featureFlags$.value.enable_number_formatting,t=this.column.data$.value.decimal??0,i=this.column.data$.value.format??"number";return this.value?e?ex(this.value,i,t):this.value.toString():""}render(){return(0,s.qy)`
${this._getFormattedString()}
`}static{eC(t,r)}},t})(),eS=(()=>{let e,t,i=[(0,o.EM)("affine-database-number-cell-editing")],r=[],a=n.v,l=[],c=[];return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;e_(this,null,[(0,o.P)("input")],{kind:"accessor",name:"_inputEle",static:!1,private:!1,access:{has:e=>"_inputEle"in e,get:e=>e._inputEle,set:(e,t)=>{e._inputEle=t}},metadata:s},l,c),e_(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-database-number-cell-editing { display: block; width: 100%; cursor: text; } .affine-database-number { display: flex; align-items: center; width: 100%; padding: 0; border: none; font-family: ${(0,s.iz)(y.$7.fontSansFamily)}; font-size: var(--data-view-cell-text-size); line-height: var(--data-view-cell-text-line-height); color: var(--affine-text-primary-color); font-weight: 400; background-color: transparent; text-align: right; } .affine-database-number:focus { outline: none; } `}_blur(){this.selectCurrentCell(!1)}_focus(){this.isEditing||this.selectCurrentCell(!0)}firstUpdated(){requestAnimationFrame(()=>{this.focusEnd()})}onExitEditMode(){this._setValue()}render(){let e=this.value?this._getFormattedString(this.value):"";return(0,s.qy)``}#e3;get _inputEle(){return this.#e3}set _inputEle(e){this.#e3=e}constructor(){super(...arguments),this._getFormattedString=e=>{let t=this.view.featureFlags$.value.enable_number_formatting,i=this.column.data$.value.decimal??0,s=this.column.data$.value.format??"number";return t?ex(e,s,i):e.toString()},this._keydown=e=>{let t=ev.vL?e.metaKey:e.ctrlKey;if("z"===e.key.toLowerCase()&&t){e.stopPropagation();return}"Enter"!==e.key||e.isComposing||requestAnimationFrame(()=>{this.selectCurrentCell(!1)})},this._setValue=(e=this._inputEle.value)=>{if(!e){this.onChange(void 0);return}let t=this.view.featureFlags$.value.enable_number_formatting?function(e,t){t=t??1.1.toLocaleString((void 0)??navigator.language).slice(1,2);let i=e.replace(RegExp(`\\${t}`,"g"),".").replace(/^[^\d-+eE.]+|[^\d]+$/g,"");if(i=(i=(i=(i=i.replace(/[^0-9.eE+-]/g,"")).replace(/([-+]){2,}/g,"$1")).replace(/^([-+]?)[^eE]*([eE][-+]?\d+)?$/,(e,t,s)=>t+i.replace(/[eE].*/,"").replace(/[^\d.]/g,"")+(s||""))).replace(/(\..*)\./g,"$1"),/[eE]/.test(i)){let[e,t]=i.split(/[eE]/);if(!e||!t||t.includes(".")||t.includes("e")||t.includes("E"))return NaN}return parseFloat(i)}(e):parseFloat(e);if(isNaN(t)){this._inputEle.value=this.value?this._getFormattedString(this.value):"";return}this._inputEle.value=this._getFormattedString(t),this.onChange(t)},this.focusEnd=()=>{let e=this._inputEle.value.length;this._inputEle.focus(),this._inputEle.setSelectionRange(e,e)},this.#e3=eC(this,l,void 0),eC(this,c)}static{eC(t,r)}},t})(),eM=ey.H.renderConfig({icon:(0,a.w)("DatabaseNumber"),cellRenderer:{view:(0,l.d)(ek),edit:(0,l.d)(eS)}}),eE=(e,t)=>{let i=t?.transform??(e=>e),s=i(e),o={data:t.onDrag(s),last:s,move:e=>{o.data=t.onMove(e)}},r=()=>{window.removeEventListener("pointermove",n),window.removeEventListener("pointerup",l),window.removeEventListener("keydown",a),t.onClear()},a=e=>{"Escape"===e.key&&r()},n=e=>{e.preventDefault();let s=i(e);o.last=s,o.data=t.onMove(s)},l=()=>{try{t.onDrop(o.data)}finally{r()}};return window.addEventListener("pointermove",n),window.addEventListener("pointerup",l),window.addEventListener("keydown",a),o},eI=(0,h.D)("progress").modelConfig({name:"Progress",type:()=>d.Qc.create(),defaultData:()=>({}),cellToString:e=>e?.toString()??"",cellFromString:e=>{let t=e?Number(e):NaN;return{value:isNaN(t)?null:t}},cellToJson:e=>e??null,isEmpty:()=>!1});eI.addConvert("rich-text",(e,t)=>({column:{},cells:t.map(e=>new c.EY(e?.toString()).yText)})),eI.addConvert("number",(e,t)=>({column:{decimal:0,format:"number"},cells:t.map(e=>e)}));var eB=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},e$=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-progress-cell")],r=[],a=n.v;return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;eB(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=eT}render(){let e=this.value??0,t=eO.processing;100===e&&(t=eO.success);let i=(0,S.W)({width:`${e}%`,backgroundColor:t}),o=(0,S.W)({backgroundColor:0===e?eO.empty:"var(--affine-hover-color)"});return(0,s.qy)`
${e}
`}static{e$(t,r)}},t})(),eH=(()=>{let e,t,i,r,a=[(0,o.EM)("affine-database-progress-cell-editing")],l=[],c=n.v,d=[],h=[],u=[],p=[];return class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.P)(".affine-database-progress-bg")],r=[(0,o.wk)()],eB(this,null,i,{kind:"accessor",name:"_progressBg",static:!1,private:!1,access:{has:e=>"_progressBg"in e,get:e=>e._progressBg,set:(e,t)=>{e._progressBg=t}},metadata:s},d,h),eB(this,null,r,{kind:"accessor",name:"tempValue",static:!1,private:!1,access:{has:e=>"tempValue"in e,get:e=>e.tempValue,set:(e,t)=>{e.tempValue=t}},metadata:s},u,p),eB(null,e={value:t},a,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=eT}_onChange(e){this.tempValue=e}get _value(){return this.tempValue??this.value??0}firstUpdated(){let e=this._disposables;e.addFromEvent(this._progressBg,"pointerdown",this.startDrag),e.addFromEvent(window,"keydown",e=>{if("ArrowDown"===e.key){this._onChange(Math.max(0,this._value-1));return}if("ArrowUp"===e.key){this._onChange(Math.min(100,this._value+1));return}})}onCopy(e){e.preventDefault()}onCut(e){e.preventDefault()}onExitEditMode(){this.onChange(this._value)}onPaste(e){e.preventDefault()}render(){let e=this._value,t=eO.processing;100===e&&(t=eO.success);let i=(0,S.W)({width:`${e}%`,backgroundColor:t}),o=(0,S.W)({backgroundColor:0===e?eO.empty:"var(--affine-hover-color)"}),r=(0,S.W)({left:`calc(${e}% - 3px)`});return(0,s.qy)`
${e}
`}#e4;get _progressBg(){return this.#e4}set _progressBg(e){this.#e4=e}#e1;get tempValue(){return this.#e1}set tempValue(e){this.#e1=e}constructor(){super(...arguments),this.startDrag=e=>{let t=this._progressBg.getBoundingClientRect(),i=t.left,s=t.right,o=e=>{this.tempValue=Math.round((Math.min(s,Math.max(i,e))-i)/(s-i)*100)};eE(e,{onDrag:({x:e})=>{o(e)},onMove:({x:e})=>{o(e)},onDrop:()=>{},onClear:()=>{}})},this.#e4=e$(this,d,void 0),this.#e1=(e$(this,h),e$(this,u,void 0)),e$(this,p)}static{e$(t,l)}},t})(),eA=eI.renderConfig({icon:(0,a.w)("DatabaseProgress"),cellRenderer:{view:(0,l.d)(eP),edit:(0,l.d)(eH)}});var eL=i(78946),eD=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},eZ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-select-cell")],s=[],r=n.v;return class extends r{static{t=this}static{let o="function"==typeof Symbol&&Symbol.metadata?Object.create(r[Symbol.metadata]??null):void 0;eD(null,e={value:t},i,{kind:"class",name:t.name,metadata:o},null,s),t=e.value,o&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),eZ(t,s)}render(){let e=this.value?[this.value]:[];return(0,G.qy)` `}},t})(),eV=(()=>{let e,t,i=[(0,o.EM)("affine-database-select-cell-editing")],s=[],r=n.v;return class extends r{static{t=this}constructor(){super(...arguments),this._editComplete=()=>{this.selectCurrentCell(!1)},this._onChange=([e])=>{this.onChange(e)},this._onOptionsChange=e=>{this.column.updateData(t=>({...t,options:e}))},this.popTagSelect=()=>{this._disposables.add({dispose:(0,en.o)(this.querySelector("affine-multi-tag-view")??this,{mode:"single",options:this._options,onOptionsChange:this._onOptionsChange,value:this._value,onChange:this._onChange,onComplete:this._editComplete,minWidth:400})})}}static{let o="function"==typeof Symbol&&Symbol.metadata?Object.create(r[Symbol.metadata]??null):void 0;eD(null,e={value:t},i,{kind:"class",name:t.name,metadata:o},null,s),t=e.value,o&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),eZ(t,s)}get _options(){return this.column.data$.value.options}get _value(){let e=this.value;return e?[e]:[]}firstUpdated(){this.popTagSelect()}render(){return(0,G.qy)` `}},t})(),ez=eL.C.renderConfig({icon:(0,a.w)("DatabaseSelect"),cellRenderer:{view:(0,l.d)(ej),edit:(0,l.d)(eV)}});var eR=i(54399),eF=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},eN=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-text-cell")],r=[],a=n.v;return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;eF(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-database-text-cell { display: block; width: 100%; height: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .affine-database-text { display: flex; align-items: center; height: 100%; width: 100%; padding: 0; border: none; font-family: ${(0,s.iz)(y.$7.fontSansFamily)}; font-size: var(--affine-font-base); line-height: var(--affine-line-height); color: var(--affine-text-primary-color); font-weight: 400; background-color: transparent; } `}render(){return(0,s.qy)`
${this.value??""}
`}static{eN(t,r)}},t})(),eU=(()=>{let e,t,i=[(0,o.EM)("affine-database-text-cell-editing")],r=[],a=n.v,l=[],c=[];return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;eF(this,null,[(0,o.P)("input")],{kind:"accessor",name:"_inputEle",static:!1,private:!1,access:{has:e=>"_inputEle"in e,get:e=>e._inputEle,set:(e,t)=>{e._inputEle=t}},metadata:s},l,c),eF(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-database-text-cell-editing { display: block; width: 100%; height: 100%; cursor: text; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .affine-database-text { display: flex; align-items: center; height: 100%; width: 100%; padding: 0; border: none; font-family: ${(0,s.iz)(y.$7.fontSansFamily)}; font-size: var(--affine-font-base); line-height: var(--affine-line-height); color: var(--affine-text-primary-color); font-weight: 400; background-color: transparent; } .affine-database-text:focus { outline: none; } `}firstUpdated(){this.focusEnd()}onExitEditMode(){this._setValue()}render(){return(0,s.qy)``}#e3;get _inputEle(){return this.#e3}set _inputEle(e){this.#e3=e}constructor(){super(...arguments),this._keydown=e=>{"Enter"!==e.key||e.isComposing||(this._setValue(),setTimeout(()=>{this.selectCurrentCell(!1)}))},this._setValue=(e=this._inputEle.value)=>{this._inputEle.value=`${this.value??""}`,this.onChange(e)},this.focusEnd=()=>{let e=this._inputEle.value.length;this._inputEle.focus(),this._inputEle.setSelectionRange(e,e)},this.#e3=eN(this,l,void 0),eN(this,c)}static{eN(t,r)}},t})(),eW={checkboxColumnConfig:m,dateColumnConfig:z,imageColumnConfig:U,linkColumnConfig:ea,multiSelectColumnConfig:em,numberColumnConfig:eM,progressColumnConfig:eA,selectColumnConfig:ez,textColumnConfig:eR.p.renderConfig({icon:(0,a.w)("TextIcon"),cellRenderer:{view:(0,l.d)(eq),edit:(0,l.d)(eU)}})};class eG{constructor(){this.context=new Map}getContext(e){return this.context.get(e)}propertyGetDefaultWidth(e){return 180}propertyGetReadonly(e){return!1}setContext(e,t){this.context.set(e,t)}get detailSlots(){return{}}}var eY=i(55134),eK=i(31980),eX=i(71323),eQ=i(45601),eJ=i(1200),e1=i(1325),e0=i(1497),e2=i(91837),e5=i(25721);let e7=e=>({icon:(0,G.qy)`
${(0,e5.ep)(e.icon)}
`,divider:!1,initValue:e.name,onComplete:t=>{e.updateName(t)}}),e3=e=>({type:"sub-menu",name:"Type",hide:()=>!e.updateType||"title"===e.type,postfix:(0,G.qy)`
${(0,e5.ep)(e.icon)} ${e.view.allColumnConfig.find(t=>t.type===e.type)?.name}
`,options:{input:{search:!0},items:e.view.allColumnConfig.map(t=>({type:"action",isSelected:t.type===e.type,name:t.name,icon:(0,e5.ep)(e.view.getIcon(t.type)),select:()=>{e.type!==t.type&&e.updateType?.(t.type)}}))}});var e4=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},e6=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c=[(0,o.EM)("affine-data-view-record-field")],d=[],h=(0,w.Tm)(w.ao),u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],x=[],_=[];return class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.wk)()],a=[(0,o.wk)()],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],e4(this,null,i,{kind:"accessor",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:s},u,p),e4(this,null,r,{kind:"accessor",name:"editing",static:!1,private:!1,access:{has:e=>"editing"in e,get:e=>e.editing,set:(e,t)=>{e.editing=t}},metadata:s},f,g),e4(this,null,a,{kind:"accessor",name:"isFocus",static:!1,private:!1,access:{has:e=>"isFocus"in e,get:e=>e.isFocus,set:(e,t)=>{e.isFocus=t}},metadata:s},m,v),e4(this,null,n,{kind:"accessor",name:"rowId",static:!1,private:!1,access:{has:e=>"rowId"in e,get:e=>e.rowId,set:(e,t)=>{e.rowId=t}},metadata:s},y,b),e4(this,null,l,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:s},x,_),e4(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-data-view-record-field { display: flex; gap: 12px; } .field-left { padding: 6px; display: flex; height: max-content; align-items: center; gap: 6px; font-size: var(--data-view-cell-text-size); line-height: var(--data-view-cell-text-line-height); color: var(--affine-text-secondary-color); width: 160px; border-radius: 4px; cursor: pointer; user-select: none; } .field-left:hover { background-color: var(--affine-hover-color); } affine-data-view-record-field .icon { display: flex; align-items: center; width: 16px; height: 16px; } affine-data-view-record-field .icon svg { width: 16px; height: 16px; fill: var(--affine-icon-color); } .filed-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .field-content { padding: 6px 8px; border-radius: 4px; flex: 1; cursor: pointer; display: flex; align-items: center; border: 1px solid transparent; } .field-content .affine-database-number { text-align: left; justify-content: start; } .field-content:hover { background-color: var(--affine-hover-color); } .field-content.is-editing { box-shadow: 0px 0px 0px 2px rgba(30, 150, 235, 0.3); } .field-content.is-focus { border: 1px solid var(--affine-primary-color); } .field-content.empty::before { content: 'Empty'; color: var(--affine-text-disable-color); font-size: 14px; line-height: 22px; } `}get readonly(){return this.view.readonly$.value}render(){let e=this.column,t={cell:this.cell$.value,isEditing:this.editing,selectCurrentCell:this.changeEditing},i=this.column.renderer$.value;if(!i)return;let{view:s,edit:o}=i,r=(0,k.H)({"field-content":!0,empty:!this.editing&&this.cell$.value.isEmpty$.value,"is-editing":this.editing,"is-focus":this.isFocus});return(0,G.qy)`
${e.name}
${(0,e2.ep)(this.editing&&o?o:s,t,{ref:this._cell,class:"kanban-cell"})}
`}get cell(){return this._cell.value}#e6;get column(){return this.#e6}set column(e){this.#e6=e}#e8;get editing(){return this.#e8}set editing(e){this.#e8=e}#e9;get isFocus(){return this.#e9}set isFocus(e){this.#e9=e}#te;get rowId(){return this.#te}set rowId(e){this.#te=e}#tt;get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),this._cell=(0,eQ._)(),this._click=e=>{e.stopPropagation(),this.readonly||this.changeEditing(!0)},this._clickLeft=e=>{if(this.readonly)return;let t=e.currentTarget,i=this.view.detailColumns$.value;(0,e1.zs)(t,{options:{input:e7(this.column),items:[{type:"group",name:"Column Prop Group ",children:()=>[e3(this.column)]},{type:"action",name:"Duplicate Column",icon:e0.DatabaseDuplicate,hide:()=>!this.column.duplicate||"title"===this.column.type,select:()=>{this.column.duplicate?.()}},{type:"action",name:"Move Up",icon:(0,G.qy)`
${e0.DatabaseMoveLeft}
`,hide:()=>0===i.findIndex(e=>e===this.column.id),select:()=>{let e=i.findIndex(e=>e===this.column.id),t=i[e-1];t&&this.view.columnMove(this.column.id,{id:t,before:!0})}},{type:"action",name:"Move Down",icon:(0,G.qy)`
${e0.DatabaseMoveRight}
`,hide:()=>i.findIndex(e=>e===this.column.id)===i.length-1,select:()=>{let e=i.findIndex(e=>e===this.column.id),t=i[e+1];t&&this.view.columnMove(this.column.id,{id:t,before:!1})}},{type:"group",name:"operation",children:()=>[{type:"action",name:"Delete Column",icon:e0.DeleteIcon,hide:()=>!this.column.delete||"title"===this.column.type,select:()=>{this.column.delete?.()},class:"delete-item"}]}]}})},this.cell$=(0,eK.EW)(()=>this.column.cellGet(this.rowId)),this.changeEditing=e=>{let t=this.closest("affine-data-view-record-detail")?.selection;t&&(t.selection={propertyId:this.column.id,isEditing:e})},this.#e6=e6(this,u,void 0),this.#e8=(e6(this,p),e6(this,f,!1)),this.#e9=(e6(this,g),e6(this,m,!1)),this.#te=(e6(this,v),e6(this,y,void 0)),this.#tt=(e6(this,b),e6(this,x,void 0)),e6(this,_)}static{e6(t,d)}},t})();var e9=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},te=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,r,a,n,l,c,d=[(0,o.EM)("affine-data-view-kanban-cell")],h=[],u=(0,w.Tm)(w.ao),p=[],f=[],g=[],m=[],v=[],y=[],b=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[];return class extends u{static{t=this}static{let w="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],s=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.wk)()],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.wk)()],c=[(0,o.MZ)({attribute:!1})],e9(this,null,i,{kind:"accessor",name:"cardId",static:!1,private:!1,access:{has:e=>"cardId"in e,get:e=>e.cardId,set:(e,t)=>{e.cardId=t}},metadata:w},p,f),e9(this,null,s,{kind:"accessor",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:w},g,m),e9(this,null,r,{kind:"accessor",name:"contentOnly",static:!1,private:!1,access:{has:e=>"contentOnly"in e,get:e=>e.contentOnly,set:(e,t)=>{e.contentOnly=t}},metadata:w},v,y),e9(this,null,a,{kind:"accessor",name:"editing",static:!1,private:!1,access:{has:e=>"editing"in e,get:e=>e.editing,set:(e,t)=>{e.editing=t}},metadata:w},b,x),e9(this,null,n,{kind:"accessor",name:"groupKey",static:!1,private:!1,access:{has:e=>"groupKey"in e,get:e=>e.groupKey,set:(e,t)=>{e.groupKey=t}},metadata:w},_,C),e9(this,null,l,{kind:"accessor",name:"isFocus",static:!1,private:!1,access:{has:e=>"isFocus"in e,get:e=>e.isFocus,set:(e,t)=>{e.isFocus=t}},metadata:w},k,S),e9(this,null,c,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:w},M,E),e9(null,e={value:t},d,{kind:"class",name:t.name,metadata:w},null,h),t=e.value,w&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:w})}static{this.styles=tt}connectedCallback(){super.connectedCallback(),this._disposables.addFromEvent(this,"click",e=>{!e.shiftKey&&(e.stopPropagation(),this.closest("affine-data-view-kanban")?.selectionController&&(e.shiftKey||this.editing||this.selectCurrentCell(!this.column.readonly$.value)))})}isSelected(e){if("cell"===e.selectionType&&e.groupKey===this.groupKey)return e.cardId===this.cardId&&e.columnId===this.column.id}render(){let e={cell:this.column.cellGet(this.cardId),isEditing:this.editing,selectCurrentCell:this.selectCurrentCell},t=this.column.renderer$.value;if(!t)return;let{view:i,edit:s}=t;return this.style.border=this.isFocus?"1px solid var(--affine-primary-color)":"",this.style.boxShadow=this.editing?"0px 0px 0px 2px rgba(30, 150, 235, 0.30)":"",(0,G.qy)` ${this.renderIcon()} ${(0,e2.ep)(this.editing&&s?s:i,e,{ref:this._cell,class:"kanban-cell",style:{display:"block",flex:"1",overflow:"hidden"}})}`}renderIcon(){if(!this.contentOnly)return(0,G.qy)` `}get cell(){return this._cell.value}get selection(){return this.closest("affine-data-view-kanban")?.selectionController}#ti;get cardId(){return this.#ti}set cardId(e){this.#ti=e}#e6;get column(){return this.#e6}set column(e){this.#e6=e}#ts;get contentOnly(){return this.#ts}set contentOnly(e){this.#ts=e}#e8;get editing(){return this.#e8}set editing(e){this.#e8=e}#to;get groupKey(){return this.#to}set groupKey(e){this.#to=e}#e9;get isFocus(){return this.#e9}set isFocus(e){this.#e9=e}#tt;get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),this._cell=(0,eQ._)(),this.selectCurrentCell=e=>{let t=this.closest("affine-data-view-kanban")?.selectionController;if(t&&t){let i=t.selection;i&&this.isSelected(i)&&e?t.selection={selectionType:"cell",groupKey:this.groupKey,cardId:this.cardId,columnId:this.column.id,isEditing:!0}:t.selection={selectionType:"cell",groupKey:this.groupKey,cardId:this.cardId,columnId:this.column.id,isEditing:!1}}},this.#ti=te(this,p,void 0),this.#e6=(te(this,f),te(this,g,void 0)),this.#ts=(te(this,m),te(this,v,!1)),this.#e8=(te(this,y),te(this,b,!1)),this.#to=(te(this,x),te(this,_,void 0)),this.#e9=(te(this,C),te(this,k,!1)),this.#tt=(te(this,S),te(this,M,void 0)),te(this,E)}static{te(t,h)}},t})();class ts{constructor(e){this.viewEle=e,this.onSelect=e=>{let t=this._selection;t&&this.blur(t),this._selection=e,e&&this.focus(e)}}blur(e){let t=this.getFocusCellContainer(e);if(!t)return;t.isFocus=!1;let i=t.cell;e.isEditing?(requestAnimationFrame(()=>{i?.onExitEditMode()}),i?.blurCell()&&t.blur(),t.editing=!1):t.blur()}deleteProperty(){}focus(e){let t=this.getFocusCellContainer(e);if(!t)return;t.isFocus=!0;let i=t.cell;e.isEditing?(i?.onEnterEditMode(),i?.focusCell()&&t.focus(),t.editing=!0):t.focus()}focusDown(){let e=this.selection;if(!e||e?.isEditing)return;let t=this.getFocusCellContainer(e)?.nextElementSibling;t instanceof ti&&(this.selection={propertyId:t.column.id,isEditing:!1})}focusFirstCell(){let e=this.viewEle.querySelector("affine-data-view-record-field")?.column.id;e&&(this.selection={propertyId:e,isEditing:!0})}focusUp(){let e=this.selection;if(!e||e?.isEditing)return;let t=this.getFocusCellContainer(e)?.previousElementSibling;t instanceof e8&&(this.selection={propertyId:t.column.id,isEditing:!1})}getFocusCellContainer(e){return this.viewEle.querySelector(`affine-data-view-record-field[data-column-id="${e.propertyId}"]`)}getSelectCard(e){let{groupKey:t,cardId:i}=e.cards[0];return this.viewEle.querySelector(`affine-data-view-kanban-group[data-key="${t}"]`)?.querySelector(`affine-data-view-kanban-card[data-card-id="${i}"]`)}get selection(){return this._selection}set selection(e){if(!e){this.onSelect();return}if(e.isEditing){let t=this.getFocusCellContainer(e),i=t?.cell,s=!!i&&!!i.beforeEnterEditMode()&&e.isEditing;this.onSelect({propertyId:e.propertyId,isEditing:s})}else this.onSelect(e)}}var to=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tr=function(e,t,i){for(var s=arguments.length>2,o=0;o `,tn=(0,G.qy)` `,tl=(0,s.AH)` ${(0,s.iz)((0,eJ.S)("affine-data-view-record-detail"))} affine-data-view-record-detail { position: relative; display: flex; flex: 1; flex-direction: column; padding: 20px; gap: 12px; background-color: var(--affine-background-primary-color); border-radius: 8px; height: 100%; width: 100%; } .add-property { display: flex; align-items: center; gap: 4px; font-size: var(--data-view-cell-text-size); font-style: normal; font-weight: 400; line-height: var(--data-view-cell-text-line-height); color: var(--affine-text-disable-color); border-radius: 4px; padding: 6px 8px 6px 4px; cursor: pointer; margin-top: 8px; width: max-content; } .add-property:hover { background-color: var(--affine-hover-color); } .add-property .icon { display: flex; align-items: center; } .add-property .icon svg { fill: var(--affine-icon-color); width: 20px; height: 20px; } .switch-row { display: flex; align-items: center; justify-content: center; padding: 2px; border-radius: 4px; cursor: pointer; } .switch-row:hover { background-color: var(--affine-hover-color); } .switch-row.disable { cursor: default; background: none; opacity: 0.5; } `,tc=(()=>{let e,t,i,r,a,n=[(0,o.EM)("affine-data-view-record-detail")],l=[],c=(0,w.Tm)(w.ao),d=[],h=[],u=[],p=[],f=[],g=[];return class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.P)(".add-property")],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],to(this,null,i,{kind:"accessor",name:"addPropertyButton",static:!1,private:!1,access:{has:e=>"addPropertyButton"in e,get:e=>e.addPropertyButton,set:(e,t)=>{e.addPropertyButton=t}},metadata:s},d,h),to(this,null,r,{kind:"accessor",name:"rowId",static:!1,private:!1,access:{has:e=>"rowId"in e,get:e=>e.rowId,set:(e,t)=>{e.rowId=t}},metadata:s},u,p),to(this,null,a,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:s},f,g),to(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=tl}get readonly(){return this.view.readonly$.value}renderHeader(){let e=this.detailSlots?.header;if(e){let t={view:this.view,rowId:this.rowId};return(0,e2.ep)(e,t)}}renderNote(){let e=this.detailSlots?.note;if(e){let t={view:this.view,rowId:this.rowId};return(0,e2.ep)(e,t)}}connectedCallback(){super.connectedCallback(),this.disposables.addFromEvent(this,"click",e=>{e.stopPropagation(),this.selection.selection=void 0}),this.dataset.widgetId="affine-detail-widget",this.detailSlots=this.view.detailSlots}hasNext(){return null!=this.view.rowGetNext(this.rowId)}hasPrev(){return null!=this.view.rowGetPrev(this.rowId)}nextRow(){let e=this.view.rowGetNext(this.rowId);null!=e&&(this.rowId=e,this.requestUpdate())}prevRow(){let e=this.view.rowGetPrev(this.rowId);null!=e&&(this.rowId=e,this.requestUpdate())}render(){let e=this.columns$.value,t=(0,k.H)({"switch-row":!0,disable:!this.hasPrev()}),i=(0,k.H)({"switch-row":!0,disable:!this.hasNext()});return(0,G.qy)`
${tn}
${ta}
${(0,eX.D)(this.rowId,this.renderHeader())} ${(0,el.u)(e,e=>e.id,e=>(0,eX.D)(this.rowId,(0,G.qy)` `))} ${this.readonly?s.s6:(0,G.qy)`
${e0.PlusIcon}
Add Property
`}
${(0,eX.D)(this.rowId,this.renderNote())} `}#tr;get addPropertyButton(){return this.#tr}set addPropertyButton(e){this.#tr=e}#te;get rowId(){return this.#te}set rowId(e){this.#te=e}#tt;get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),this._clickAddProperty=()=>{(0,e1.$E)(this.addPropertyButton,this.view.allColumnConfig.map(e=>({type:"action",name:e.name,icon:(0,e2.ep)(this.view.getIcon(e.type)),select:()=>{this.view.columnAdd("end",e.type)}})))},this.columns$=(0,eK.EW)(()=>this.view.detailColumns$.value.map(e=>this.view.columnGet(e))),this.selection=new ts(this),this.#tr=tr(this,d,void 0),this.#te=(tr(this,h),tr(this,u,void 0)),this.#tt=(tr(this,p),tr(this,f,void 0)),tr(this,g)}static{tr(t,l)}},t})();var td=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},th=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a=[(0,o.EM)("side-layout-modal")],n=[],l=w.ao,c=[],d=[],h=[],u=[];return class extends l{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],td(this,null,i,{kind:"accessor",name:"close",static:!1,private:!1,access:{has:e=>"close"in e,get:e=>e.close,set:(e,t)=>{e.close=t}},metadata:s},c,d),td(this,null,r,{kind:"accessor",name:"content",static:!1,private:!1,access:{has:e=>"content"in e,get:e=>e.content,set:(e,t)=>{e.content=t}},metadata:s},h,u),td(null,e={value:t},a,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` side-layout-modal { display: flex; flex-direction: column; position: absolute; top: 0; bottom: 0; width: 1200px; background-color: var(--affine-background-overlay-panel-color); border-left: 0.5px solid var(--affine-border-color); box-shadow: 0 0 10px rgba(0, 0, 0, 0.05); } .side-modal-content { flex: 1; overflow-y: auto; } .side-modal-header { padding: 12px; display: flex; align-items: center; } .header-ops { display: flex; align-items: center; gap: 8px; } .header-op { display: flex; align-items: center; padding: 2px; border-radius: 4px; cursor: pointer; } .header-op svg { width: 20px; height: 20px; color: var(--affine-icon-color); } .header-op:hover { background-color: var(--affine-hover-color); } `}render(){return(0,s.qy)`
${e0.CrossIcon}
${this.renderOps()}
${this.content}
`}renderOps(){return(0,s.qy)``}#ta=th(this,c,void 0);get close(){return this.#ta}set close(e){this.#ta=e}#tn=(th(this,d),th(this,h,void 0));get content(){return this.#tn}set content(e){this.#tn=e}constructor(){super(...arguments),th(this,u)}static{th(t,n)}},t})(),tp=e=>{let t=(0,e1.mP)(document.body),i=(0,v.ll)(e.target,t,()=>{(0,v.rD)(e.target,t,{middleware:[(0,v.Ej)({apply:({rects:e})=>{Object.assign(t.style,{left:`${e.reference.x}px`,top:`${e.reference.y}px`,width:`${e.reference.width}px`,height:`${e.reference.height}px`})}})]}).catch(console.error)}),s=()=>{t.remove(),e.onClose?.(),i()},o=new tc;o.view=e.view,o.rowId=e.rowId;let r=new tu;r.content=o,r.close=s,t.onclick=e=>e.target===t&&s(),t.append(r)},tf=e=>(0,s.qy)``;var tg=i(50307),tm=i(12552),tv=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ty=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,r,a=(0,w.Tm)(w.ao),n=[],l=[],c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];return class extends a{static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;e=[(0,o.MZ)({attribute:!1})],t=[(0,o.MZ)({attribute:!1})],i=[(0,o.MZ)({attribute:!1})],s=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],tv(this,null,e,{kind:"accessor",name:"data",static:!1,private:!1,access:{has:e=>"data"in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:v},n,l),tv(this,null,t,{kind:"accessor",name:"readonly",static:!1,private:!1,access:{has:e=>"readonly"in e,get:e=>e.readonly,set:(e,t)=>{e.readonly=t}},metadata:v},c,d),tv(this,null,i,{kind:"accessor",name:"updateData",static:!1,private:!1,access:{has:e=>"updateData"in e,get:e=>e.updateData,set:(e,t)=>{e.updateData=t}},metadata:v},h,u),tv(this,null,s,{kind:"accessor",name:"updateValue",static:!1,private:!1,access:{has:e=>"updateValue"in e,get:e=>e.updateValue,set:(e,t)=>{e.updateValue=t}},metadata:v},p,f),tv(this,null,r,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:v},g,m),v&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}#tl=ty(this,n,void 0);get data(){return this.#tl}set data(e){this.#tl=e}#ei=(ty(this,l),ty(this,c,void 0));get readonly(){return this.#ei}set readonly(e){this.#ei=e}#tc=(ty(this,d),ty(this,h,void 0));get updateData(){return this.#tc}set updateData(e){this.#tc=e}#td=(ty(this,u),ty(this,p,void 0));get updateValue(){return this.#td}set updateValue(e){this.#td=e}#eJ=(ty(this,f),ty(this,g,void 0));get value(){return this.#eJ}set value(e){this.#eJ=e}constructor(){super(...arguments),ty(this,m)}}})();var tw=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tx=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("data-view-group-title-boolean-view")],a=[],n=tb;return class extends n{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;tw(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,a),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .data-view-group-title-boolean-view { display: flex; align-items: center; } .data-view-group-title-boolean-view svg { width: 20px; height: 20px; } `}render(){return(0,s.qy)`
${this.value?(0,r.xY)():(0,r.wb)()}
`}static{tx(t,a)}},t})();var tC=i(52538),tk=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tS=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("data-view-group-title-number-view")],r=[],a=tb;return class extends a{static{t=this}constructor(){super(...arguments),this._click=()=>{this.readonly||(0,tC.zs)(this,{options:{input:{initValue:this.value?`${10*this.value}`:"",onComplete:e=>{let t=Number.parseFloat(e);Number.isNaN(t)||this.updateValue?.(t)}},items:[]}})}}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;tk(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .data-view-group-title-number-view { border-radius: 8px; padding: 4px 8px; width: max-content; cursor: pointer; } .data-view-group-title-number-view:hover { background-color: var(--affine-hover-color); } `}render(){return null==this.value?(0,s.qy)`
Ungroups
`:this.value>=10?(0,s.qy)`
>= 100
`:(0,s.qy)`
${10*this.value} - ${10*this.value+9}
`}static{tS(t,r)}},t})();var tE=i(7548),tI=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tB=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("data-view-group-title-select-view")],r=[],a=tb;return class extends a{static{t=this}constructor(){super(...arguments),this._click=()=>{this.readonly||(0,e1.zs)(this,{options:{input:{initValue:this.tag?.value??"",onComplete:e=>{this.updateTag({value:e})}},items:tE.C.map(({color:e,name:t})=>{let i=(0,S.W)({backgroundColor:e,borderRadius:"50%",width:"20px",height:"20px"});return{type:"action",name:t,isSelected:this.tag?.color===e,icon:(0,s.qy)`
`,select:()=>{this.updateTag({color:e})}}})}})}}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;tI(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` data-view-group-title-select-view { overflow: hidden; } .data-view-group-title-select-view { width: 100%; cursor: pointer; } .data-view-group-title-select-view.readonly { cursor: inherit; } .tag { padding: 0 8px; border-radius: 4px; font-size: var(--data-view-cell-text-size); line-height: var(--data-view-cell-text-line-height); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } `}render(){let e=this.tag;if(!e)return(0,s.qy)`
Ungroups
`;let t=(0,S.W)({backgroundColor:e.color}),i=(0,k.H)({"data-view-group-title-select-view":!0,readonly:this.readonly});return(0,s.qy)`
${e.value}
`}updateTag(e){this.updateData?.({...this.data,options:this.data.options.map(t=>t.id===this.value?{...t,...e}:t)})}get tag(){return this.data.options.find(e=>e.id===this.value)}static{tB(t,r)}},t})();var tT=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tO=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("data-view-group-title-string-view")],r=[],a=tb;return class extends a{static{t=this}constructor(){super(...arguments),this._click=()=>{this.readonly||(0,e1.zs)(this,{options:{input:{initValue:this.value??"",onComplete:e=>{this.updateValue?.(e)}},items:[]}})}}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;tT(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .data-view-group-title-string-view { border-radius: 8px; padding: 4px 8px; width: max-content; cursor: pointer; } .data-view-group-title-string-view:hover { background-color: var(--affine-hover-color); } `}render(){return this.value?(0,s.qy)`
${this.value}
`:(0,s.qy)`
Ungroups
`}static{tO(t,r)}},t})(),tH={key:"Ungroups",value:null};tm.H.register(d.l0.create(),{name:"select",groupName:(e,t)=>d.l0.is(e)&&e.data?e.data.tags.find(e=>e.id===t)?.value??"":"",defaultKeys:e=>d.l0.is(e)&&e.data?[tH,...e.data.tags.map(e=>({key:e.id,value:e.id}))]:[tH],valuesGroup:(e,t)=>null==e?[tH]:[{key:`${e}`,value:e}],view:(0,e2.Z4)(t$)}),tm.H.register((0,tg.cX)(d.l0.create()),{name:"multi-select",groupName:(e,t)=>d.l0.is(e)&&e.data?e.data.tags.find(e=>e.id===t)?.value??"":"",defaultKeys:e=>(0,tg.Oq)(e)&&d.l0.is(e.ele)&&e.ele.data?[tH,...e.ele.data.tags.map(e=>({key:e.id,value:e.id}))]:[tH],valuesGroup:(e,t)=>null==e?[tH]:Array.isArray(e)&&e.length?e.map(e=>({key:`${e}`,value:e})):[tH],addToGroup:(e,t)=>null==e?t:Array.isArray(t)?[...t,e]:[e],removeFromGroup:(e,t)=>Array.isArray(t)?t.filter(t=>t!==e):t,view:(0,e2.Z4)(t$)}),tm.H.register(d.si.create(),{name:"text",groupName:(e,t)=>`${t??""}`,defaultKeys:e=>[tH],valuesGroup:(e,t)=>e?[{key:`g:${e}`,value:e}]:[tH],view:(0,e2.Z4)(tP)}),tm.H.register(d.Qc.create(),{name:"number",groupName:(e,t)=>`${t??""}`,defaultKeys:e=>[tH],valuesGroup:(e,t)=>"number"!=typeof e?[tH]:[{key:`g:${Math.floor(e/10)}`,value:Math.floor(e/10)}],addToGroup:e=>"number"==typeof e?10*e:void 0,view:(0,e2.Z4)(tM)}),tm.H.register(d.dG.create(),{name:"boolean",groupName:(e,t)=>`${t?.toString()??""}`,defaultKeys:e=>[{key:"true",value:!0},{key:"false",value:!1}],valuesGroup:(e,t)=>"boolean"!=typeof e?[{key:"false",value:!1}]:[{key:e.toString(),value:e}],view:(0,e2.Z4)(t_)});var tA=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tL=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a=[(0,o.EM)("affine-data-view-renderer")],n=[],l=(0,eK.Jb)((0,w.Tm)(w.ao)),c=[],d=[],h=[],u=[];(class extends l{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.wk)()],tA(this,null,i,{kind:"accessor",name:"config",static:!1,private:!1,access:{has:e=>"config"in e,get:e=>e.config,set:(e,t)=>{e.config=t}},metadata:s},c,d),tA(this,null,r,{kind:"accessor",name:"currentView",static:!1,private:!1,access:{has:e=>"currentView"in e,get:e=>e.currentView,set:(e,t)=>{e.currentView=t}},metadata:s},h,u),tA(null,e={value:t},a,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` ${(0,s.iz)((0,eJ.S)("affine-data-view-renderer"))} affine-data-view-renderer { background-color: var(--affine-background-primary-color); display: contents; } `}renderView(e){if(!e)return;let t={dataViewEle:this,view:e.view,headerWidget:this.config.headerWidget,selection$:e.selection$,setSelection:e.setSelection,bindHotkey:e.bindHotkey,handleEvent:e.handleEvent,onDrag:this.config.onDrag,std:this.config.std,dataSource:this.config.dataSource};return(0,eX.D)(e.view.id,(0,e5.ep)(e.view.viewMeta.renderer.view,t,{ref:this._view}))}connectedCallback(){let e;super.connectedCallback(),this.disposables.add(this.currentViewId$.subscribe(t=>{t!==e&&this.config.setSelection(void 0),e=t}))}render(){let e=(0,k.H)({"toolbar-hover-container":!0,"data-view-root":!0,"prevent-reference-popup":!0});return(0,G.qy)`
${this.renderView(this.currentViewConfig$.value)}
`}get expose(){return this._view.value}#th;get config(){return this.#th}set config(e){this.#th=e}#tu;get currentView(){return this.#tu}set currentView(e){this.#tu=e}constructor(){super(...arguments),this._view=(0,eQ._)(),this.currentViewId$=(0,eK.EW)(()=>this.config.dataSource.viewManager.currentViewId$.value),this.currentViewConfig$=(0,eK.EW)(()=>{let e=this.currentViewId$.value;if(e)return{view:this.viewMap$.value[e],selection$:(0,eK.EW)(()=>{let t=this.config.selection$;if(t.value?.viewId===e)return t.value}),setSelection:e=>{this.config.setSelection(e)},handleEvent:(e,t)=>this.config.handleEvent(e,e=>t(e)),bindHotkey:e=>this.config.bindHotkey(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,e=>t(e)])))}}),this.focusFirstCell=()=>{this._view.value?.focusFirstCell()},this.openDetailPanel=e=>{let t=this.config.detailPanelConfig?.openDetailPanel;t?t(this,tf({view:e.view,rowId:e.rowId})).catch(console.error).finally(e.onClose):tp({target:this.config.detailPanelConfig?.target?.()??document.body,view:e.view,rowId:e.rowId,onClose:e.onClose})},this.viewMap$=(0,eK.EW)(()=>{let e=this.config.dataSource.viewManager;return Object.fromEntries(e.views$.value.map(t=>[t,e.viewGet(t)]))}),this.#th=tL(this,c,void 0),this.#tu=(tL(this,d),tL(this,h,void 0)),tL(this,u)}static{tL(t,n)}})})();class tD{constructor(){this._ref=(0,eQ._)()}render(e){return(0,G.qy)` `}get expose(){return this._ref.value?.expose}}var tZ=i(73297),tj=i(68419),tV=i(73134);let tz=e=>({type:e,modelConfig:t=>({type:e,model:t,rendererConfig:i=>({type:e,model:t,renderer:i})})});new class{constructor(){this.map=new Map}getView(e){let t=this.map.get(e);if(!t)throw new tj.Ss(tV.O.DatabaseBlockError,`${e} is not exist`);return t}get all(){return Array.from(this.map.values())}};var tR=i(29072),tF=i(16921),tN=i(90044),tq=i(47607),tU=i(502),tW=i(26219);class tG extends tW.d{constructor(){super(...arguments),this.columns$=(0,eK.EW)(()=>this.columnsWithoutFilter$.value.filter(e=>!this.columnGetHide(e))),this.columnsWithoutFilter$=(0,eK.EW)(()=>{let e=new Set(this.dataSource.properties$.value),t=[];return this.viewData$.value?.columns.forEach(i=>{e.has(i.id)&&(t.push(i.id),e.delete(i.id))}),t.push(...e),t}),this.detailColumns$=(0,eK.EW)(()=>this.columnsWithoutFilter$.value.filter(e=>"title"!==this.columnGetType(e))),this.filter$=(0,eK.EW)(()=>this.viewData$.value?.filter??tR.hh),this.header$=(0,eK.EW)(()=>this.viewData$.value?.header??{titleColumn:this.columnsWithoutFilter$.value.find(e=>"title"===this.columnGetType(e)),iconColumn:"type"}),this.readonly$=(0,eK.EW)(()=>this.viewManager.readonly$.value)}addCard(e,t){let i=this.rowAdd(e);return this.groupHelper?.addToGroup(i,t),i}changeGroup(e){let t=this.columnGet(e);this.viewDataUpdate(e=>({groupBy:(0,tF.A)(this.columnGetMeta(t.type),t.id,t.data$.value)}))}checkGroup(e,t,i){return!!tm.H.isMatched(t,i)||(this.changeGroup(e),!1)}columnGet(e){return new tY(this,e)}columnGetHide(e){return this.view?.columns.find(t=>t.id===e)?.hide??!1}columnMove(e,t){this.viewDataUpdate(i=>{let s=i.columns.findIndex(t=>t.id===e);if(s<0)return{};let o=[...i.columns],[r]=o.splice(s,1),a=(0,tZ.q)(t,o);return o.splice(a,0,r),{columns:o}})}columnUpdateHide(e,t){this.viewDataUpdate(i=>({columns:i.columns.map(i=>i.id===e?{...i,hide:t}:i)}))}getHeaderCover(e){let t=this.view?.header.coverColumn;if(t)return this.columnGet(t)}getHeaderIcon(e){let t=this.view?.header.iconColumn;if(t)return this.columnGet(t)}getHeaderTitle(e){let t=this.view?.header.titleColumn;if(t)return this.columnGet(t)}hasHeader(e){let t=this.view?.header;return!!t&&(!!t.titleColumn||!!t.iconColumn||!!t.coverColumn)}isInHeader(e){let t=this.view?.header;return!!t&&(t.titleColumn===e||t.iconColumn===e||t.coverColumn===e)}isShow(e){if(this.filter$.value?.conditions.length){let t=Object.fromEntries(this.columnManagerList$.value.map(t=>[t.id,t.cellGet(e).jsonValue$.value]));return(0,tq.H)(this.filter$.value,t)}return!0}rowGetNext(e){let t=this.rows$.value.indexOf(e);return this.rows$.value[t+1]}rowGetPrev(e){let t=this.rows$.value.indexOf(e);return this.rows$.value[t-1]}rowMove(e,t){this.dataSource.rowMove(e,t)}updateFilter(e){this.viewDataUpdate(()=>({filter:e}))}get columns(){return this.columnsWithoutFilter$.value.filter(e=>!this.columnGetHide(e))}get columnsWithoutFilter(){let e=new Set(this.dataSource.properties$.value),t=[];return this.view?.columns.forEach(i=>{e.has(i.id)&&(t.push(i.id),e.delete(i.id))}),t.push(...e),t}get filter(){return this.view?.filter??tR.hh}get groupHelper(){let e=this.view?.groupBy;if(!e)return;let t=tm.H.find(t=>t.data.name===e.name);if(!t)return;let i=t.data,s=this.columnGetDataType(e.columnId);return s?this.checkGroup(e.columnId,t.type,s)?new tN.e(e,i,s,this,{sortGroup:e=>(0,tN.R)(e,e=>e,this.view?.groupProperties.map(e=>e.key)??[]),sortRow:(e,t)=>{let i=this.view?.groupProperties.find(t=>t.key===e);return(0,tN.R)(t,e=>e,i?.manuallyCardSort??[])},changeGroupSort:e=>{let t=new Map(this.view?.groupProperties.map(e=>[e.key,e]));this.viewDataUpdate(()=>({groupProperties:e.map(e=>t.get(e)||{key:e,hide:!1,manuallyCardSort:[]})}))},changeRowSort:(e,t,i)=>{let s=new Map(this.view?.groupProperties.map(e=>[e.key,e]));this.viewDataUpdate(()=>({groupProperties:e.map(e=>{if(e!==t)return s.get(e)??{key:e,hide:!1,manuallyCardSort:[]};{let t=s.get(e);return t?{...t,manuallyCardSort:i}:{key:e,hide:!1,manuallyCardSort:i}}})}))}}):this.groupHelper:void 0}get header(){return this.view?.header}get type(){return this.view?.mode??"kanban"}get view(){return this.viewData$.value}}class tY extends tU.Q{constructor(e,t){super(e,t)}}let tK=tz("kanban").modelConfig({defaultName:"Kanban View",dataViewManager:tG});var tX=i(81856),tQ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tJ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,r,a,n,l,c,d,h,u,p=(0,eK.Jb)((0,w.Tm)(w.ao)),f=[],g=[],m=[],v=[],y=[],b=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],P=[],H=[],A=[],L=[],D=[],Z=[];return class extends p{static{let w="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;e=[(0,o.MZ)({attribute:!1})],t=[(0,o.MZ)({attribute:!1})],i=[(0,o.MZ)({attribute:!1})],s=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],c=[(0,o.MZ)({attribute:!1})],d=[(0,o.MZ)({attribute:!1})],h=[(0,o.MZ)({attribute:!1})],u=[(0,o.MZ)({attribute:!1})],tQ(this,null,e,{kind:"accessor",name:"bindHotkey",static:!1,private:!1,access:{has:e=>"bindHotkey"in e,get:e=>e.bindHotkey,set:(e,t)=>{e.bindHotkey=t}},metadata:w},f,g),tQ(this,null,t,{kind:"accessor",name:"dataSource",static:!1,private:!1,access:{has:e=>"dataSource"in e,get:e=>e.dataSource,set:(e,t)=>{e.dataSource=t}},metadata:w},m,v),tQ(this,null,i,{kind:"accessor",name:"dataViewEle",static:!1,private:!1,access:{has:e=>"dataViewEle"in e,get:e=>e.dataViewEle,set:(e,t)=>{e.dataViewEle=t}},metadata:w},y,b),tQ(this,null,s,{kind:"accessor",name:"handleEvent",static:!1,private:!1,access:{has:e=>"handleEvent"in e,get:e=>e.handleEvent,set:(e,t)=>{e.handleEvent=t}},metadata:w},x,_),tQ(this,null,r,{kind:"accessor",name:"headerWidget",static:!1,private:!1,access:{has:e=>"headerWidget"in e,get:e=>e.headerWidget,set:(e,t)=>{e.headerWidget=t}},metadata:w},C,k),tQ(this,null,a,{kind:"accessor",name:"modalMode",static:!1,private:!1,access:{has:e=>"modalMode"in e,get:e=>e.modalMode,set:(e,t)=>{e.modalMode=t}},metadata:w},S,M),tQ(this,null,n,{kind:"accessor",name:"onDrag",static:!1,private:!1,access:{has:e=>"onDrag"in e,get:e=>e.onDrag,set:(e,t)=>{e.onDrag=t}},metadata:w},E,I),tQ(this,null,l,{kind:"accessor",name:"selection$",static:!1,private:!1,access:{has:e=>"selection$"in e,get:e=>e.selection$,set:(e,t)=>{e.selection$=t}},metadata:w},B,$),tQ(this,null,c,{kind:"accessor",name:"setSelection",static:!1,private:!1,access:{has:e=>"setSelection"in e,get:e=>e.setSelection,set:(e,t)=>{e.setSelection=t}},metadata:w},T,O),tQ(this,null,d,{kind:"accessor",name:"std",static:!1,private:!1,access:{has:e=>"std"in e,get:e=>e.std,set:(e,t)=>{e.std=t}},metadata:w},P,H),tQ(this,null,h,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:w},A,L),tQ(this,null,u,{kind:"accessor",name:"viewSource",static:!1,private:!1,access:{has:e=>"viewSource"in e,get:e=>e.viewSource,set:(e,t)=>{e.viewSource=t}},metadata:w},D,Z),w&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:w})}#tp=tJ(this,f,void 0);get bindHotkey(){return this.#tp}set bindHotkey(e){this.#tp=e}#tf=(tJ(this,g),tJ(this,m,void 0));get dataSource(){return this.#tf}set dataSource(e){this.#tf=e}#tg=(tJ(this,v),tJ(this,y,void 0));get dataViewEle(){return this.#tg}set dataViewEle(e){this.#tg=e}#tm=(tJ(this,b),tJ(this,x,void 0));get handleEvent(){return this.#tm}set handleEvent(e){this.#tm=e}#tv=(tJ(this,_),tJ(this,C,void 0));get headerWidget(){return this.#tv}set headerWidget(e){this.#tv=e}#ty=(tJ(this,k),tJ(this,S,void 0));get modalMode(){return this.#ty}set modalMode(e){this.#ty=e}#tb=(tJ(this,M),tJ(this,E,void 0));get onDrag(){return this.#tb}set onDrag(e){this.#tb=e}#tw=(tJ(this,I),tJ(this,B,void 0));get selection$(){return this.#tw}set selection$(e){this.#tw=e}#tx=(tJ(this,$),tJ(this,T,void 0));get setSelection(){return this.#tx}set setSelection(e){this.#tx=e}#u=(tJ(this,O),tJ(this,P,void 0));get std(){return this.#u}set std(e){this.#u=e}#tt=(tJ(this,H),tJ(this,A,void 0));get view(){return this.#tt}set view(e){this.#tt=e}#t_=(tJ(this,L),tJ(this,D,void 0));get viewSource(){return this.#t_}set viewSource(e){this.#t_=e}constructor(){super(...arguments),tJ(this,Z)}}})();class t0{constructor(e){this.host=e,this._onCopy=(e,t)=>!0,this._onPaste=e=>!0,e.addController(this)}get readonly(){return this.host.view.readonly$.value}hostConnected(){this.host.disposables.add(this.host.handleEvent("copy",e=>{let t=this.host.selectionController.selection;return!!t&&(this._onCopy(e,t),!0)})),this.host.disposables.add(this.host.handleEvent("paste",e=>!this.readonly&&(this._onPaste(e),!0)))}}var t2=i(46427),t5=i(60019);let t7=e=>{let t=0,i=0,s=()=>{t=requestAnimationFrame(t=>{try{e(t-i)}finally{i=t,s()}})};return s(),()=>{cancelAnimationFrame(t)}},t3=1/16,t4=1/8,t6=(e,t)=>{let{vertical:i=!1,horizontal:s=!0,boundary:o}=t??{},{left:r=20,right:a=20,top:n=20,bottom:l=20}="number"==typeof o?{left:o,right:o,top:o,bottom:o}:o??{left:20,right:20,top:20,bottom:20},c={x:0,y:0},d=e=>{c.x=e.clientX,c.y=e.clientY};document.addEventListener("mousemove",d);let h=t7(o=>{let d=e.getBoundingClientRect(),{x:h,y:u}=c;if(s){let t=d.left+r,i=d.right-a;hi&&(e.scrollLeft+=((h-i)*t4+1)*o*t3)}if(i){let t=d.top+n,i=d.bottom-l;ui&&(e.scrollTop+=((h-i)*t4+1)*o*t3)}t?.onScroll?.()});return()=>{h(),document.removeEventListener("mousemove",d)}},t8=(e,t,i)=>{let s=i.selection;i.selection=void 0,e.openDetailPanel({view:i.view,rowId:t,onClose:()=>{i.selection=s}})},t9=(e,t,i,o)=>{(0,e1.$E)(t,[{type:"action",name:"Expand Card",icon:Y.JmJ,select:()=>{t8(e,i,o)}},{type:"sub-menu",name:"Move To",icon:Y.zII,options:{input:{search:!0},items:o.view.groupHelper?.groups.filter(e=>{let t=o.selection;return t?.selectionType==="card"&&e.key!==t?.cards[0].groupKey}).map(e=>({type:"action",name:null!=e.value?e.name:"Ungroup",select:()=>{o.moveCard(i,e.key)}}))??[]}},{type:"group",name:"",children:()=>[{type:"action",name:"Insert Before",icon:(0,s.qy)`
${Y.aiU}
`,select:()=>{o.insertRowBefore()}},{type:"action",name:"Insert After",icon:(0,s.qy)`
${Y.hhC}
`,select:()=>{o.insertRowAfter()}}]},{type:"group",name:"",children:()=>[{type:"action",name:"Delete Card",class:"delete-item",icon:e0.DeleteIcon,select:()=>{o.deleteCard()}}]}])};var ie=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},it=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,r,a,n,l=[(0,o.EM)("affine-data-view-kanban-card")],c=[],d=(0,w.Tm)(w.ao),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],x=[];return class extends d{static{t=this}static{let w="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],s=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.wk)()],n=[(0,o.MZ)({attribute:!1})],ie(this,null,i,{kind:"accessor",name:"cardId",static:!1,private:!1,access:{has:e=>"cardId"in e,get:e=>e.cardId,set:(e,t)=>{e.cardId=t}},metadata:w},h,u),ie(this,null,s,{kind:"accessor",name:"dataViewEle",static:!1,private:!1,access:{has:e=>"dataViewEle"in e,get:e=>e.dataViewEle,set:(e,t)=>{e.dataViewEle=t}},metadata:w},p,f),ie(this,null,r,{kind:"accessor",name:"groupKey",static:!1,private:!1,access:{has:e=>"groupKey"in e,get:e=>e.groupKey,set:(e,t)=>{e.groupKey=t}},metadata:w},g,m),ie(this,null,a,{kind:"accessor",name:"isFocus",static:!1,private:!1,access:{has:e=>"isFocus"in e,get:e=>e.isFocus,set:(e,t)=>{e.isFocus=t}},metadata:w},v,y),ie(this,null,n,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:w},b,x),ie(null,e={value:t},l,{kind:"class",name:t.name,metadata:w},null,c),t=e.value,w&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:w})}static{this.styles=ii}getSelection(){return this.closest("affine-data-view-kanban")?.selectionController}renderBody(e){return 0===e.length?"":(0,G.qy)`
${(0,el.u)(e,e=>e.id,e=>this.view.isInHeader(e.id)?"":(0,G.qy)` `)}
`}renderHeader(e){if(!this.view.hasHeader(this.cardId))return"";let t=(0,k.H)({"card-header":!0,"has-divider":e.length>0});return(0,G.qy)`
${this.renderTitle()} ${this.renderIcon()}
`}renderIcon(){let e=this.view.getHeaderIcon(this.cardId);if(e)return(0,G.qy)`
${e.cellGet(this.cardId).value$.value}
`}renderOps(){if(!this.view.readonly$.value)return(0,G.qy)`
${e0.CenterPeekIcon}
${e0.MoreHorizontalIcon}
`}renderTitle(){let e=this.view.getHeaderTitle(this.cardId);if(e)return(0,G.qy)`
`}connectedCallback(){super.connectedCallback(),this.view.readonly$.value||(this._disposables.addFromEvent(this,"contextmenu",e=>{this.contextMenu(e)}),this._disposables.addFromEvent(this,"click",e=>{if(e.shiftKey){this.getSelection()?.shiftClickCard(e);return}let t=this.getSelection(),i=t?.selection;i?.selectionType==="card"&&(t&&(t.selection=void 0),this.dataViewEle.openDetailPanel({view:this.view,rowId:this.cardId,onClose:()=>{t&&(t.selection=i)}}))}))}render(){let e=this.view.columnManagerList$.value.filter(e=>!this.view.isInHeader(e.id));return this.style.border=this.isFocus?"1px solid var(--affine-primary-color)":"",(0,G.qy)` ${this.renderHeader(e)} ${this.renderBody(e)} ${this.renderOps()} `}#ti;get cardId(){return this.#ti}set cardId(e){this.#ti=e}#tg;get dataViewEle(){return this.#tg}set dataViewEle(e){this.#tg=e}#to;get groupKey(){return this.#to}set groupKey(e){this.#to=e}#e9;get isFocus(){return this.#e9}set isFocus(e){this.#e9=e}#tt;get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),this.clickEdit=e=>{e.stopPropagation();let t=this.getSelection();t&&t8(this.dataViewEle,this.cardId,t)},this.clickMore=e=>{e.stopPropagation();let t=this.getSelection(),i=e.currentTarget;t&&(t.selection={selectionType:"card",cards:[{groupKey:this.groupKey,cardId:this.cardId}]},t9(this.dataViewEle,i,this.cardId,t))},this.contextMenu=e=>{e.stopPropagation(),e.preventDefault();let t=this.getSelection();if(t){t.selection={selectionType:"card",cards:[{groupKey:this.groupKey,cardId:this.cardId}]};let i=e.target.closest("affine-data-view-kanban-cell")??this;t9(this.dataViewEle,i,this.cardId,t)}},this.#ti=it(this,h,void 0),this.#tg=(it(this,u),it(this,p,void 0)),this.#to=(it(this,f),it(this,g,void 0)),this.#e9=(it(this,m),it(this,v,!1)),this.#tt=(it(this,y),it(this,b,void 0)),it(this,x)}static{it(t,c)}},t})();function io(e,t){let i=e.helper.groupConfig();if(!i)return s.s6;let o=null==e.value?"":(0,G.qy)` `,r={value:e.value,data:e.helper.data,updateData:e.helper.updateData,updateValue:t=>e.helper.updateValue(e.rows,t),readonly:t.readonly};return(0,G.qy)`
${o} ${(0,e2.ep)(i.view,r)} ${function(e){let t=e.rows;if(t.length)return(0,G.qy)`
${t.length}
`}(e)}
${t.readonly?s.s6:(0,G.qy)`
${e0.PlusIcon}
${e0.MoreHorizontalIcon}
`} `}var ir=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ia=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n=[(0,o.EM)("affine-data-view-kanban-group")],l=[],c=(0,w.Tm)(w.ao),d=[],h=[],u=[],p=[],f=[],g=[];return class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],ir(this,null,i,{kind:"accessor",name:"dataViewEle",static:!1,private:!1,access:{has:e=>"dataViewEle"in e,get:e=>e.dataViewEle,set:(e,t)=>{e.dataViewEle=t}},metadata:s},d,h),ir(this,null,r,{kind:"accessor",name:"group",static:!1,private:!1,access:{has:e=>"group"in e,get:e=>e.group,set:(e,t)=>{e.group=t}},metadata:s},u,p),ir(this,null,a,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:s},f,g),ir(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=il}render(){let e=this.group.rows;return(0,G.qy)`
${io(this.group,{readonly:this.view.readonly$.value,clickAdd:this.clickAddCardInStart,clickOps:this.clickGroupOptions})}
${(0,el.u)(e,e=>e,e=>(0,G.qy)` `)} ${this.view.readonly$.value?s.s6:(0,G.qy)`
${Y.N7w}
Add
`}
`}#tg;get dataViewEle(){return this.#tg}set dataViewEle(e){this.#tg=e}#tC;get group(){return this.#tC}set group(e){this.#tC=e}#tt;get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),this.clickAddCard=()=>{let e=this.view.addCard("end",this.group.key);requestAnimationFrame(()=>{let t=this.closest("affine-data-view-kanban");t&&(t.selectionController.selection={selectionType:"cell",groupKey:this.group.key,cardId:e,columnId:this.view.header$.value.titleColumn||this.view.columns$.value[0],isEditing:!0})})},this.clickAddCardInStart=()=>{let e=this.view.addCard("start",this.group.key);requestAnimationFrame(()=>{let t=this.closest("affine-data-view-kanban");t&&(t.selectionController.selection={selectionType:"cell",groupKey:this.group.key,cardId:e,columnId:this.view.header$.value.titleColumn||this.view.columns$.value[0],isEditing:!0})})},this.clickGroupOptions=e=>{let t=e.currentTarget;(0,e1.$E)(t,[{type:"action",name:"Ungroup",hide:()=>null==this.group.value,select:()=>{this.group.rows.forEach(e=>{this.group.helper.removeFromGroup(e,this.group.key)})}},{type:"action",name:"Delete Cards",select:()=>{this.view.rowDelete(this.group.rows)}}])},this.#tg=ia(this,d,void 0),this.#tC=(ia(this,h),ia(this,u,void 0)),this.#tt=(ia(this,p),ia(this,f,void 0)),ia(this,g)}static{ia(t,l)}},t})();class id{constructor(e){this.host=e,this.dragStart=(e,t)=>{let i=e.getBoundingClientRect(),s=t.x-i.left,o=t.y-i.top,r=ih(e,t.x-s,t.y-o),a=e.closest("affine-data-view-kanban-group"),n=t6(this.scrollContainer);eE(t,{onDrag:()=>void 0,onMove:t=>{if(!(t.target instanceof HTMLElement))return;if(r.display(t.x-s,t.y-o),!t5.rw.fromDOM(this.host).isPointIn(t2.b.from(t))){let i=this.host.onDrag;return i?(this.dropPreview.remove(),{type:"out",callback:i(t,e.cardId)}):void 0}let i=this.shooIndicator(t,e);if(i)return{type:"self",key:i.group.group.key,position:i.position}},onClear:()=>{r.remove(),this.dropPreview.remove(),n()},onDrop:t=>{if(t){if("out"===t.type){t.callback();return}t&&a&&a.group.helper.moveCardTo(e.cardId,a.group.key,t.key,t.position)}}})},this.dropPreview=iu(),this.getInsertPosition=e=>{let t=document.elementsFromPoint(e.x,e.y).find(e=>e instanceof ic);if(t){let i=ip(t,e.y);return{group:t,card:i,position:i?{before:!0,id:i.cardId}:"end"}}},this.shooIndicator=(e,t)=>{let i=this.getInsertPosition(e);return i?this.dropPreview.display(i.group,t,i.card):this.dropPreview.remove(),i},this.host.addController(this)}hostConnected(){this.host.view.readonly$.value||this.host.disposables.add(this.host.handleEvent("dragStart",e=>{let t=e.get("pointerState").raw,i=t.target;if(i instanceof Element){let e=i.closest("affine-data-view-kanban-cell");if(e?.editing)return;e?.selectCurrentCell(!1);let s=i.closest("affine-data-view-kanban-card");s&&this.dragStart(s,t)}return!0}))}get scrollContainer(){let e=this.host.querySelector(".affine-data-view-kanban-groups");return(0,W.Z1)(e),e}}let ih=(e,t,i)=>{let s=e.style.opacity;e.style.opacity="0.5";let o=document.createElement("div"),r=new is;return r.cardId=e.cardId,r.view=e.view,r.isFocus=!0,r.style.backgroundColor="var(--affine-background-primary-color)",o.append(r),o.className="with-data-view-css-variable",o.style.width=`${e.getBoundingClientRect().width}px`,o.style.position="fixed",o.style.transform="rotate(-3deg)",o.style.left=`${t}px`,o.style.top=`${i}px`,o.style.zIndex="9999",document.body.append(o),{display(e,t){o.style.left=`${Math.round(e)}px`,o.style.top=`${Math.round(t)}px`},remove(){e.style.opacity=s,o.remove()}}},iu=()=>{let e=document.createElement("div");return e.style.height="2px",e.style.borderRadius="1px",e.style.backgroundColor="var(--affine-primary-color)",e.style.boxShadow="0px 0px 8px 0px rgba(30, 150, 235, 0.35)",{display(t,i,s){let o=s??t.querySelector(".add-card");if((0,W.Z1)(o),o.previousElementSibling===i||o===i){e.remove();return}o.previousElementSibling!==e&&o.insertAdjacentElement("beforebegin",e)},remove(){e.remove()}}},ip=(e,t)=>{let i=Array.from(e.querySelectorAll("affine-data-view-kanban-card")),s=i.map(e=>{let t=e.getBoundingClientRect();return(t.top+t.bottom)/2}).findIndex(e=>e>t);return i[s]};class ig{constructor(e){this.host=e,this.host.addController(this)}get hasSelection(){return!!this.host.selectionController.selection}hostConnected(){this.host.disposables.add(this.host.bindHotkey({Escape:()=>(this.host.selectionController.focusOut(),!0),Enter:()=>{this.host.selectionController.focusIn()},ArrowUp:e=>!!this.hasSelection&&(this.host.selectionController.focusNext("up"),e.get("keyboardState").raw.preventDefault(),!0),ArrowDown:e=>!!this.hasSelection&&(this.host.selectionController.focusNext("down"),e.get("keyboardState").raw.preventDefault(),!0),Tab:e=>!!this.hasSelection&&(this.host.selectionController.focusNext("down"),e.get("keyboardState").raw.preventDefault(),!0),ArrowLeft:e=>!!this.hasSelection&&(this.host.selectionController.focusNext("left"),e.get("keyboardState").raw.preventDefault(),!0),ArrowRight:e=>!!this.hasSelection&&(this.host.selectionController.focusNext("right"),e.get("keyboardState").raw.preventDefault(),!0),Backspace:()=>{this.host.selectionController.deleteCard()}}))}}class im{constructor(e){this.host=e,this.shiftClickCard=e=>{e.preventDefault();let t=this.selection,i=e.target,s=i.closest("affine-data-view-kanban-card")?.cardId,o=i.closest("affine-data-view-kanban-group")?.group.key;if(!s||!o)return;let r=t?.selectionType==="card"?t.cards:[],a=r.some(e=>e.cardId===s)?r.filter(e=>e.cardId!==s):[...r,{cardId:s,groupKey:o}];this.selection=ik(a)?{selectionType:"card",cards:a}:void 0},this.host.addController(this)}blur(e){if("cell"!==e.selectionType){ix(this.host,e).forEach(e=>e.isFocus=!1);return}let t=i_(this.host,e);if(!t)return;t.isFocus=!1;let i=t?.cell;e.isEditing?(requestAnimationFrame(()=>{i?.onExitEditMode()}),i?.blurCell()&&t.blur(),t.editing=!1):t.blur()}deleteCard(){let e=this.selection;e&&"cell"!==e.selectionType&&"card"===e.selectionType&&(this.host.view.rowDelete(e.cards.map(e=>e.cardId)),this.selection=void 0)}focus(e){if("cell"!==e.selectionType){ix(this.host,e).forEach((e,t)=>{0===t&&e.scrollIntoView({block:"nearest",inline:"nearest"}),e.isFocus=!0});return}let t=i_(this.host,e);if(!t)return;t.scrollIntoView({block:"nearest",inline:"nearest"}),t.isFocus=!0;let i=t?.cell;e.isEditing?(i?.onEnterEditMode(),i?.focusCell()&&t.focus(),t.editing=!0):t.focus()}focusFirstCell(){let e=this.host.groupHelper?.groups[0],t=e?.rows[0],i=t&&this.host.view.getHeaderTitle(t)?.id;e&&t&&i&&(this.selection={selectionType:"cell",groupKey:e.key,cardId:t,columnId:i,isEditing:!1})}focusIn(){let e=this.selection;if(e&&("cell"!==e.selectionType||!e.isEditing)){if("cell"===e.selectionType){this.selection={...e,isEditing:!0};return}if("card"===e.selectionType){let t=ix(this.host,e)[0],i=t?.querySelector("affine-data-view-kanban-cell");i&&(this.selection={groupKey:t.groupKey,cardId:t.cardId,selectionType:"cell",columnId:i.column.id,isEditing:!1})}}}focusNext(e){let t=this.selection;if(t){if("cell"!==t.selectionType||t.isEditing){if("card"===t.selectionType){let i=this.host.querySelector(`affine-data-view-kanban-group[data-key="${t.cards[0].groupKey}"]`),s=Array.from(i?.querySelectorAll("affine-data-view-kanban-card")??[]).findIndex(e=>e.cardId===t.cards[0].cardId),{card:o,cards:r}=this.getNextFocusCard(t,s,e);if(o instanceof is){let e=r??t.cards;this.selection=ik(e)?{...t,cards:e}:void 0}}}else{let i=ib(this.host,t).findIndex(e=>e.column.id===t.columnId),{cell:s,cardId:o,groupKey:r}=this.getNextFocusCell(t,i,e);s instanceof ti&&(this.selection={...t,cardId:o??t.cardId,groupKey:r??t.groupKey,columnId:s.column.id})}}}focusOut(){let e=this.selection;if(e?.selectionType==="card"){if(!ik(e.cards))return;this.selection={...e,cards:[e.cards[0]]}}e?.selectionType==="cell"&&(e.isEditing?this.selection={...e,isEditing:!1}:this.selection={selectionType:"card",cards:[{cardId:e.cardId,groupKey:e.groupKey}]})}getNextFocusCard(e,t,i){let s=this.host.querySelector(`affine-data-view-kanban-group[data-key="${e.cards[0].groupKey}"]`),o=Array.from(s?.querySelectorAll("affine-data-view-kanban-card")??[]);if("up"===i){let e=t-1,i=e<0?o.length-1:e,s=o[i];return{card:s,cards:[{cardId:s.cardId,groupKey:s.groupKey}]}}if("down"===i){let e=t+1,i=e>o.length-1?0:e,s=o[i];return{card:s,cards:[{cardId:s.cardId,groupKey:s.groupKey}]}}let r=Array.from(this.host.querySelectorAll("affine-data-view-kanban-group"));if("right"===i)return iv(this.host,r,e,e=>e===r.length-1?0:e+1);if("left"===i)return iv(this.host,r,e,e=>0===e?r.length-1:e-1);throw new tj.Ss(tV.O.DatabaseBlockError,"Unknown arrow keys, only support: up, down, left, and right keys.")}getNextFocusCell(e,t,i){let s=ib(this.host,e),o=this.host.querySelector(`affine-data-view-kanban-group[data-key="${e.groupKey}"]`),r=Array.from(o?.querySelectorAll("affine-data-view-kanban-card")??[]);if("up"===i){let o=t-1;return o<0?r.length>1?iy(i,r,e,e=>0===e?r.length-1:e-1):{cell:s[s.length-1]}:{cell:s[o]}}if("down"===i){let o=t+1;return o>=s.length?r.length>1?iy(i,r,e,e=>e===r.length-1?0:e+1):{cell:s[0]}:{cell:s[o]}}let a=Array.from(this.host.querySelectorAll("affine-data-view-kanban-group"));if("right"===i)return iv(this.host,a,e,e=>e===a.length-1?0:e+1);if("left"===i)return iv(this.host,a,e,e=>0===e?a.length-1:e-1);throw new tj.Ss(tV.O.DatabaseBlockError,"Unknown arrow keys, only support: up, down, left, and right keys.")}hostConnected(){this.host.disposables.add(this.host.selection$.subscribe(e=>{let t=this._selection;t&&this.blur(t),this._selection=e,e&&this.focus(e)}))}insertRowAfter(){let e=this.selection;if(e?.selectionType!=="card")return;let{cardId:t,groupKey:i}=e.cards[0],s=this.view.addCard({before:!1,id:t},i);requestAnimationFrame(()=>{let e=this.view.header$.value.titleColumn;e?this.selection={selectionType:"cell",groupKey:i,cardId:s,columnId:e,isEditing:!0}:this.selection={selectionType:"card",cards:[{cardId:s,groupKey:i}]}})}insertRowBefore(){let e=this.selection;if(e?.selectionType!=="card")return;let{cardId:t,groupKey:i}=e.cards[0],s=this.view.addCard({before:!0,id:t},i);requestAnimationFrame(()=>{let e=this.view.header$.value.titleColumn;e?this.selection={selectionType:"cell",groupKey:i,cardId:s,columnId:e,isEditing:!0}:this.selection={selectionType:"card",cards:[{cardId:s,groupKey:i}]}})}moveCard(e,t){let i=this.selection;i?.selectionType==="card"&&(this.view.groupHelper?.moveCardTo(e,i.cards[0].groupKey,t,"start"),requestAnimationFrame(()=>{if(this.selection?.selectionType!=="card")return;let e=i.cards.map(e=>({...e,groupKey:e.groupKey}));this.selection=ik(e)?{...i,cards:e}:void 0}))}get selection(){return this._selection}set selection(e){if(!e){this.host.setSelection();return}let t={...e,viewId:this.host.view.id,type:"kanban"};if("cell"===t.selectionType&&t.isEditing){let e=i_(this.host,t),i=e?.cell,s=!!i&&!!i.beforeEnterEditMode()&&t.isEditing;this.host.setSelection({...t,isEditing:s})}else this.host.setSelection(t)}get view(){return this.host.view}}function iv(e,t,i,s){let o=s(t.findIndex(e=>"cell"===i.selectionType?e.group.key===i.groupKey:e.group.key===i.cards[0].groupKey)),r=t[o];for(;0===r.group.rows.length;)r=t[o=s(o)];let a="cell"===i.selectionType?i_(e,i):ix(e,i)[0];(0,W.Z1)(a);let n=a.getBoundingClientRect(),l=Array.from(r.querySelectorAll("affine-data-view-kanban-card")),c=l.map((e,t)=>({offsetY:iC(n,e.getBoundingClientRect()),index:t})).reduce((e,t)=>e.offsetY({offsetY:iC(n,e.getBoundingClientRect()),index:t})).reduce((e,t)=>e.offsetYe.cardId===i.cardId)),r=t[o],a=Array.from(r.querySelectorAll("affine-data-view-kanban-cell")),n="up"===e?a.length-1:0;return{cell:a[n],cardId:r.cardId}}function ib(e,t){let i=iw(e,t);return Array.from(i?.querySelectorAll("affine-data-view-kanban-cell")??[])}function iw(e,t){let i=e.querySelector(`affine-data-view-kanban-group[data-key="${t.groupKey}"]`);return i?i.querySelector(`affine-data-view-kanban-card[data-card-id="${t.cardId}"]`):null}function ix(e,t){if("group"===t.selectionType)return[];let i=t.cards.map(e=>e.groupKey).map(t=>e.querySelector(`affine-data-view-kanban-group[data-key="${t}"]`)).filter(e=>null!==e),s=t.cards.map(e=>e.cardId);return i.flatMap(e=>s.map(t=>e.querySelector(`affine-data-view-kanban-card[data-card-id="${t}"]`))).filter(e=>null!==e)}function i_(e,t){let i=iw(e,t);return i?.querySelector(`affine-data-view-kanban-cell[data-column-id="${t.columnId}"]`)}function iC(e,t){return Math.abs(e.top+(e.bottom-e.top)/2-(t.top+(t.bottom-t.top)/2))}let ik=e=>e.length>0;var iS=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},iM=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-data-view-kanban-header")],s=[],r=(0,w.Tm)(w.ao),a=[],n=[];(class extends r{static{t=this}static{let l="function"==typeof Symbol&&Symbol.metadata?Object.create(r[Symbol.metadata]??null):void 0;iS(this,null,[(0,o.MZ)({attribute:!1})],{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:l},a,n),iS(null,e={value:t},i,{kind:"class",name:t.name,metadata:l},null,s),t=e.value,l&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:l})}static{this.styles=iE}render(){return(0,G.qy)`
Group
`}#tt;get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),this.clickGroup=e=>{(0,e1.zs)(e.target,{options:{input:{search:!0},items:this.view.columnManagerList$.value.filter(e=>e.id!==this.view.view?.groupBy?.columnId).map(e=>({type:"action",name:e.name,select:()=>{this.view.changeGroup(e.id)}}))}})},this.#tt=iM(this,a,void 0),iM(this,n)}static{iM(t,s)}})})();var iI=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},iB=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-data-view-kanban")],s=[],r=t1,a=[],n=[];return class extends r{static{t=this}static{let l="function"==typeof Symbol&&Symbol.metadata?Object.create(r[Symbol.metadata]??null):void 0;iI(this,null,[(0,o.P)(".affine-data-view-kanban-groups")],{kind:"accessor",name:"groups",static:!1,private:!1,access:{has:e=>"groups"in e,get:e=>e.groups,set:(e,t)=>{e.groups=t}},metadata:l},a,n),iI(null,e={value:t},i,{kind:"class",name:t.name,metadata:l},null,s),t=e.value,l&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:l})}static{this.styles=i$}firstUpdated(){let e=tX.Ay.create(this.groups,{group:`kanban-group-drag-${this.view.id}`,handle:".group-header",draggable:"affine-data-view-kanban-group",animation:100,onEnd:e=>{if(e.item instanceof ic){let t=Array.from(this.groups.querySelectorAll("affine-data-view-kanban-group")),i=null!=e.newIndex?t[e.newIndex-1]?.group.key:void 0;this.groupHelper?.moveGroupTo(e.item.group.key,i?{before:!1,id:i}:"start")}}});this._disposables.add({dispose:()=>{e.destroy()}})}focusFirstCell(){this.selectionController.focusFirstCell()}getSelection(){return this.selectionController.selection}hideIndicator(){this.dragController.dropPreview.remove()}moveTo(e,t){let i=this.dragController.getInsertPosition(t);i&&i.group.group.helper.moveCardTo(e,"",i.group.group.key,i.position)}render(){this.groupHelper=this.view.groupHelper;let e=this.groupHelper?.groups;return e?(0,G.qy)` ${(0,e2.ep)(this.headerWidget,{view:this.view,viewMethods:this})}
${(0,el.u)(e,e=>e.key,e=>(0,G.qy)` `)} ${this.renderAddGroup()}
`:(0,G.qy)``}showIndicator(e){return null!=this.dragController.shooIndicator(e,void 0)}#M;get groups(){return this.#M}set groups(e){this.#M=e}constructor(){super(...arguments),this.dragController=new id(this),this.clipboardController=new t0(this),this.hotkeysController=new ig(this),this.onWheel=e=>{if(e.metaKey||e.ctrlKey)return;let t=e.currentTarget;if(t instanceof HTMLElement){if(t.scrollWidth===t.clientWidth)return;e.stopPropagation()}},this.renderAddGroup=()=>{let e=this.groupHelper?.addGroup;if(e)return(0,G.qy)`
${Y.N7w}
`},this.selectionController=new im(this),this.#M=iB(this,a,void 0),iB(this,n)}static{iB(t,s)}},t})(),iO=tK.rendererConfig({icon:(0,a.w)("DatabaseKanbanViewIcon"),view:(0,e5.Z4)(iT)});var iP=i(57178);let iH=tz("table").modelConfig({defaultName:"Table View",dataViewManager:iP.u}),iA=e=>{let t=e.closest(".affine-database-table-container");return(0,W.Z1)(t),t},iL={equal:(e,t)=>null!=e&&null!=t&&e.id===t.id&&e.groupKey===t.groupKey},iD={rows:e=>e?.selectionType==="row"?e.rows:[],rowsIds:e=>iD.rows(e).map(e=>e.id),includes:(e,t)=>!!e&&iD.rows(e).some(e=>iL.equal(e,t)),create:e=>({selectionType:"row",rows:e.rows}),is:e=>e?.selectionType==="row"},iZ={create:e=>({...e,selectionType:"area",rowsSelection:e.rowsSelection??{start:e.focus.rowIndex,end:e.focus.rowIndex},columnsSelection:e.columnsSelection??{start:e.focus.columnIndex,end:e.focus.columnIndex}}),isFocus:e=>e.focus.rowIndex===e.rowsSelection.start&&e.focus.rowIndex===e.rowsSelection.end&&e.focus.columnIndex===e.columnsSelection.start&&e.focus.columnIndex===e.columnsSelection.end};var ij=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},iV=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c,d,h=[(0,o.EM)("affine-database-cell-container")],u=[],p=(0,eK.Jb)((0,w.Tm)(w.ao)),f=[],g=[],m=[],v=[],y=[],b=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[];(class extends p{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.wk)()],l=[(0,o.MZ)({attribute:!1})],c=[(0,o.MZ)({attribute:!1})],d=[(0,o.MZ)({attribute:!1})],ij(this,null,i,{kind:"accessor",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:s},f,g),ij(this,null,r,{kind:"accessor",name:"columnId",static:!1,private:!1,access:{has:e=>"columnId"in e,get:e=>e.columnId,set:(e,t)=>{e.columnId=t}},metadata:s},m,v),ij(this,null,a,{kind:"accessor",name:"columnIndex",static:!1,private:!1,access:{has:e=>"columnIndex"in e,get:e=>e.columnIndex,set:(e,t)=>{e.columnIndex=t}},metadata:s},y,b),ij(this,null,n,{kind:"accessor",name:"isEditing",static:!1,private:!1,access:{has:e=>"isEditing"in e,get:e=>e.isEditing,set:(e,t)=>{e.isEditing=t}},metadata:s},x,_),ij(this,null,l,{kind:"accessor",name:"rowId",static:!1,private:!1,access:{has:e=>"rowId"in e,get:e=>e.rowId,set:(e,t)=>{e.rowId=t}},metadata:s},C,k),ij(this,null,c,{kind:"accessor",name:"rowIndex",static:!1,private:!1,access:{has:e=>"rowIndex"in e,get:e=>e.rowIndex,set:(e,t)=>{e.rowIndex=t}},metadata:s},S,M),ij(this,null,d,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:s},E,I),ij(null,e={value:t},h,{kind:"class",name:t.name,metadata:s},null,u),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-database-cell-container { display: flex; align-items: start; width: 100%; height: 100%; border: none; outline: none; } affine-database-cell-container * { box-sizing: border-box; } affine-database-cell-container uni-lit > *:first-child { padding: 8px; } `}get groupKey(){return this.closest("affine-data-view-table-group")?.group?.key}get readonly(){return this.column.readonly$.value}get selectionView(){return this.closest("affine-database-table")?.selectionController}connectedCallback(){super.connectedCallback(),this._disposables.addFromEvent(this,"click",()=>{this.isEditing||this.selectCurrentCell(!this.column.readonly$.value)})}isSelected(e){return"area"===e.selectionType&&(e.groupKey===this.groupKey&&e.focus.columnIndex===this.columnIndex?e.focus.rowIndex===this.rowIndex:void 0)}render(){let e=this.column.renderer$.value;if(!e)return;let{edit:t,view:i}=e,s=!this.readonly&&this.isEditing&&null!=t?t:i,o={cell:this.cell$.value,isEditing:this.isEditing,selectCurrentCell:this.selectCurrentCell};return(0,e5.ep)(s,o,{ref:this._cell,style:{display:"contents"}})}get cell(){return this._cell.value}get table(){let e=this.closest("affine-database-table");return(0,W.Z1)(e),e}#e6;get column(){return this.#e6}set column(e){this.#e6=e}#tk;get columnId(){return this.#tk}set columnId(e){this.#tk=e}#tS;get columnIndex(){return this.#tS}set columnIndex(e){this.#tS=e}#eZ;get isEditing(){return this.#eZ}set isEditing(e){this.#eZ=e}#te;get rowId(){return this.#te}set rowId(e){this.#te=e}#tM;get rowIndex(){return this.#tM}set rowIndex(e){this.#tM=e}#tt;get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),this._cell=(0,eQ._)(),this.cell$=(0,eK.EW)(()=>this.column.cellGet(this.rowId)),this.selectCurrentCell=e=>{if(this.view.readonly$.value)return;let t=this.selectionView;if(t){let i=t.selection;i&&this.isSelected(i)&&e?t.selection=iZ.create({groupKey:this.groupKey,focus:{rowIndex:this.rowIndex,columnIndex:this.columnIndex},isEditing:!0}):t.selection=iZ.create({groupKey:this.groupKey,focus:{rowIndex:this.rowIndex,columnIndex:this.columnIndex},isEditing:!1})}},this.#e6=iV(this,f,void 0),this.#tk=(iV(this,g),iV(this,m,void 0)),this.#tS=(iV(this,v),iV(this,y,void 0)),this.#eZ=(iV(this,b),iV(this,x,!1)),this.#te=(iV(this,_),iV(this,C,void 0)),this.#tM=(iV(this,k),iV(this,S,void 0)),this.#tt=(iV(this,M),iV(this,E,void 0)),iV(this,I)}static{iV(t,u)}})})();var iz=i(28103);let iR=[{type:"number",label:"Number",symbol:"#"},{type:"numberWithCommas",label:"Number With Commas",symbol:"#"},{type:"percent",label:"Percent",symbol:"%"},{type:"currencyYen",label:"Japanese Yen",symbol:"¥"},{type:"currencyCNY",label:"Chinese Yuan",symbol:"¥"},{type:"currencyINR",label:"Indian Rupee",symbol:"₹"},{type:"currencyUSD",label:"US Dollar",symbol:"$"},{type:"currencyEUR",label:"Euro",symbol:"€"},{type:"currencyGBP",label:"British Pound",symbol:"£"}],iF=(e,t,i)=>Math.max(t,Math.min(i,e));var iN=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},iq=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n=[(0,o.EM)("affine-data-view-column-preview")],l=[],c=(0,w.Tm)(w.ao),d=[],h=[],u=[],p=[],f=[],g=[];return class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],iN(this,null,i,{kind:"accessor",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:s},d,h),iN(this,null,r,{kind:"accessor",name:"table",static:!1,private:!1,access:{has:e=>"table"in e,get:e=>e.table,set:(e,t)=>{e.table=t}},metadata:s},u,p),iN(this,null,a,{kind:"accessor",name:"tableViewManager",static:!1,private:!1,access:{has:e=>"tableViewManager"in e,get:e=>e.tableViewManager,set:(e,t)=>{e.tableViewManager=t}},metadata:s},f,g),iN(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-data-view-column-preview { pointer-events: none; display: block; } `}renderGroup(e){let t=this.tableViewManager.columnGetIndex(this.column.id);return(0,G.qy)`
${(0,el.u)(e,(e,i)=>{let s=this.table.querySelector(`affine-database-cell-container[data-row-id="${e}"]`)?.clientHeight,o=(0,S.W)({height:s+"px"});return(0,G.qy)`
`})}
`}render(){let e=this.tableViewManager.groupHelper;if(!e){let e=this.tableViewManager.rows$.value;return this.renderGroup(e)}return e.groups.map(e=>(0,G.qy)`
${this.renderGroup(e.rows)} `)}#e6=iq(this,d,void 0);get column(){return this.#e6}set column(e){this.#e6=e}#tE=(iq(this,h),iq(this,u,void 0));get table(){return this.#tE}set table(e){this.#tE=e}#tI=(iq(this,p),iq(this,f,void 0));get tableViewManager(){return this.#tI}set tableViewManager(e){this.#tI=e}constructor(){super(...arguments),iq(this,g)}static{iq(t,l)}},t})();var iW=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},iG=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-number-format-bar")],r=[],a=(0,w.Tm)(s.WF),n=[],l=[];(class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;iW(this,null,[(0,o.MZ)({attribute:!1})],{kind:"accessor",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:s},n,l),iW(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .number-format-toolbar-container { padding: 4px 12px; display: flex; gap: 7px; flex-direction: column; } .number-format-decimal-places { display: flex; gap: 4px; align-items: center; justify-content: flex-start; } .number-format-toolbar-button { box-sizing: border-box; background-color: transparent; border: none; border-radius: 4px; color: var(--affine-icon-color); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 4px; position: relative; user-select: none; } .number-format-toolbar-button svg { width: 16px; height: 16px; } .number-formatting-sample { font-size: var(--affine-font-xs); color: var(--affine-icon-color); margin-left: auto; } .number-format-toolbar-button:hover { background-color: var(--affine-hover-color); } .divider { width: 100%; height: 1px; background-color: var(--affine-border-color); } `}render(){return(0,s.qy)`
( ${ex(1,"number",this.column.data$.value.decimal??0)} )
`}#e6;get column(){return this.#e6}set column(e){this.#e6=e}constructor(){super(...arguments),this._decrementDecimalPlaces=()=>{this.column.updateData(e=>({decimal:Math.max((e.decimal??0)-1,0)})),this.requestUpdate()},this._incrementDecimalPlaces=()=>{this.column.updateData(e=>({decimal:Math.min((e.decimal??0)+1,8)})),this.requestUpdate()},this.#e6=iG(this,n,void 0),iG(this,l)}static{iG(t,r)}})})();var iY=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},iK=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c=[(0,o.EM)("data-view-table-vertical-indicator")],d=[],h=(0,w.Tm)(w.ao),u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],x=[],_=[];return class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],iY(this,null,i,{kind:"accessor",name:"left",static:!1,private:!1,access:{has:e=>"left"in e,get:e=>e.left,set:(e,t)=>{e.left=t}},metadata:s},u,p),iY(this,null,r,{kind:"accessor",name:"lines",static:!1,private:!1,access:{has:e=>"lines"in e,get:e=>e.lines,set:(e,t)=>{e.lines=t}},metadata:s},f,g),iY(this,null,a,{kind:"accessor",name:"shadow",static:!1,private:!1,access:{has:e=>"shadow"in e,get:e=>e.shadow,set:(e,t)=>{e.shadow=t}},metadata:s},m,v),iY(this,null,n,{kind:"accessor",name:"top",static:!1,private:!1,access:{has:e=>"top"in e,get:e=>e.top,set:(e,t)=>{e.top=t}},metadata:s},y,b),iY(this,null,l,{kind:"accessor",name:"width",static:!1,private:!1,access:{has:e=>"width"in e,get:e=>e.width,set:(e,t)=>{e.width=t}},metadata:s},x,_),iY(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` data-view-table-vertical-indicator { position: fixed; left: 0; top: 0; z-index: 1; pointer-events: none; } .vertical-indicator-container { position: absolute; pointer-events: none; } .vertical-indicator-group { position: absolute; z-index: 1; width: 100%; background-color: var(--affine-hover-color); pointer-events: none; } .vertical-indicator-group::after { position: absolute; z-index: 1; width: 2px; height: 100%; content: ''; right: 0; background-color: var(--affine-primary-color); border-radius: 1px; } .with-shadow.vertical-indicator-group::after { box-shadow: 0px 0px 8px 0px rgba(30, 150, 235, 0.35); } `}render(){let e=(0,S.W)({top:`${this.top}px`,left:`${this.left}px`,width:`${Math.max(this.width,1)}px`});return(0,s.qy)`
${(0,el.u)(this.lines,({top:e,bottom:t})=>{let i=(0,S.W)({top:`${e}px`,height:`${t-e}px`}),o=(0,k.H)({"with-shadow":this.shadow,"vertical-indicator-group":!0});return(0,s.qy)`
`})}
`}#tB=iK(this,u,void 0);get left(){return this.#tB}set left(e){this.#tB=e}#t$=(iK(this,p),iK(this,f,void 0));get lines(){return this.#t$}set lines(e){this.#t$=e}#tT=(iK(this,g),iK(this,m,!1));get shadow(){return this.#tT}set shadow(e){this.#tT=e}#tO=(iK(this,v),iK(this,y,void 0));get top(){return this.#tO}set top(e){this.#tO=e}#tP=(iK(this,b),iK(this,x,void 0));get width(){return this.#tP}set width(e){this.#tP=e}constructor(){super(...arguments),iK(this,_)}static{iK(t,d)}},t})(),iQ=e=>{let t=e.getBoundingClientRect();return Array.from(e.querySelectorAll("affine-data-view-table-group")).map(e=>{let i=e.getBoundingClientRect(),s=e.querySelector(".affine-database-column-header")?.getBoundingClientRect().top??i.top,o=e.querySelector(".affine-database-block-rows")?.getBoundingClientRect().bottom??i.bottom;return{top:s-t.top,bottom:o-t.top}})},iJ=(e,t,i,s)=>{let o=i/s.width$.value,r=t.getBoundingClientRect(),a=t.querySelector(`affine-database-header-column[data-column-id='${s.id}']`)?.getBoundingClientRect().left??0,n=iQ(t),l=i0();l.display(s.width$.value*o,r.top,n,a),t.style.pointerEvents="none",eE(e,{onDrag:()=>({width:s.width$.value}),onMove:({x:e})=>{let t=Math.round(iF((e-a)/o,100,1/0));return l.display(t*o,r.top,n,a),{width:t}},onDrop:({width:e})=>{s.updateWidth(e)},onClear:()=>{t.style.pointerEvents="auto",l.remove()}})},i1=null,i0=()=>{if(!i1){let e=new iX;i1={display(t,i,s,o,r=!1){document.body.append(e),e.left=o,e.lines=s,e.top=i,e.width=t,e.shadow=r},remove(){e.remove()}}}return i1};var i2=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},i5=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n=[(0,o.EM)("affine-database-header-column")],l=[],c=(0,eK.Jb)((0,w.Tm)(w.ao)),d=[],h=[],u=[],p=[],f=[],g=[];var m=class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],i2(this,null,i,{kind:"accessor",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:s},d,h),i2(this,null,r,{kind:"accessor",name:"grabStatus",static:!1,private:!1,access:{has:e=>"grabStatus"in e,get:e=>e.grabStatus,set:(e,t)=>{e.grabStatus=t}},metadata:s},u,p),i2(this,null,a,{kind:"accessor",name:"tableViewManager",static:!1,private:!1,access:{has:e=>"tableViewManager"in e,get:e=>e.tableViewManager,set:(e,t)=>{e.tableViewManager=t}},metadata:s},f,g),i2(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),m=t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` affine-database-header-column { display: flex; } .affine-database-header-column-grabbing * { cursor: grabbing; } `}popMenu(e){let t=this.tableViewManager.featureFlags$.value.enable_number_formatting;(0,e1.zs)(e??this,{options:{input:e7(this.column),items:[{type:"group",name:"Column Prop Group ",children:()=>{var e;return[e3(this.column),...t?[{type:"sub-menu",name:"Number Format",hide:()=>!this.column.updateData||"number"!==this.column.type,options:{input:{search:!0},items:[(e=this.column,{type:"custom",render:()=>(0,G.qy)` `}),...iR.map(e=>{let t=this.column.data$.value;return{type:"action",isSelected:t.format===e.type,icon:(0,G.qy)`${e.symbol}`,name:e.label,select:()=>{t.format!==e.type&&this.column.updateData(()=>({format:e.type}))}}})]}}]:[]]}},{type:"action",name:"Duplicate Column",icon:e0.DatabaseDuplicate,hide:()=>!this.column.duplicate||"title"===this.column.type,select:()=>{this.column.duplicate?.()}},{type:"action",name:"Insert Left Column",icon:e0.DatabaseInsertLeft,select:()=>{this.tableViewManager.columnAdd({id:this.column.id,before:!0}),Promise.resolve().then(()=>{let e=this.previousElementSibling;e instanceof m&&(e.editTitle(),e.scrollIntoView({inline:"nearest",block:"nearest"}))}).catch(console.error)}},{type:"action",name:"Insert Right Column",icon:e0.DatabaseInsertRight,select:()=>{this.tableViewManager.columnAdd({id:this.column.id,before:!1}),Promise.resolve().then(()=>{let e=this.nextElementSibling;e instanceof m&&(e.editTitle(),e.scrollIntoView({inline:"nearest",block:"nearest"}))}).catch(console.error)}},{type:"action",name:"Move Left",icon:e0.DatabaseMoveLeft,hide:()=>this.column.isFirst,select:()=>{let e=this.tableViewManager.columnGetPreColumn(this.column.id)?.id;e&&this.tableViewManager.columnMove(this.column.id,{id:e,before:!0})}},{type:"action",name:"Move Right",icon:e0.DatabaseMoveRight,hide:()=>this.column.isLast,select:()=>{let e=this.tableViewManager.columnGetNextColumn(this.column.id)?.id;e&&this.tableViewManager.columnMove(this.column.id,{id:e,before:!1})}},{type:"group",name:"operation",children:()=>[{type:"action",name:"Delete Column",icon:e0.DeleteIcon,hide:()=>!this.column.delete||"title"===this.column.type,select:()=>{this.column.delete?.()},class:"delete-item"}]}]}})}get readonly(){return this.tableViewManager.readonly$.value}widthDragStart(e){iJ(e,iA(this),this.getBoundingClientRect().width,this.column)}connectedCallback(){super.connectedCallback();let e=this.closest("affine-database-table");e&&this.disposables.add(e.handleEvent("dragStart",e=>{if(this.tableViewManager.readonly$.value)return;let t=e.get("pointerState").raw,i=t.target;if(i instanceof Element){if(this.widthDragBar.value?.contains(i))return t.preventDefault(),this.widthDragStart(t),!0;if(this.contains(i))return t.preventDefault(),this.moveColumn(t),!0}return!1}))}render(){let e=this.column,t=(0,S.W)({height:"36px"}),i=(0,k.H)({"affine-database-column-move":!0,[this.grabStatus]:!0});return(0,G.qy)`
${this.readonly?null:(0,G.qy)` `}
${e.name}
`}#e6;get column(){return this.#e6}set column(e){this.#e6=e}#tH;get grabStatus(){return this.#tH}set grabStatus(e){this.#tH=e}#tI;get tableViewManager(){return this.#tI}set tableViewManager(e){this.#tI=e}constructor(){super(...arguments),this._clickColumn=()=>{this.tableViewManager.readonly$.value||this.popMenu()},this._clickTypeIcon=e=>{this.tableViewManager.readonly$.value||"title"===this.column.type||(e.stopPropagation(),(0,e1.zs)(this,{options:{input:{search:!0,placeholder:"Search"},items:this.tableViewManager.allColumnConfig.map(e=>({type:"action",name:e.name,isSelected:e.type===this.column.type,icon:(0,e5.ep)(this.tableViewManager.getIcon(e.type)),select:()=>{this.column.updateType?.(e.type)}}))}}))},this._columnsOffset=(e,t)=>{let i=e.querySelectorAll("affine-database-header-column"),s=[],o=[],r=s,a=[],n=Array.from(i);for(let t=0;t{let i;for(let t=0;tr){if(i)return i;break}i={before:!1,id:t.column.id}}return i},c=n.map(e=>({id:e.column.id})),d=e=>a[(0,tZ.q)(e,c)];return{computeInsertInfo:(e,t)=>{let i=l(e,t);return{insertPosition:i,insertOffset:i?d(i):void 0}}}},this._contextMenu=e=>{this.tableViewManager.readonly$.value||(e.preventDefault(),this.popMenu(e.target))},this._enterWidthDragBar=()=>{this.tableViewManager.readonly$.value||(this.drawWidthDragBarTask&&(cancelAnimationFrame(this.drawWidthDragBarTask),this.drawWidthDragBarTask=0),this.drawWidthDragBar())},this._leaveWidthDragBar=()=>{cancelAnimationFrame(this.drawWidthDragBarTask),this.drawWidthDragBarTask=0,i0().remove()},this.drawWidthDragBar=()=>{let e=iA(this),t=e.getBoundingClientRect(),i=iQ(e);i0().display(0,t.top,i,this.getBoundingClientRect().right),this.drawWidthDragBarTask=requestAnimationFrame(this.drawWidthDragBar)},this.drawWidthDragBarTask=0,this.moveColumn=e=>{let t=iA(this),i=this.closest("affine-database-column-header"),s=t?.parentElement;(0,W.Z1)(i),(0,W.Z1)(t),(0,W.Z1)(s);let o=this.getBoundingClientRect(),r=o.width/this.column.width$.value,a=t.getBoundingClientRect(),n=e.x-o.left,l=o.right-e.x,c=(o.left-a.left)/r,d=(a.width-o.width)/r,{computeInsertInfo:h}=this._columnsOffset(i,r),u=new iU;u.tableViewManager=this.tableViewManager,u.column=this.column,u.table=t;let p=i7(t,o.width/r,a.height/r,c,u),f=iQ(t),g=i0(),m=t6(s,{boundary:{left:n,right:l},onScroll:()=>{y.move({x:y.last.x})}}),v=document.querySelector("html");v?.classList.toggle("affine-database-header-column-grabbing",!0);let y=eE(e,{onDrag:()=>(this.grabStatus="grabbing",{}),onMove:({x:e})=>{this.grabStatus="grabbing";let i=iF((e-t.getBoundingClientRect().left-n)/r,0,d),s=h(i,o.width/r);return null!=s.insertOffset?g.display(0,a.top,f,t.getBoundingClientRect().left+s.insertOffset,!0):g.remove(),p.display(i),{insertPosition:s.insertPosition}},onDrop:({insertPosition:e})=>{this.grabStatus="grabEnd",e&&this.tableViewManager.columnMove(this.column.id,e)},onClear:()=>{m(),v?.classList.toggle("affine-database-header-column-grabbing",!1),g.remove(),p.remove()}})},this.widthDragBar=(0,eQ._)(),this.editTitle=()=>{this._clickColumn()},this.#e6=i5(this,d,void 0),this.#tH=(i5(this,h),i5(this,u,"grabEnd")),this.#tI=(i5(this,p),i5(this,f,void 0)),i5(this,g)}static{i5(t,l)}};return m=t})();let i7=(e,t,i,s,o)=>{let r=document.createElement("div");return r.append(o),r.style.opacity="0.8",r.style.position="absolute",r.style.width=`${t}px`,r.style.height=`${i}px`,r.style.left=`${s}px`,r.style.top="0px",r.style.zIndex="9",e.append(r),{display(e){r.style.left=`${Math.round(e)}px`},remove(){r.remove()}}},i3=(0,s.AH)` affine-database-column-header { display: block; background-color: var(--affine-background-primary-color); position: relative; z-index: 2; } .affine-database-column-header { position: relative; display: flex; flex-direction: row; border-bottom: 1px solid var(--affine-border-color); border-top: 1px solid var(--affine-border-color); box-sizing: border-box; user-select: none; background-color: var(--affine-background-primary-color); } .affine-database-column { cursor: pointer; } .database-cell { min-width: ${100}px; user-select: none; } .database-cell.add-column-button { flex: 1; min-width: ${40}px; min-height: 100%; display: flex; align-items: center; } .affine-database-column-content { display: flex; align-items: center; gap: 6px; width: 100%; height: 100%; padding: 8px; box-sizing: border-box; position: relative; } .affine-database-column-content:hover, .affine-database-column-content.edit { background: var(--affine-hover-color); } .affine-database-column-content.edit .affine-database-column-text-icon { opacity: 1; } .affine-database-column-text { flex: 1; display: flex; align-items: center; gap: 6px; /* https://stackoverflow.com/a/36247448/15443637 */ overflow: hidden; color: var(--affine-text-secondary-color); font-size: 14px; position: relative; } .affine-database-column-type-icon { display: flex; align-items: center; border-radius: 4px; padding: 2px; } .affine-database-column-type-icon svg { width: 16px; height: 16px; fill: var(--affine-icon-color); } .affine-database-column-text-content { flex: 1; display: flex; align-items: center; overflow: hidden; } .affine-database-column-content:hover .affine-database-column-text-icon { opacity: 1; } .affine-database-column-text-input { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .affine-database-column-text-icon { display: flex; align-items: center; width: 16px; height: 16px; background: var(--affine-white); border: 1px solid var(--affine-border-color); border-radius: 4px; opacity: 0; } .affine-database-column-text-save-icon { display: flex; align-items: center; width: 16px; height: 16px; border: 1px solid transparent; border-radius: 4px; fill: var(--affine-icon-color); } .affine-database-column-text-save-icon:hover { background: var(--affine-white); border-color: var(--affine-border-color); } .affine-database-column-text-icon svg { fill: var(--affine-icon-color); } .affine-database-column-input { width: 100%; height: 24px; padding: 0; border: none; color: inherit; font-weight: 600; font-size: 14px; font-family: ${(0,s.iz)(y.$7.fontSansFamily)}; background: transparent; } .affine-database-column-input:focus { outline: none; } .affine-database-column-move { display: flex; align-items: center; } .affine-database-column-move svg { width: 10px; height: 14px; color: var(--affine-black-10); cursor: grab; opacity: 0; } .affine-database-column-content:hover svg { opacity: 1; } .affine-database-add-column-button { position: sticky; right: 0; display: flex; align-items: center; justify-content: center; width: 40px; height: 38px; cursor: pointer; } .header-add-column-button { height: ${36}px; background-color: var(--affine-background-primary-color); display: flex; align-items: center; justify-content: center; width: 40px; cursor: pointer; } .header-add-column-button svg { color: var(--affine-icon-color); } .affine-database-column-type-menu-icon { border: 1px solid var(--affine-border-color); border-radius: 4px; padding: 4px; background-color: var(--affine-background-secondary-color); } .affine-database-column-type-menu-icon svg { color: var(--affine-text-secondary-color); width: 24px; height: 24px; } .affine-database-column-move-preview { position: fixed; z-index: 100; width: 100px; height: 100px; background: var(--affine-text-emphasis-color); } .affine-database-column-move { --color: var(--affine-placeholder-color); --active: var(--affine-black-10); --bw: 1px; --bw2: -1px; cursor: grab; background: none; border: none; border-radius: 0; position: absolute; inset: 0; } .affine-database-column-move .control-l::before, .affine-database-column-move .control-h::before, .affine-database-column-move .control-l::after, .affine-database-column-move .control-h::after, .affine-database-column-move .control-r, .affine-database-column-move .hover-trigger { --delay: 0s; --delay-opacity: 0s; content: ''; position: absolute; transition: all 0.2s ease var(--delay), opacity 0.2s ease var(--delay-opacity); } .affine-database-column-move .control-r { --delay: 0s; --delay-opacity: 0.6s; width: 4px; border-radius: 1px; height: 32%; background: var(--color); right: 6px; top: 50%; transform: translateY(-50%); opacity: 0; pointer-events: none; } .affine-database-column-move .hover-trigger { width: 12px; height: 80%; right: 3px; top: 10%; background: transparent z-index: 1; opacity: 1; } .affine-database-column-move:hover .control-r { opacity: 1; } .affine-database-column-move .control-h::before, .affine-database-column-move .control-h::after { --delay: 0.2s; width: calc(100% - var(--bw2) * 2); opacity: 0; height: var(--bw); right: var(--bw2); background: var(--active); } .affine-database-column-move .control-h::before { top: var(--bw2); } .affine-database-column-move .control-h::after { bottom: var(--bw2); } .affine-database-column-move .control-l::before { --delay: 0s; width: var(--bw); height: 100%; opacity: 0; background: var(--active); left: var(--bw2); } .affine-database-column-move .control-l::before { top: 0; } .affine-database-column-move .control-l::after { bottom: 0; } /* handle--active style */ .affine-database-column-move:hover .control-r { --delay-opacity: 0s; opacity: 1; } .affine-database-column-move:active .control-r, .hover-trigger:hover ~ .control-r, .grabbing.affine-database-column-move .control-r { opacity: 1; --delay: 0s; --delay-opacity: 0s; right: var(--bw2); width: var(--bw); height: 100%; background: var(--active); } .affine-database-column-move:active .control-h::before, .affine-database-column-move:active .control-h::after, .hover-trigger:hover ~ .control-h::before, .hover-trigger:hover ~ .control-h::after, .grabbing.affine-database-column-move .control-h::before, .grabbing.affine-database-column-move .control-h::after { --delay: 0.2s; width: calc(100% - var(--bw2) * 2); opacity: 1; } .affine-database-column-move:active .control-l::before, .affine-database-column-move:active .control-l::after, .hover-trigger:hover ~ .control-l::before, .hover-trigger:hover ~ .control-l::after, .grabbing.affine-database-column-move .control-l::before, .grabbing.affine-database-column-move .control-l::after { --delay: 0.4s; opacity: 1; } `;var i4=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},i6=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n=[(0,o.EM)("affine-database-column-header")],l=[],c=(0,eK.Jb)((0,w.Tm)(w.ao)),d=[],h=[],u=[],p=[],f=[],g=[];(class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.P)(".scale-div")],a=[(0,o.MZ)({attribute:!1})],i4(this,null,i,{kind:"accessor",name:"renderGroupHeader",static:!1,private:!1,access:{has:e=>"renderGroupHeader"in e,get:e=>e.renderGroupHeader,set:(e,t)=>{e.renderGroupHeader=t}},metadata:s},d,h),i4(this,null,r,{kind:"accessor",name:"scaleDiv",static:!1,private:!1,access:{has:e=>"scaleDiv"in e,get:e=>e.scaleDiv,set:(e,t)=>{e.scaleDiv=t}},metadata:s},u,p),i4(this,null,a,{kind:"accessor",name:"tableViewManager",static:!1,private:!1,access:{has:e=>"tableViewManager"in e,get:e=>e.tableViewManager,set:(e,t)=>{e.tableViewManager=t}},metadata:s},f,g),i4(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=i3}autoSetHeaderPosition(e,t){this.preAutoSet&&(cancelAnimationFrame(this.preAutoSet),this.preAutoSet=0);let i=e.getBoundingClientRect(),s=this.getBoundingClientRect(),o=t.getBoundingClientRect(),r=0;o.top>i.top&&(r=Math.min(i.bottom-s.height,o.top)-i.top),(0!==r||0!==this.preMove)&&(this.preMove=r,this.style.transform=`translate3d(0,${r/this.getScale()}px,0)`,this.preAutoSet=requestAnimationFrame(()=>{this.preAutoSet=0,this.autoSetHeaderPosition(e,t)}))}get readonly(){return this.tableViewManager.readonly$.value}connectedCallback(){super.connectedCallback();let e=(0,iz.B)(this.closest("affine-data-view-renderer")),t=this.closest("affine-data-view-table-group");if(t){let i=(0,v.ll)(t,this,()=>{e&&this.autoSetHeaderPosition(t,e)});this.disposables.add(i),this.disposables.add(()=>{cancelAnimationFrame(this.preAutoSet)})}}getScale(){return this.scaleDiv?.getBoundingClientRect().width??1}render(){return(0,G.qy)` ${this.renderGroupHeader?.()}
${this.readonly?s.s6:(0,G.qy)`
`} ${(0,el.u)(this.tableViewManager.columnManagerList$.value,e=>e.id,(e,t)=>{let i=(0,S.W)({width:`${e.width$.value}px`,border:0===t?"none":void 0});return(0,G.qy)` `})}
${Y.N7w}
`}#tA;get renderGroupHeader(){return this.#tA}set renderGroupHeader(e){this.#tA=e}#tL;get scaleDiv(){return this.#tL}set scaleDiv(e){this.#tL=e}#tI;get tableViewManager(){return this.#tI}set tableViewManager(e){this.#tI=e}constructor(){super(...arguments),this._onAddColumn=e=>{if(this.readonly)return;this.tableViewManager.columnAdd("end");let t=e.currentTarget;requestAnimationFrame(()=>{this.editLastColumnTitle(),t.scrollIntoView({block:"nearest",inline:"nearest"})})},this.preAutoSet=0,this.editLastColumnTitle=()=>{let e=this.querySelectorAll("affine-database-header-column"),t=e.item(e.length-1);t.scrollIntoView({block:"nearest",inline:"nearest"}),t.editTitle()},this.preMove=0,this.#tA=i6(this,d,void 0),this.#tL=(i6(this,h),i6(this,u,void 0)),this.#tI=(i6(this,p),i6(this,f,void 0)),i6(this,g)}static{i6(t,l)}})})();let i8=[{type:"none",label:"None",display:"Calculate",calculate:()=>({value:0,displayFormat:"x10"})},{type:"count-all",label:"Count All",display:"Count",calculate:(e,t)=>({value:e.stats.countAll(t),displayFormat:"x10"})},{type:"count-values",label:"Count Values",display:"Values",calculate:(e,t)=>({value:e.stats.countValues(t),displayFormat:"x10"})},{type:"count-uni-values",label:"Count Unique Values",display:"Unique",calculate:(e,t)=>({value:e.stats.countUniqueValues(t),displayFormat:"x10"})},{type:"count-empty",label:"Count Empty",display:"Empty",calculate:(e,t)=>({value:e.stats.countEmpty(t),displayFormat:"x10"})},{type:"count-not-empty",label:"Count Not Empty",display:"Not Empty",calculate:(e,t)=>({value:e.stats.countNonEmpty(t),displayFormat:"x10"})},{type:"percent-empty",label:"Percent Empty",display:"Empty",calculate:(e,t)=>({value:e.stats.percentEmpty(t),displayFormat:"%"})},{type:"percent-not-empty",label:"Percent Not Empty",display:"Not Empty",calculate:(e,t)=>({value:e.stats.percentNonEmpty(t),displayFormat:"%"})}],i9=[...i8,{type:"sum",label:"Sum",display:"Sum",calculate:(e,t)=>({value:e.stats.sum(t),displayFormat:"x10"})},{type:"avg",label:"Average",display:"Avg",calculate:(e,t)=>({value:e.stats.mean(t),displayFormat:"x10"})},{type:"median",label:"Median",display:"Median",calculate:(e,t)=>({value:e.stats.median(t),displayFormat:"x10"})},{type:"mode",label:"Mode",display:"Mode",calculate:(e,t)=>({value:e.stats.mode(t),displayFormat:"x10"})},{type:"min",label:"Min",display:"Min",calculate:(e,t)=>({value:e.stats.min(t),displayFormat:"x10"})},{type:"max",label:"Max",display:"Max",calculate:(e,t)=>({value:e.stats.max(t),displayFormat:"x10"})},{type:"range",label:"Range",display:"Range",calculate:(e,t)=>({value:e.stats.range(t),displayFormat:"x10"})}],se=[...i8.slice(0,2),{type:"checked",label:"Checked",display:"Checked",calculate:(e,t)=>({value:e.stats.checked(t),displayFormat:"x10"})},{type:"not-checked",label:"Not Checked",display:"Not Checked",calculate:(e,t)=>({value:e.stats.notChecked(t),displayFormat:"x10"})},{type:"percent-checked",label:"Percent Checked",display:"Checked",calculate:(e,t)=>({value:e.stats.percentChecked(t),displayFormat:"%"})},{type:"percent-not-checked",label:"Percent Not Checked",display:"Not Checked",calculate:(e,t)=>({value:e.stats.percentNotChecked(t),displayFormat:"%"})}],st=Array.from(new Set([...i8,...i9,...se])),si=(e,t,i)=>{let s=i.selection;i.selection=void 0,e.openDetailPanel({view:i.host.view,rowId:t,onClose:()=>{i.selection=s}})},ss=(e,t,i)=>{let o=i.selection;if(!iD.is(o))return;if(o.rows.length>1){let e=iD.rowsIds(o);(0,e1.$E)(t,[{type:"group",name:"",children:()=>[{type:"action",name:"Copy",icon:(0,s.qy)`
${Y.TdU}
`,select:()=>{i.host.clipboardController.copy()}}]},{type:"group",name:"",children:()=>[{type:"action",name:"Delete Rows",class:"delete-item",icon:e0.DeleteIcon,select:()=>{i.view.rowDelete(e)}}]}]);return}let r=o.rows[0];(0,e1.$E)(t,[{type:"action",name:"Expand Row",icon:Y.JmJ,select:()=>{si(e,r.id,i)}},{type:"group",name:"",children:()=>[{type:"action",name:"Insert Before",icon:(0,s.qy)`
${Y.aiU}
`,select:()=>{i.insertRowBefore(r.groupKey,r.id)}},{type:"action",name:"Insert After",icon:(0,s.qy)`
${Y.hhC}
`,select:()=>{i.insertRowAfter(r.groupKey,r.id)}}]},{type:"group",name:"",children:()=>[{type:"action",name:"Delete Row",class:"delete-item",icon:e0.DeleteIcon,select:()=>{i.deleteRow(r.id)}}]}])},so=(e,t,i,s,o)=>{let r=[];switch(s){case"number":r=i9;break;case"checkbox":r=se;break;default:r=i8}let a=r.map(e=>({type:"action",name:e.label,select:()=>{o(e)}}));return(0,e1.$E)(t,a)};var sr=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sa=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,a,n,l=[(0,o.EM)("row-select-checkbox")],c=[],d=(0,eK.Jb)((0,w.Tm)(w.ao)),h=[],u=[],p=[],f=[],g=[],m=[];(class extends d{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],sr(this,null,i,{kind:"accessor",name:"groupKey",static:!1,private:!1,access:{has:e=>"groupKey"in e,get:e=>e.groupKey,set:(e,t)=>{e.groupKey=t}},metadata:s},h,u),sr(this,null,a,{kind:"accessor",name:"rowId",static:!1,private:!1,access:{has:e=>"rowId"in e,get:e=>e.rowId,set:(e,t)=>{e.rowId=t}},metadata:s},p,f),sr(this,null,n,{kind:"accessor",name:"selection",static:!1,private:!1,access:{has:e=>"selection"in e,get:e=>e.selection,set:(e,t)=>{e.selection=t}},metadata:s},g,m),sr(null,e={value:t},l,{kind:"class",name:t.name,metadata:s},null,c),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` row-select-checkbox { display: contents; } .row-select-checkbox { display: flex; align-items: center; background-color: var(--affine-background-primary-color); opacity: 0; cursor: pointer; } .row-select-checkbox:hover { opacity: 1; } .row-select-checkbox.selected { opacity: 1; } .row-select-checkbox svg { width: 18px; height: 18px; color: var(--affine-icon-color); } `}connectedCallback(){super.connectedCallback(),this.disposables.addFromEvent(this,"click",()=>{this.closest("affine-database-table")?.selectionController.toggleRow(this.rowId,this.groupKey)})}render(){let e=(0,k.H)({"row-selected-bg":!0,"row-select-checkbox":!0,selected:this.isSelected$.value});return(0,s.qy)`
${this.isSelected$.value?(0,r.xY)():(0,r.wb)()}
`}#to;get groupKey(){return this.#to}set groupKey(e){this.#to=e}#te;get rowId(){return this.#te}set rowId(e){this.#te=e}#tD;get selection(){return this.#tD}set selection(e){this.#tD=e}constructor(){super(...arguments),this.isSelected$=(0,eK.EW)(()=>{let e=this.selection.value;return!!e&&"row"===e.selectionType&&iD.includes(e,{id:this.rowId,groupKey:this.groupKey})}),this.#to=sa(this,h,void 0),this.#te=(sa(this,u),sa(this,p,void 0)),this.#tD=(sa(this,f),sa(this,g,void 0)),sa(this,m)}static{sa(t,c)}})})();var sn=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sl=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l=[(0,o.EM)("data-view-table-row")],c=[],d=(0,eK.Jb)((0,w.Tm)(w.ao)),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[];return class extends d{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],sn(this,null,i,{kind:"accessor",name:"dataViewEle",static:!1,private:!1,access:{has:e=>"dataViewEle"in e,get:e=>e.dataViewEle,set:(e,t)=>{e.dataViewEle=t}},metadata:s},h,u),sn(this,null,r,{kind:"accessor",name:"rowId",static:!1,private:!1,access:{has:e=>"rowId"in e,get:e=>e.rowId,set:(e,t)=>{e.rowId=t}},metadata:s},p,f),sn(this,null,a,{kind:"accessor",name:"rowIndex",static:!1,private:!1,access:{has:e=>"rowIndex"in e,get:e=>e.rowIndex,set:(e,t)=>{e.rowIndex=t}},metadata:s},g,m),sn(this,null,n,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:s},v,y),sn(null,e={value:t},l,{kind:"class",name:t.name,metadata:s},null,c),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .affine-database-block-row:has(.row-select-checkbox.selected) { background: var(--affine-primary-color-04); } .affine-database-block-row:has(.row-select-checkbox.selected) .row-selected-bg { position: relative; } .affine-database-block-row:has(.row-select-checkbox.selected) .row-selected-bg:before { content: ''; position: absolute; left: 0; right: 0; top: 0; bottom: 0; background: var(--affine-primary-color-04); } .affine-database-block-row { width: 100%; display: flex; flex-direction: row; border-bottom: 1px solid var(--affine-border-color); position: relative; } .affine-database-block-row.selected > .database-cell { background: transparent; } .database-cell { min-width: ${100}px; } .row-ops { position: relative; width: 0; margin-top: 8px; height: max-content; visibility: hidden; display: flex; gap: 4px; cursor: pointer; justify-content: end; } .row-op:last-child { margin-right: 8px; } .affine-database-block-row .show-on-hover-row { visibility: hidden; opacity: 0; } .affine-database-block-row:hover .show-on-hover-row { visibility: visible; opacity: 1; } .row-op { display: flex; padding: 4px; border-radius: 4px; box-shadow: 0px 0px 4px 0px rgba(66, 65, 73, 0.14); background-color: var(--affine-background-primary-color); position: relative; } .row-op:hover:before { content: ''; border-radius: 4px; position: absolute; left: 0; right: 0; top: 0; bottom: 0; background-color: var(--affine-hover-color); } .row-op svg { fill: var(--affine-icon-color); color: var(--affine-icon-color); width: 16px; height: 16px; } .data-view-table-view-drag-handler { width: 8px; height: 38px; display: flex; align-items: center; justify-content: center; cursor: grab; background-color: var(--affine-background-primary-color); } `}connectedCallback(){super.connectedCallback(),this.disposables.addFromEvent(this,"contextmenu",this.contextMenu),this.classList.add("affine-database-block-row","database-row")}render(){let e=this.view;return(0,G.qy)` ${e.readonly$.value?s.s6:(0,G.qy)`
`} ${(0,el.u)(e.columnManagerList$.value,e=>e.id,(t,i)=>(0,G.qy)`
${t.readonly$.value||t.view.header$.value.titleColumn!==t.id?s.s6:(0,G.qy)`
${e0.CenterPeekIcon}
${e.readonly$.value?s.s6:(0,G.qy)`
${e0.MoreHorizontalIcon}
`}
`} `)}
`}get groupKey(){return this.closest("affine-data-view-table-group")?.group?.key}get selectionController(){return this.closest("affine-database-table")?.selectionController}#tg;get dataViewEle(){return this.#tg}set dataViewEle(e){this.#tg=e}#te;get rowId(){return this.#te}set rowId(e){this.#te=e}#tM;get rowIndex(){return this.#tM}set rowIndex(e){this.#tM=e}#tt;get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),this._clickDragHandler=()=>{this.view.readonly$.value||this.selectionController?.toggleRow(this.rowId,this.groupKey)},this.contextMenu=e=>{if(this.view.readonly$.value)return;let t=this.selectionController;if(!t)return;e.preventDefault();let i=e.target.closest("affine-database-cell-container"),s={id:this.rowId,groupKey:this.groupKey};iD.includes(t.selection,s)||(t.selection=iD.create({rows:[s]}));let o=i??e.target.closest(".database-cell")??e.target;ss(this.dataViewEle,o,t)},this.setSelection=e=>{this.selectionController&&(this.selectionController.selection=e)},this.#tg=sl(this,h,void 0),this.#te=(sl(this,u),sl(this,p,void 0)),this.#tM=(sl(this,f),sl(this,g,void 0)),this.#tt=(sl(this,m),sl(this,v,void 0)),sl(this,y)}static{sl(t,c)}},t})(),sd="blocksuite/database/table";class sh{constructor(e){this.host=e,this._onCopy=(e,t=!1)=>{let i=this.host,s=function(e,t){let i=t.view;if(iD.is(e))return iD.rows(e).map(e=>({y:t.selectionController.getRow(e.groupKey,e.id)?.getBoundingClientRect().y??0,row:e})).sort((e,t)=>e.y-t.y).map(e=>e.row).map(e=>{let t=i.rowGet(e.id);return{row:t,cells:t.cells$.value}});let{rowsSelection:s,columnsSelection:o,groupKey:r}=e,a=[],n=r?i.groupHelper?.groupMap[r].rows:i.rows$.value,l=i.columns$.value;if(n){for(let e=s.start;e<=s.end;e++){let t={cells:[]},s=n[e];for(let e=o.start;e<=o.end;e++){let o=l[e],r=i.cellGet(s,o);t.cells.push(r)}a.push(t)}return a}}(e,i);if(!s)return;let o=s.map(e=>e.cells.map(e=>e.stringValue$.value).join(" ")).join("\n"),r=s.map(e=>e.cells.map(e=>e.stringValue$.value));if(t){let e=[];for(let t of s)if(t.row)e.push(t.row.rowId);else for(let e of t.cells)e.setValue(void 0);e.length&&i.view.rowDelete(e)}return this.std.clipboard.writeToClipboard(e=>({...e,"text/plain":o,[sd]:JSON.stringify(r)})).then(()=>{if(s[0]?.row)(0,e1.oR)(this.host.std.host,`${s.length} row${s.length>1?"s":""} copied to clipboard`);else{let e=s.flatMap(e=>e.cells).length;(0,e1.oR)(this.host.std.host,`${e} cell${e>1?"s":""} copied to clipboard`)}}).catch(console.error),!0},this._onCut=e=>{this._onCopy(e,!0)},this._onPaste=async e=>{let t=e.get("clipboardState").raw;t.stopPropagation();let i=this.host,s=t.clipboardData;if(!s)return;let o=this.host.selectionController.selection;if(!iD.is(o)){if(o){let e=(await this.std.clipboard.readFromClipboard(s))[sd];if(!e)return;(function(e,t,i){let s=t.length,o=t[0].length,r=function(e,t){let{rowsSelection:i,columnsSelection:s,focus:o}=e;return iZ.isFocus(e)?{row:{start:o.rowIndex,length:t.length},column:{start:o.columnIndex,length:t[0].length}}:{row:{start:i.start,length:i.end-i.start+1},column:{start:s.start,length:s.end-s.start+1}}}(i,t);for(let a=0;a{let t=this.host.selectionController.selection;return!!t&&(this._onCopy(t),!0)})),this.host.disposables.add(this.host.handleEvent("cut",e=>{let t=this.host.selectionController.selection;return!!t&&(this._onCut(t),!0)})),this.host.disposables.add(this.host.handleEvent("paste",e=>!this.readonly&&(this._onPaste(e).catch(console.error),!0)))}}class su{constructor(e){this.host=e,this.dragStart=(e,t)=>{let i=e.getBoundingClientRect(),s=t.x-i.left,o=t.y-i.top,r=sp(e,t.x-s,t.y-o),a=e.groupKey;eE(t,{onDrag:()=>void 0,onMove:t=>{if(r.display(t.x-s,t.y-o),!this.host.contains(t.target)){let i=this.host.onDrag;return i?(this.dropPreview.remove(),{type:"out",callback:i(t,e.rowId)}):void 0}let i=this.showIndicator(t);if(i)return{type:"self",groupKey:i.groupKey,position:i.position}},onClear:()=>{r.remove(),this.dropPreview.remove()},onDrop:t=>{if(t){if("out"===t.type){t.callback();return}"self"===t.type&&this.host.view.rowMove(e.rowId,t.position,a,t.groupKey)}}})},this.dropPreview=sf(),this.getInsertPosition=e=>{let t=e.y,i=this.host.getBoundingClientRect(),s=this.host.querySelectorAll("data-view-table-row");if(s&&i&&!(t{let t=this.getInsertPosition(e);return t?this.dropPreview.display(t.x,t.y,t.width):this.dropPreview.remove(),t},this.host.addController(this)}hostConnected(){this.host.view.readonly$.value||this.host.disposables.add(this.host.handleEvent("dragStart",e=>{let t=e.get("pointerState").raw,i=t.target;if(i instanceof Element&&this.host.contains(i)&&i.closest(".data-view-table-view-drag-handler")){t.preventDefault();let e=i.closest("data-view-table-row");return e&&(getSelection()?.removeAllRanges(),this.dragStart(e,t)),!0}return!1}))}}let sp=(e,t,i)=>{let s=document.createElement("div"),o=new sc;return o.view=e.view,o.rowIndex=e.rowIndex,o.rowId=e.rowId,s.append(o),s.className="with-data-view-css-variable",s.style.width=`${e.getBoundingClientRect().width}px`,s.style.position="fixed",s.style.pointerEvents="none",s.style.backgroundColor="var(--affine-background-primary-color)",s.style.boxShadow="var(--affine-shadow-2)",s.style.left=`${t}px`,s.style.top=`${i}px`,s.style.zIndex="9999",document.body.append(s),{display(e,t){s.style.left=`${Math.round(e)}px`,s.style.top=`${Math.round(t)}px`},remove(){s.remove()}}},sf=()=>{let e=document.createElement("div");return e.dataset.isDropPreview="true",e.style.pointerEvents="none",e.style.position="fixed",e.style.zIndex="9999",e.style.height="2px",e.style.borderRadius="1px",e.style.backgroundColor="var(--affine-primary-color)",e.style.boxShadow="0px 0px 8px 0px rgba(30, 150, 235, 0.35)",{display(t,i,s){document.body.append(e),e.style.left=`${t}px`,e.style.top=`${i-2}px`,e.style.width=`${s}px`},remove(){e.remove()}}};class sg{constructor(e){this.host=e,this.host.addController(this)}hostConnected(){this.host.disposables.add(this.host.bindHotkey({Backspace:()=>{let e=this.selectionController.selection;if(!e)return;if(iD.is(e)){let t=iD.rowsIds(e);this.selectionController.selection=void 0,this.host.view.rowDelete(t);return}let{focus:t,rowsSelection:i,columnsSelection:s,isEditing:o,groupKey:r}=e;if(t&&!o){if(i&&s)for(let e=i.start;e<=i.end;e++){let{start:t,end:i}=s;for(let s=t;s<=i;s++){let t=this.selectionController.getCellContainer(r,e,s),i=t?.dataset.rowId,o=t?.dataset.columnId;i&&o&&t?.column.setValueFromString(i,"")}}else{let e=this.selectionController.getCellContainer(r,t.rowIndex,t.columnIndex),i=e?.dataset.rowId,s=e?.dataset.columnId;i&&s&&e?.column.setValueFromString(i,"")}}},Escape:()=>{let e=this.selectionController.selection;if(!e)return!1;if(iD.is(e)){let t=this.selectionController.rowsToArea(e.rows.map(e=>e.id));t?this.selectionController.selection=iZ.create({groupKey:t.groupKey,focus:{rowIndex:t.start,columnIndex:0},rowsSelection:{start:t.start,end:t.end},isEditing:!1}):this.selectionController.selection=void 0}else if(e.isEditing)this.selectionController.selection={...e,isEditing:!1};else{let t=this.selectionController.areaToRows(e);this.selectionController.rowSelectionChange({add:t,remove:[]})}return!0},Enter:e=>{let t=this.selectionController.selection;if(!t)return!1;if(iD.is(t)){let e=this.selectionController.rowsToArea(t.rows.map(e=>e.id));e&&(this.selectionController.selection=iZ.create({groupKey:e.groupKey,focus:{rowIndex:e.start,columnIndex:0},rowsSelection:{start:e.start,end:e.end},isEditing:!1}))}else{if(t.isEditing)return!1;this.selectionController.selection={...t,isEditing:!0}}return e.get("keyboardState").raw.preventDefault(),!0},"Shift-Enter":()=>{let e=this.selectionController.selection;if(!e||iD.is(e)||e.isEditing)return!1;let t=this.selectionController.getCellContainer(e.groupKey,e.focus.rowIndex,e.focus.columnIndex);return t&&this.selectionController.insertRowAfter(e.groupKey,t.rowId),!0},Tab:e=>{let t=this.selectionController.selection;return!(!t||iD.is(t))&&!t.isEditing&&(e.get("keyboardState").raw.preventDefault(),this.selectionController.focusToCell("right"),!0)},"Shift-Tab":e=>{let t=this.selectionController.selection;return!(!t||iD.is(t))&&!t.isEditing&&(e.get("keyboardState").raw.preventDefault(),this.selectionController.focusToCell("left"),!0)},ArrowLeft:e=>{let t=this.selectionController.selection;return!(!t||iD.is(t))&&!t.isEditing&&(this.selectionController.focusToCell("left"),e.get("keyboardState").raw.preventDefault(),!0)},ArrowRight:e=>{let t=this.selectionController.selection;return!(!t||iD.is(t))&&!t.isEditing&&(this.selectionController.focusToCell("right"),e.get("keyboardState").raw.preventDefault(),!0)},ArrowUp:e=>{let t=this.selectionController.selection;if(!t)return!1;if(iD.is(t))this.selectionController.navigateRowSelection("up",!1);else{if(t.isEditing)return!1;this.selectionController.focusToCell("up")}return e.get("keyboardState").raw.preventDefault(),!0},ArrowDown:e=>{let t=this.selectionController.selection;if(!t)return!1;if(iD.is(t))this.selectionController.navigateRowSelection("down",!1);else{if(t.isEditing)return!1;this.selectionController.focusToCell("down")}return e.get("keyboardState").raw.preventDefault(),!0},"Shift-ArrowUp":e=>{let t=this.selectionController.selection;if(!t)return!1;if(iD.is(t))this.selectionController.navigateRowSelection("up",!0);else{if(t.isEditing)return!1;this.selectionController.selectionAreaUp()}return e.get("keyboardState").raw.preventDefault(),!0},"Shift-ArrowDown":e=>{let t=this.selectionController.selection;if(!t)return!1;if(iD.is(t))this.selectionController.navigateRowSelection("down",!0);else{if(t.isEditing)return!1;this.selectionController.selectionAreaDown()}return e.get("keyboardState").raw.preventDefault(),!0},"Shift-ArrowLeft":e=>{let t=this.selectionController.selection;return!(!t||iD.is(t)||t.isEditing||this.selectionController.isRowSelection())&&(this.selectionController.selectionAreaLeft(),e.get("keyboardState").raw.preventDefault(),!0)},"Shift-ArrowRight":e=>{let t=this.selectionController.selection;return!(!t||iD.is(t)||t.isEditing||this.selectionController.isRowSelection())&&(this.selectionController.selectionAreaRight(),e.get("keyboardState").raw.preventDefault(),!0)},"Mod-a":e=>{let t=this.selectionController.selection;return!iD.is(t)&&(!!t?.isEditing||(t?(e.get("keyboardState").raw.preventDefault(),this.selectionController.selection=iD.create({rows:this.host.view.groupHelper?.groups.flatMap(e=>e.rows.map(t=>({groupKey:e.key,id:t})))??this.host.view.rows$.value.map(e=>({groupKey:void 0,id:e}))}),!0):void 0))},"/":e=>{let t=this.selectionController.selection;if(!t||iD.is(t)||t.isEditing)return;let i=this.selectionController.getCellContainer(t.groupKey,t.focus.rowIndex,t.focus.columnIndex);if(i){e.get("keyboardState").raw.preventDefault();let s={id:i.rowId,groupKey:t.groupKey};this.selectionController.selection=iD.create({rows:[s]}),ss(this.host.dataViewEle,i,this.selectionController)}}}))}get selectionController(){return this.host.selectionController}}var sm=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sv=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("data-view-drag-to-fill")],r=[],a=w.ao,n=[],l=[];return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;sm(this,null,[(0,o.wk)()],{kind:"accessor",name:"dragging",static:!1,private:!1,access:{has:e=>"dragging"in e,get:e=>e.dragging,set:(e,t)=>{e.dragging=t}},metadata:s},n,l),sm(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .drag-to-fill { border-radius: 50%; box-sizing: border-box; background-color: var(--affine-background-primary-color); border: 2px solid var(--affine-primary-color); display: none; position: absolute; cursor: ns-resize; width: 10px; height: 10px; transform: translate(-50%, -50%); pointer-events: auto; user-select: none; transition: scale 0.2s ease; z-index: 2; } .drag-to-fill.dragging { scale: 1.1; } `}render(){return(0,s.qy)`
`}#tZ;get dragging(){return this.#tZ}set dragging(e){this.#tZ=e}constructor(){super(...arguments),this.dragToFillRef=(0,eQ._)(),this.#tZ=sv(this,n,!1),sv(this,l)}static{sv(t,r)}},t})();var sb=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sw=function(e,t,i){for(var s=arguments.length>2,o=0;o{if(!this._tableViewSelection||"area"!==this._tableViewSelection.selectionType)return null;let{groupKey:e,focus:t}=this._tableViewSelection;return this.getCellContainer(e,t.rowIndex,t.columnIndex)??null},this.selectionStyleUpdateTask=0,e.addController(this),this.__selectionElement=new s_,this.__selectionElement.controller=this}get areaSelectionElement(){return this.__selectionElement.selectionRef.value}clearSelection(){this.host.setSelection()}get focusSelectionElement(){return this.__selectionElement.focusRef.value}handleDragEvent(){this.host.disposables.add(this.host.handleEvent("dragStart",e=>{if(this.host.view.readonly$.value)return;let t=e.get("pointerState").raw,i=t.target;if(i instanceof HTMLElement){let[e,s]=this.resolveDragStartTarget(i);if(e){let i=this.selection;return(!i||"area"!==i.selectionType||!i.isEditing||i.focus.rowIndex!==e.rowIndex||i.focus.columnIndex!==e.columnIndex)&&(this.startDrag(t,e,s),t.preventDefault(),!0)}}return!1}))}handleSelectionChange(){this.host.disposables.add(this.host.selection$.subscribe(e=>{if(!this.isValidSelection(e)){this.selection=void 0;return}let t=this._tableViewSelection?.selectionType==="area"?this._tableViewSelection:void 0,i=e?.selectionType==="area"?e:void 0;if((t?.focus.rowIndex!==i?.focus.rowIndex||t?.focus.columnIndex!==i?.focus.columnIndex)&&requestAnimationFrame(()=>{this.scrollToFocus()}),this.isRowSelection()&&(t?.rowsSelection?.start!==i?.rowsSelection?.start||t?.rowsSelection?.end!==i?.rowsSelection?.end)&&requestAnimationFrame(()=>{this.scrollToAreaSelection()}),t){let e=this.getCellContainer(t.groupKey,t.focus.rowIndex,t.focus.columnIndex);if(e){let i=e.cell;t.isEditing&&(requestAnimationFrame(()=>{i?.onExitEditMode()}),i?.blurCell(),e.isEditing=!1)}}if(this._tableViewSelection=e,i){let e=this.getCellContainer(i.groupKey,i.focus.rowIndex,i.focus.columnIndex);if(e){let t=e.cell;i.isEditing&&(t?.onEnterEditMode(),e.isEditing=!0,t?.focusCell())}}}))}insertTo(e,t,i){let s=this.view.rowAdd({before:i,id:t});null!=e&&this.view.groupHelper?.moveCardTo(s,void 0,e,{before:i,id:t});let o=null!=e?this.view.groupHelper?.groupMap[e].rows:this.view.rows$.value;requestAnimationFrame(()=>{let t=this.host.view.columnManagerList$.value.findIndex(e=>"title"===e.type);this.selection=iZ.create({groupKey:e,focus:{rowIndex:o?.findIndex(e=>e===s)??0,columnIndex:t},isEditing:!0})})}resolveDragStartTarget(e){let t;let i=!!e.dataset.dragToFill;if(i){let e=this.getFocusCellContainer();(0,W.Z1)(e),t=e}else t=e.closest("affine-database-cell-container");return[t,i]}scrollToAreaSelection(){this.areaSelectionElement?.scrollIntoView({block:"nearest",inline:"nearest"})}scrollToFocus(){this.focusSelectionElement?.scrollIntoView({block:"nearest",inline:"nearest"})}areaToRows(e){let t=this.rows(e.groupKey);return Array.from({length:e.rowsSelection.end-e.rowsSelection.start+1}).map((t,i)=>i+e.rowsSelection.start).map(e=>t[e]?.rowId).map(t=>({id:t,groupKey:e.groupKey}))}cellPosition(e){let t=this.rows(e),i=t?.item(0).querySelectorAll("affine-database-cell-container");return(e,s,o,r)=>{let a=Array.from(t??[]).map(e=>e.getBoundingClientRect().top),n=Array.from(i??[]).map(e=>e.getBoundingClientRect().left),[l,c]=e{this.tableContainer?.append(this.__selectionElement),this.tableContainer?.append(this.__dragToFillElement)}),this.handleDragEvent(),this.handleSelectionChange()}insertRowAfter(e,t){this.insertTo(e,t,!1)}insertRowBefore(e,t){this.insertTo(e,t,!0)}isRowSelection(){return this.selection?.selectionType==="row"}isValidSelection(e){return!e||"row"===e.selectionType||!(e.focus.rowIndex>this.view.rows$.value.length-1)&&!(e.focus.columnIndex>this.view.columns$.value.length-1)||(this.selection=void 0,!1)}navigateRowSelection(e,t=!1){if(!iD.is(this.selection))return;let i=this.selection.rows,s=i[i.length-1],o=this.getGroup(s.groupKey)?.querySelector(`data-view-table-row[data-row-id='${s.id}']`)?.rowIndex??0,r=e=>{let t=this.rows(s.groupKey).item(e);if(t)return{id:t.rowId,groupKey:s.groupKey}},a=r(o-1),n=r(o+1),l=e=>!!e&&i.some(t=>iL.equal(t,e));if(t){let t=[],i=[];"up"===e&&null!=a&&(l(a)?i.push(s):t.push(a)),"down"===e&&null!=n&&(l(n)?i.push(s):t.push(n)),this.rowSelectionChange({add:t,remove:i})}else{let t="up"===e?a:n;null!=t&&(this.selection=iD.create({rows:[t]}))}}rowSelectionChange({add:e,remove:t}){let i=e=>`${e.id}.${e.groupKey?e.groupKey:""}`,s=new Set(iD.rows(this.selection).map(e=>i(e)));t.forEach(e=>s.delete(i(e))),e.forEach(e=>s.add(i(e)));let o=[...s].map(e=>e.split(".")).map(([e,t])=>({id:e,groupKey:t||void 0}));this.selection=iD.create({rows:o})}rows(e){let t=null!=e?this.tableContainer?.querySelector(`affine-data-view-table-group[data-group-key="${e}"]`):this.tableContainer;return(0,W.Z1)(t),t.querySelectorAll("data-view-table-row")}rowsToArea(e){let t,i,s;let o=new Set(e);if(this.tableContainer){for(let e of this.tableContainer.querySelectorAll("data-view-table-row").values())if(o.has(e.rowId)){if(i=null!=i?Math.min(i,e.rowIndex):e.rowIndex,s=null!=s?Math.max(s,e.rowIndex):e.rowIndex,null==t)t=e.groupKey;else if(t!==e.groupKey)return}if(null==i||null==s)return;return{groupKey:t,start:i,end:s}}}selectionAreaDown(){let e=this.selection;if(!e||"area"!==e.selectionType)return;let t=this.focusToArea(e);t.rowsSelection.start===t.focus.rowIndex?(t.rowsSelection.end=Math.min(this.rows(t.groupKey).length-1,t.rowsSelection.end+1),requestAnimationFrame(()=>{this.getSelectionAreaBorder("bottom")?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})})):(t.rowsSelection.start+=1,requestAnimationFrame(()=>{this.getSelectionAreaBorder("top")?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})})),this.selection=t}selectionAreaLeft(){let e=this.selection;if(!e||"area"!==e.selectionType)return;let t=this.focusToArea(e);t.columnsSelection.end===t.focus.columnIndex?(t.columnsSelection.start=Math.max(0,t.columnsSelection.start-1),requestAnimationFrame(()=>{this.getSelectionAreaBorder("left")?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})})):(t.columnsSelection.end-=1,requestAnimationFrame(()=>{this.getSelectionAreaBorder("right")?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})})),this.selection=t}selectionAreaRight(){let e=this.selection;if(!e||"area"!==e.selectionType)return;let t=this.focusToArea(e);if(t.columnsSelection.start===t.focus.columnIndex){let e=this.rows(t.groupKey)?.item(0).querySelectorAll("affine-database-cell-container").length-1;t.columnsSelection.end=Math.min(e,t.columnsSelection.end+1),requestAnimationFrame(()=>{this.getSelectionAreaBorder("right")?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})})}else t.columnsSelection.start+=1,requestAnimationFrame(()=>{this.getSelectionAreaBorder("left")?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})});this.selection=t}selectionAreaUp(){let e=this.selection;if(!e||"area"!==e.selectionType)return;let t=this.focusToArea(e);t.rowsSelection.end===t.focus.rowIndex?(t.rowsSelection.start=Math.max(0,t.rowsSelection.start-1),requestAnimationFrame(()=>{this.getSelectionAreaBorder("top")?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})})):(t.rowsSelection.end-=1,requestAnimationFrame(()=>{this.getSelectionAreaBorder("bottom")?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})})),this.selection=t}startDrag(e,t,i){let s=t.closest("affine-data-view-table-group")?.group?.key,o=this.tableContainer;if(!o)return;let r=o.parentElement;if(!r)return;let a=o.getBoundingClientRect(),n=e.x-a.left,l=e.y-a.top,h=this.cellPosition(s),u=e=>{this.selection=iZ.create({groupKey:s,rowsSelection:e.row,columnsSelection:e.column,focus:{rowIndex:t.rowIndex,columnIndex:t.columnIndex},isEditing:!1})},p=t6(r,{onScroll(){f.move({x:f.last.x,y:f.last.y})}}),f=eE(e,{transform:e=>({x:e.x,y:e.y}),onDrag:()=>{i&&(this.__dragToFillElement.dragging=!0)},onMove:({x:e,y:s})=>{if(!o)return;let r=o.getBoundingClientRect(),a=h(r.left+n,e,r.top+l,s);return i&&(a.column={start:t.columnIndex,end:t.columnIndex}),u(a),a},onDrop:e=>{e&&(u(e),i&&this.selection&&(this.__dragToFillElement.dragging=!1,function(e,t){let{groupKey:i,rowsSelection:s,columnsSelection:o,focus:r}=t,a=e.selectionController.getCellContainer(i,r.rowIndex,r.columnIndex);if(a&&s&&o){(0,W.U2)(o.start,o.end,"expected selections on a single column");let t=a.column,n=a.cell$.value.value$.value,l=o.start,{start:h,end:u}=s;for(let s=h;s<=u;s++){if(s===r.rowIndex)continue;let o=e.selectionController.getCellContainer(i,s,l);if(!o)continue;let a=o.cell$.value;if(d.Gt.is(t.dataType)){let e=n?.toDelta()??[{insert:""}],t=a.value$.value;if(t)t.clear(),t.applyDelta(e);else{let t=new c.rl.Y.Text;t.applyDelta(e),a.setValue(t)}}else a.setValue(n)}}}(this.host,iZ.create({groupKey:s,rowsSelection:e.row,columnsSelection:e.column,focus:{rowIndex:t.rowIndex,columnIndex:t.columnIndex},isEditing:!1}))))},onClear:()=>{p()}})}toggleRow(e,t){let i={id:e,groupKey:t},s=iD.includes(this.selection,i);this.rowSelectionChange({add:s?[]:[i],remove:s?[i]:[]})}get dragToFillDraggable(){return this.__dragToFillElement.dragToFillRef.value}get selection(){return this._tableViewSelection}set selection(e){if(!e){this.clearSelection();return}let t={...e,viewId:this.view.id,type:"table"};if("area"===t.selectionType&&t.isEditing){let e=t.focus,i=this.getCellContainer(t.groupKey,e.rowIndex,e.columnIndex),s=i?.cell,o=!s||s.beforeEnterEditMode();this.host.setSelection({...t,isEditing:o})}else this.host.setSelection(t)}get tableContainer(){return this.host.querySelector(".affine-database-table-container")}get view(){return this.host.view}get viewData(){return this.view}}let s_=(()=>{let e,t,i=[(0,o.EM)("data-view-table-selection")],r=[],a=(0,w.Tm)(w.ao),n=[],l=[];return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;sb(this,null,[(0,o.MZ)({attribute:!1})],{kind:"accessor",name:"controller",static:!1,private:!1,access:{has:e=>"controller"in e,get:e=>e.controller,set:(e,t)=>{e.controller=t}},metadata:s},n,l),sb(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .database-selection { position: absolute; z-index: 2; box-sizing: border-box; background: var(--affine-primary-color-04); pointer-events: none; display: none; } .database-focus { position: absolute; width: 100%; z-index: 2; box-sizing: border-box; border: 1px solid var(--affine-primary-color); border-radius: 2px; pointer-events: none; display: none; outline: none; } .area-border { position: absolute; pointer-events: none; } .area-left { left: 0; height: 100%; width: 1px; } .area-right { right: 0; height: 100%; width: 1px; } .area-top { top: 0; width: 100%; height: 1px; } .area-bottom { bottom: 0; width: 100%; height: 1px; } @media print { affine-database-selection { display: none; } } `}clearAreaStyle(){let e=this.selectionRef.value;e&&(e.style.display="none")}clearFocusStyle(){let e=this.focusRef.value,t=this.controller.dragToFillDraggable;e&&t&&(e.style.display="none",t.style.display="none")}connectedCallback(){super.connectedCallback(),this.disposables.add((0,eK.QZ)(()=>{this.startUpdate(this.selection$.value)}))}render(){return(0,s.qy)`
`}startUpdate(e){if(this.preTask&&(cancelAnimationFrame(this.preTask),this.preTask=0),e?.selectionType!=="area"||this.controller.host.view.readonly$.value)this.clearFocusStyle(),this.clearAreaStyle();else{this.updateAreaSelectionStyle(e.groupKey,e.rowsSelection,e.columnsSelection);let t=this.controller.__dragToFillElement.dragging,i=e.isEditing;this.updateFocusSelectionStyle(e.groupKey,e.focus,i,!i&&t),this.preTask=requestAnimationFrame(()=>this.startUpdate(this.selection$.value))}}updateAreaSelectionStyle(e,t,i){let s=this.selectionRef.value;if(!s)return;let o=this.controller.tableContainer;if(!o)return;let r=o.getBoundingClientRect(),a=this.controller.getRect(e,t?.start??0,t?.end??this.controller.view.rows$.value.length-1,i?.start??0,i?.end??this.controller.view.columnManagerList$.value.length-1);if(!a){this.clearAreaStyle();return}let{left:n,top:l,width:c,height:d,scale:h}=a;s.style.left=`${n-r.left/h}px`,s.style.top=`${l-r.top/h}px`,s.style.width=`${c}px`,s.style.height=`${d}px`,s.style.display="block"}updateFocusSelectionStyle(e,t,i,s=!1){let o=this.focusRef.value,r=this.controller.dragToFillDraggable;if(!o||!r||(this.controller.rows(e)??[]).length<=t.rowIndex)return;let a=this.controller.getRect(e,t.rowIndex,t.rowIndex,t.columnIndex,t.columnIndex);if(!a){this.clearFocusStyle();return}let{left:n,top:l,width:c,height:d,scale:h}=a,u=this.controller.tableContainer;if(!u)return;let p=u.getBoundingClientRect(),f=n-p.left/h,g=l-1-p.top/h,m=c+1,v=d+1;o.style.left=`${f}px`,o.style.top=`${g}px`,o.style.width=`${m}px`,o.style.height=`${v}px`,o.style.borderColor="var(--affine-primary-color)",o.style.borderStyle=this.controller.__dragToFillElement.dragging?"dashed":"solid",o.style.boxShadow=i?"0px 0px 0px 2px rgba(30, 150, 235, 0.30)":"unset",o.style.display="block",r.style.left=`${f+m}px`,r.style.top=`${g+v}px`,r.style.display=s?"block":"none"}get selection$(){return this.controller.host.selection$}#tj;get controller(){return this.#tj}set controller(e){this.#tj=e}constructor(){super(...arguments),this.focusRef=(0,eQ._)(),this.preTask=0,this.selectionRef=(0,eQ._)(),this.#tj=sw(this,n,void 0),sw(this,l)}static{sw(t,r)}},t})();var sC=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sk=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a=[(0,o.EM)("affine-database-column-stats")],n=[],l=(0,w.Tm)(s.WF),c=[],d=[],h=[],u=[];(class extends l{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],sC(this,null,i,{kind:"accessor",name:"group",static:!1,private:!1,access:{has:e=>"group"in e,get:e=>e.group,set:(e,t)=>{e.group=t}},metadata:s},c,d),sC(this,null,r,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:s},h,u),sC(null,e={value:t},a,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=sS}render(){let e=this.view.columnManagerList$.value;return(0,s.qy)`
${(0,el.u)(e,e=>e.id,e=>(0,s.qy)``)}
`}#tC=sk(this,c,void 0);get group(){return this.#tC}set group(e){this.#tC=e}#tt=(sk(this,d),sk(this,h,void 0));get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),sk(this,u)}static{sk(t,n)}})})();var sM=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sE=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l=[(0,o.EM)("affine-database-column-stats-cell")],c=[],d=(0,w.Tm)(s.WF),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[];(class extends d{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.wk)()],n=[(0,o.wk)()],sM(this,null,i,{kind:"accessor",name:"column",static:!1,private:!1,access:{has:e=>"column"in e,get:e=>e.column,set:(e,t)=>{e.column=t}},metadata:s},h,u),sM(this,null,r,{kind:"accessor",name:"group",static:!1,private:!1,access:{has:e=>"group"in e,get:e=>e.group,set:(e,t)=>{e.group=t}},metadata:s},p,f),sM(this,null,a,{kind:"accessor",name:"operation",static:!1,private:!1,access:{has:e=>"operation"in e,get:e=>e.operation,set:(e,t)=>{e.operation=t}},metadata:s},g,m),sM(this,null,n,{kind:"accessor",name:"result",static:!1,private:!1,access:{has:e=>"result"in e,get:e=>e.result,set:(e,t)=>{e.result=t}},metadata:s},v,y),sM(null,e={value:t},l,{kind:"class",name:t.name,metadata:s},null,c),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=sI}getResultString(){if(!this.result||!isFinite(this.result.value))return"";let{displayFormat:e,value:t}=this.result;switch(e){case"%":return`${(100*t).toFixed(3)}%`;case"x10":return`${t}`}}calculate(){this.operation&&(this.result=this.operation.calculate(this.column,this.group))}connectedCallback(){super.connectedCallback(),this.operation=function(e){let t=st.find(t=>t.type===e);return(0,W.Z1)(t,`Invalid operation type ${e}`),t}(this.column.statCalcOp),this.calculate(),this.disposables.addFromEvent(this,"click",this.openMenu)}getColumnType(){let e=this.column.type;return"number"===e||"checkbox"===e?e:"other"}render(){let e={width:`${this.column.width$.value}px`};return(0,s.qy)`
${this.operation&&"none"!==this.operation.type?(0,s.qy)` ${this.operation.display} ${this.getResultString()} `:(0,s.qy)`Calculate ${Y.ZLN}`}
`}#e6;get column(){return this.#e6}set column(e){this.#e6=e}#tC;get group(){return this.#tC}set group(e){this.#tC=e}#tV;get operation(){return this.#tV}set operation(e){this.#tV=e}#tz;get result(){return this.#tz}set result(e){this.#tz=e}constructor(){super(...arguments),this.onSelect=e=>{if("none"===e.type){this.operation=null,this.result=null;return}this.column.updateStatCalcOp(e.type),this.operation=e,this.calculate()},this.openMenu=e=>{so((0,t5.mD)(this),e.target,this.column,this.getColumnType(),this.onSelect)},this.#e6=sE(this,h,void 0),this.#tC=(sE(this,u),sE(this,p,void 0)),this.#tV=(sE(this,f),sE(this,g,null)),this.#tz=(sE(this,m),sE(this,v,null)),sE(this,y)}static{sE(t,c)}})})();var sB=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},s$=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l=[(0,o.EM)("affine-data-view-table-group")],c=[],d=(0,eK.Jb)((0,w.Tm)(w.ao)),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[];(class extends d{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],sB(this,null,i,{kind:"accessor",name:"dataViewEle",static:!1,private:!1,access:{has:e=>"dataViewEle"in e,get:e=>e.dataViewEle,set:(e,t)=>{e.dataViewEle=t}},metadata:s},h,u),sB(this,null,r,{kind:"accessor",name:"group",static:!1,private:!1,access:{has:e=>"group"in e,get:e=>e.group,set:(e,t)=>{e.group=t}},metadata:s},p,f),sB(this,null,a,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:s},g,m),sB(this,null,n,{kind:"accessor",name:"viewEle",static:!1,private:!1,access:{has:e=>"viewEle"in e,get:e=>e.viewEle,set:(e,t)=>{e.viewEle=t}},metadata:s},v,y),sB(null,e={value:t},l,{kind:"class",name:t.name,metadata:s},null,c),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=sT}renderRows(e){return(0,s.qy)`
${(0,el.u)(e,e=>e,(e,t)=>(0,s.qy)``)}
${this.view.readonly$.value?null:(0,s.qy)`
${e0.PlusIcon}New Record
`} ${this.view.featureFlags$.value.enable_database_statistics?(0,s.qy)` `:null} `}render(){return this.renderRows(this.rows)}updated(e){super.updated(e),this.querySelectorAll("data-view-table-row").forEach(e=>{e.requestUpdate()})}get rows(){return this.group?.rows??this.view.rows$.value}#tg;get dataViewEle(){return this.#tg}set dataViewEle(e){this.#tg=e}#tC;get group(){return this.#tC}set group(e){this.#tC=e}#tt;get view(){return this.#tt}set view(e){this.#tt=e}#tR;get viewEle(){return this.#tR}set viewEle(e){this.#tR=e}constructor(){super(...arguments),this.clickAddRow=()=>{this.view.rowAdd("end",this.group?.key),requestAnimationFrame(()=>{let e=this.viewEle.selectionController,t=this.view.columnManagerList$.value.findIndex(e=>"title"===e.type);e.selection=iZ.create({groupKey:this.group?.key,focus:{rowIndex:this.rows.length-1,columnIndex:t},isEditing:!0})})},this.clickAddRowInStart=()=>{this.view.rowAdd("start",this.group?.key),requestAnimationFrame(()=>{let e=this.viewEle.selectionController,t=this.view.columnManagerList$.value.findIndex(e=>"title"===e.type);e.selection=iZ.create({groupKey:this.group?.key,focus:{rowIndex:0,columnIndex:t},isEditing:!0})})},this.clickGroupOptions=e=>{let t=this.group;if(!t)return;let i=e.currentTarget;(0,e1.$E)(i,[{type:"action",name:"Ungroup",hide:()=>null==t.value,select:()=>{t.rows.forEach(e=>{t.helper.removeFromGroup(e,t.key)})}},{type:"action",name:"Delete Cards",select:()=>{this.view.rowDelete(t.rows)}}])},this.renderGroupHeader=()=>this.group?(0,s.qy)`
${io(this.group,{readonly:this.view.readonly$.value,clickAdd:this.clickAddRowInStart,clickOps:this.clickGroupOptions})}
`:null,this.#tg=s$(this,h,void 0),this.#tC=(s$(this,u),s$(this,p,void 0)),this.#tt=(s$(this,f),s$(this,g,void 0)),this.#tR=(s$(this,m),s$(this,v,void 0)),s$(this,y)}static{s$(t,c)}})})();var sO=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sP=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-table")],s=[],r=t1;return class extends r{static{t=this}constructor(){super(...arguments),this._addRow=(e,t)=>{if(this.readonly)return;let i="number"==typeof t?t:(0,tZ.q)(t,this.view.rows$.value.map(e=>({id:e})));e.rowAdd(t),requestAnimationFrame(()=>{this.selectionController.selection=iZ.create({focus:{rowIndex:i,columnIndex:0},isEditing:!0})})},this.clipboardController=new sh(this),this.dragController=new su(this),this.getSelection=()=>this.selectionController.selection,this.hotkeysController=new sg(this),this.onWheel=e=>{if(e.metaKey||e.ctrlKey)return;let t=e.currentTarget;if(t instanceof HTMLElement){if(t.scrollWidth===t.clientWidth)return;e.stopPropagation()}},this.renderAddGroup=e=>{let t=e.addGroup;if(t)return(0,G.qy)`
${Y.N7w}
New Group
`},this.selectionController=new sx(this)}static{let o="function"==typeof Symbol&&Symbol.metadata?Object.create(r[Symbol.metadata]??null):void 0;sO(null,e={value:t},i,{kind:"class",name:t.name,metadata:o},null,s),t=e.value,o&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static{this.styles=sH}get readonly(){return this.view.readonly$.value}renderTable(){let e=this.view.groupHelper;return e?(0,G.qy)`
${e.groups.map(e=>(0,G.qy)``)} ${this.renderAddGroup(e)}
`:(0,G.qy)``}addRow(e){this._addRow(this.view,e)}focusFirstCell(){this.selectionController.focusFirstCell()}hideIndicator(){this.dragController.dropPreview.remove()}moveTo(e,t){let i=this.dragController.getInsertPosition(t);i&&this.view.rowMove(e,i.position,void 0,i.groupKey)}render(){return(0,G.qy)` ${(0,e5.ep)(this.headerWidget,{view:this.view,viewMethods:this})}
${this.renderTable()}
`}showIndicator(e){return null!=this.dragController.showIndicator(e)}static{sP(t,s)}},t})(),sL={tableViewConfig:iH.rendererConfig({view:(0,e5.Z4)(sA),icon:(0,a.w)("DatabaseTableViewIcon")}),kanbanViewConfig:iO};var sD=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sZ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n=[(0,o.EM)("variable-ref-view")],l=[],c=(0,w.Tm)(w.ao),d=[],h=[],u=[],p=[],f=[],g=[];(class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],sD(this,null,i,{kind:"accessor",name:"data",static:!1,private:!1,access:{has:e=>"data"in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:s},d,h),sD(this,null,r,{kind:"accessor",name:"setData",static:!1,private:!1,access:{has:e=>"setData"in e,get:e=>e.setData,set:(e,t)=>{e.setData=t}},metadata:s},u,p),sD(this,null,a,{kind:"accessor",name:"vars",static:!1,private:!1,access:{has:e=>"vars"in e,get:e=>e.vars,set:(e,t)=>{e.vars=t}},metadata:s},f,g),sD(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` variable-ref-view { font-size: 12px; line-height: 20px; display: flex; align-items: center; gap: 6px; padding: 0 4px; border-radius: 4px; cursor: pointer; } variable-ref-view:hover { background-color: var(--affine-hover-color); } variable-ref-view svg { width: 16px; height: 16px; fill: var(--affine-icon-color); color: var(--affine-icon-color); } `}connectedCallback(){super.connectedCallback(),this.disposables.addFromEvent(this,"click",e=>{(0,e1.$E)(e.target,this.vars.map(e=>({type:"action",name:e.name,icon:(0,e2.ep)(e.icon,{}),select:()=>{this.setData({type:"ref",name:e.id})}})))})}render(){let e=this.fieldData;return(0,s.qy)` ${(0,e2.ep)(e?.icon,{})} ${e?.name} `}get field(){return this.data?"ref"===this.data.type?this.data.name:this.data.ref.name:void 0}get fieldData(){let e=this.field;if(e)return this.vars.find(t=>t.id===e)}get property(){if(this.data&&"ref"!==this.data.type)return this.data.propertyFuncName}#tl=sZ(this,d,void 0);get data(){return this.#tl}set data(e){this.#tl=e}#tF=(sZ(this,h),sZ(this,u,void 0));get setData(){return this.#tF}set setData(e){this.#tF=e}#tN=(sZ(this,p),sZ(this,f,void 0));get vars(){return this.#tN}set vars(e){this.#tN=e}constructor(){super(...arguments),sZ(this,g)}static{sZ(t,l)}})})();let sj=(e,t)=>{(0,e1.$E)(e,[...t.vars.map(e=>({type:"action",name:e.name,icon:(0,e2.ep)(e.icon,{}),select:()=>{t.onSelect((0,tR.BZ)(t.vars,{type:"ref",name:e.id}))}})),{type:"group",name:"",children:()=>[{type:"action",name:"Add filter group",icon:Y.N7w,select:()=>{t.onSelect((0,tR.Jz)(t.vars))}}]}],t.onClose)};var sV=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sz=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,r=[(0,o.EM)("any-render")],a=[],n=(0,eK.Jb)(w.ao),l=[],c=[],d=[],h=[];return class extends n{static{t=this}static{let u="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],s=[(0,o.MZ)({attribute:!1})],sV(this,null,i,{kind:"accessor",name:"props",static:!1,private:!1,access:{has:e=>"props"in e,get:e=>e.props,set:(e,t)=>{e.props=t}},metadata:u},l,c),sV(this,null,s,{kind:"accessor",name:"renderTemplate",static:!1,private:!1,access:{has:e=>"renderTemplate"in e,get:e=>e.renderTemplate,set:(e,t)=>{e.renderTemplate=t}},metadata:u},d,h),sV(null,e={value:t},r,{kind:"class",name:t.name,metadata:u},null,a),t=e.value,u&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:u}),sz(t,a)}render(){return this.renderTemplate(this.props)}#tq=sz(this,l,void 0);get props(){return this.#tq}set props(e){this.#tq=e}#tU=(sz(this,c),sz(this,d,void 0));get renderTemplate(){return this.#tU}set renderTemplate(e){this.#tU=e}constructor(){super(...arguments),sz(this,h)}},t})(),sF=e=>{let t=new sR;return t.renderTemplate=e,t};var sN=i(39514);let sq=(e,t,i)=>{let s=sW.match(e);if(s)return(0,e2.ep)(s.view,{value:t,onChange:i,type:e})},sU=(e,t,i,s)=>{let o=sW.match(t);o&&o.popEdit(e,{value:i,onChange:s,type:t})},sW=new sN.P;var sG=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sY=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s=(0,w.Tm)(w.ao),r=[],a=[],n=[],l=[],c=[],d=[];return class extends s{static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(s[Symbol.metadata]??null):void 0;e=[(0,o.MZ)({attribute:!1})],t=[(0,o.MZ)({attribute:!1})],i=[(0,o.MZ)({attribute:!1})],sG(this,null,e,{kind:"accessor",name:"onChange",static:!1,private:!1,access:{has:e=>"onChange"in e,get:e=>e.onChange,set:(e,t)=>{e.onChange=t}},metadata:h},r,a),sG(this,null,t,{kind:"accessor",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:h},n,l),sG(this,null,i,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:h},c,d),h&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}#eY=sY(this,r,void 0);get onChange(){return this.#eY}set onChange(e){this.#eY=e}#tW=(sY(this,a),sY(this,n,void 0));get type(){return this.#tW}set type(e){this.#tW=e}#eJ=(sY(this,l),sY(this,c,void 0));get value(){return this.#eJ}set value(e){this.#eJ=e}constructor(){super(...arguments),sY(this,d)}}})(),sX=(()=>{let e,t,i=[(0,o.EM)("data-view-literal-boolean-view")],s=[],r=sK;return class extends r{static{t=this}static{let o="function"==typeof Symbol&&Symbol.metadata?Object.create(r[Symbol.metadata]??null):void 0;sG(null,e={value:t},i,{kind:"class",name:t.name,metadata:o},null,s),t=e.value,o&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o}),sY(t,s)}render(){return this.value?"True":"False"}},t})(),sQ=(()=>{let e,t,i=[(0,o.EM)("data-view-literal-number-view")],r=[],a=sK;return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;sG(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` data-view-literal-number-view { display: block; max-width: 100px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } `}render(){return this.value?.toString()??(0,s.qy)`Value`}static{sY(t,r)}},t})(),sJ=(()=>{let e,t,i=[(0,o.EM)("data-view-literal-string-view")],r=[],a=sK;return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;sG(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` data-view-literal-string-view { display: block; max-width: 100px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } `}render(){return this.value?.toString()??(0,s.qy)`Value`}static{sY(t,r)}},t})();var s1=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},s0=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("data-view-literal-date-view")],r=[],a=sK;return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;s1(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),s0(t,r)}render(){return this.value?(0,b.GP)(new Date(this.value),"yyyy/MM/dd"):(0,s.qy)`Value`}},t})();var s5=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},s7=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("data-view-literal-tag-view")],r=[],a=sK;return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;s5(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` data-view-literal-tag-view { max-width: 100px; display: block; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } `}render(){return this.value?this.tags().find(e=>e.id===this.value)?.value??(0,s.qy)`Value`:(0,s.qy)`Value`}tags(){return this.type.data?.tags||[]}static{s7(t,r)}},t})(),s4=(()=>{let e,t,i=[(0,o.EM)("data-view-literal-multi-tag-view")],r=[],a=sK;return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;s5(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` data-view-literal-multi-tag-view { max-width: 100px; display: block; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; } `}render(){if(!this.value?.length)return(0,s.qy)`Value`;let e=new Map(this.tags().map(e=>[e.id,e.value]));return(0,s.qy)`${this.value.map(t=>e.get(t)).join(",")}`}tags(){let e=this.type.ele;return d.l0.is(e)&&e.data?.tags||[]}static{s7(t,r)}},t})();sW.register(d.dG.create(),{view:(0,e2.Z4)(sX),popEdit:(e,{value:t,onChange:i})=>{(0,e1.zs)(e,{options:{input:{search:!0},items:[!0,!1].map(e=>({type:"action",name:e.toString().toUpperCase(),isSelected:e===t,select:()=>{i(e)}}))}})}}),sW.register(d.si.create(),{view:(0,e2.Z4)(sJ),popEdit:(e,{value:t,onChange:i})=>{(0,e1.zs)(e,{options:{input:{initValue:t?.toString()??"",onComplete:e=>{i(e||void 0)}},items:[]}})}}),sW.register(d.Qc.create(),{view:(0,e2.Z4)(sQ),popEdit:(e,{value:t,onChange:i})=>{(0,e1.zs)(e,{options:{input:{initValue:t?.toString()??"",onComplete:e=>{if(!e){i(void 0);return}let t=Number.parseFloat(e);Number.isNaN(t)||i(t)}},items:[]}})}}),sW.register((0,tg.cX)(d.l0.create()),{view:(0,e2.Z4)(s4),popEdit:(e,{value:t,onChange:i,type:o})=>{if(!(0,tg.Oq)(o)||!d.l0.is(o.ele))return;let r=Array.isArray(t)?t:[];(0,e1.zs)(e,{options:{input:{search:!0},items:o.ele.data?.tags.map(e=>{let t=S.W({backgroundColor:e.color,padding:"0 8px",width:"max-content"});return{type:"checkbox",name:e.value,checked:r.includes(e.id),label:()=>s.qy`
${e.value}
`,select:t=>t?(i(r=r.filter(t=>t!==e.id)),!1):(i(r=[...r,e.id]),!0)}})??[]}})}}),sW.register(d.l0.create(),{view:(0,e2.Z4)(s3),popEdit:(e,{onChange:t,type:i})=>{d.l0.is(i)&&(0,e1.zs)(e,{options:{input:{search:!0},items:i.data?.tags.map(e=>{let i=S.W({backgroundColor:e.color,padding:"0 8px",width:"max-content"});return{type:"action",name:e.value,label:()=>s.qy`
${e.value}
`,select:()=>{t(e.id)}}})??[]}})}}),sW.register(d.vi.create(),{view:(0,e2.Z4)(s2),popEdit:(e,{value:t,onChange:i})=>{let s=document.createElement("input");s.type="date",s.click(),s.valueAsNumber=t,document.body.append(s),s.style.position="absolute";let o=(0,e1.fx)(e,s);requestAnimationFrame(()=>{s.showPicker(),s.onchange=()=>{i(s.valueAsNumber),o()}})}});var s6=i(42764),s8=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},s9=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l=[(0,o.EM)("filter-condition-view")],c=[],h=(0,w.Tm)(w.ao),u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[];(class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],s8(this,null,i,{kind:"accessor",name:"data",static:!1,private:!1,access:{has:e=>"data"in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:s},u,p),s8(this,null,r,{kind:"accessor",name:"onDelete",static:!1,private:!1,access:{has:e=>"onDelete"in e,get:e=>e.onDelete,set:(e,t)=>{e.onDelete=t}},metadata:s},f,g),s8(this,null,a,{kind:"accessor",name:"setData",static:!1,private:!1,access:{has:e=>"setData"in e,get:e=>e.setData,set:(e,t)=>{e.setData=t}},metadata:s},m,v),s8(this,null,n,{kind:"accessor",name:"vars",static:!1,private:!1,access:{has:e=>"vars"in e,get:e=>e.vars,set:(e,t)=>{e.vars=t}},metadata:s},y,b),s8(null,e={value:t},l,{kind:"class",name:t.name,metadata:s},null,c),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` filter-condition-view { display: flex; align-items: center; padding: 4px; gap: 16px; border: 1px solid var(--affine-border-color); border-radius: 8px; background-color: var(--affine-white); } .filter-condition-expression { display: flex; align-items: center; gap: 4px; } .filter-condition-delete { border-radius: 4px; display: flex; align-items: center; justify-content: center; height: max-content; cursor: pointer; } .filter-condition-delete:hover { background-color: var(--affine-hover-color); } .filter-condition-delete svg { width: 16px; height: 16px; } .filter-condition-function-name { font-size: 12px; line-height: 20px; color: var(--affine-text-secondary-color); padding: 2px 8px; border-radius: 4px; cursor: pointer; } .filter-condition-function-name:hover { background-color: var(--affine-hover-color); } .filter-condition-arg { font-size: 12px; font-style: normal; font-weight: 600; padding: 0 4px; height: 100%; display: flex; align-items: center; } `}_args(){let e=s6.p.find(e=>e.data.name===this.data.function);if(!e)return[];let t=(0,tR.us)(this.vars,this.data.left);return t?tg.Sy.instance({},[t],d.dG.create(),e.type).args.slice(1):[]}_filterLabel(){return s6.p.find(e=>e.data.name===this.data.function)?.data.label}_filterList(){let e=(0,tR.us)(this.vars,this.data.left);return e?s6.p.allMatchedData(e):[]}_selectFilter(e){let t=e.currentTarget,i=this._filterList();(0,e1.$E)(t,i.map(e=>{let t=e.name===this.data.function;return{type:"action",name:e.label,isSelected:t,select:()=>{this.setData({...this.data,function:e.name})}}}))}render(){let e=this.data;return(0,s.qy)`
${this._filterLabel()}
${(0,el.u)(this._args(),(e,t)=>{let i=this.data.args[t],o=e=>{let i=this.data.args.slice();i[t]={type:"literal",value:e},this.setData({...this.data,args:i})};return(0,s.qy)`
${sq(e,i?.value,o)}
`})}
${this.onDelete?(0,s.qy)`
${e0.CrossIcon}
`:s.s6} `}#tl;get data(){return this.#tl}set data(e){this.#tl=e}#tG;get onDelete(){return this.#tG}set onDelete(e){this.#tG=e}#tF;get setData(){return this.#tF}set setData(e){this.#tF=e}#tN;get vars(){return this.#tN}set vars(e){this.#tN=e}constructor(){super(...arguments),this._setRef=e=>{this.setData((0,tR.BZ)(this.vars,e))},this.#tl=s9(this,u,void 0),this.#tG=(s9(this,p),s9(this,f,void 0)),this.#tF=(s9(this,g),s9(this,m,void 0)),this.#tN=(s9(this,v),s9(this,y,void 0)),s9(this,b)}static{s9(t,c)}})})();let oe=(e,t)=>{(0,e1.$E)(e,[{type:"action",name:"Add filter",select:()=>{t.onChange({...t.value,conditions:[...t.value.conditions,(0,tR.RL)(t.vars)]})}},{type:"action",name:"Add filter group",select:()=>{t.onChange({...t.value,conditions:[...t.value.conditions,(0,tR.Jz)(t.vars)]})}}])};var ot=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oi=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c=[(0,o.EM)("filter-group-view")],d=[],h=(0,w.Tm)(w.ao),u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],x=[],_=[];(class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.wk)()],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],ot(this,null,i,{kind:"accessor",name:"containerClass",static:!1,private:!1,access:{has:e=>"containerClass"in e,get:e=>e.containerClass,set:(e,t)=>{e.containerClass=t}},metadata:s},u,p),ot(this,null,r,{kind:"accessor",name:"data",static:!1,private:!1,access:{has:e=>"data"in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:s},f,g),ot(this,null,a,{kind:"accessor",name:"depth",static:!1,private:!1,access:{has:e=>"depth"in e,get:e=>e.depth,set:(e,t)=>{e.depth=t}},metadata:s},m,v),ot(this,null,n,{kind:"accessor",name:"setData",static:!1,private:!1,access:{has:e=>"setData"in e,get:e=>e.setData,set:(e,t)=>{e.setData=t}},metadata:s},y,b),ot(this,null,l,{kind:"accessor",name:"vars",static:!1,private:!1,access:{has:e=>"vars"in e,get:e=>e.vars,set:(e,t)=>{e.vars=t}},metadata:s},x,_),ot(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` filter-group-view { border-radius: 4px; padding: 8px 4px 4px; display: flex; flex-direction: column; user-select: none; } .filter-group-op { width: 60px; display: flex; justify-content: end; padding: 4px; height: 34px; align-items: center; font-size: 14px; font-style: normal; font-weight: 400; line-height: 22px; color: var(--affine-text-primary-color); } .filter-group-op-clickable { border-radius: 4px; cursor: pointer; } .filter-group-op-clickable:hover { background-color: var(--affine-hover-color); } .filter-group-container { display: flex; flex-direction: column; gap: 2px; } .filter-group-button { padding: 8px 12px; display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 22px; border-radius: 4px; cursor: pointer; color: var(--affine-text-secondary-color); } .filter-group-button svg { fill: var(--affine-text-secondary-color); color: var(--affine-text-secondary-color); width: 20px; height: 20px; } .filter-group-button:hover { background-color: var(--affine-hover-color); color: var(--affine-text-primary-color); } .filter-group-button:hover svg { fill: var(--affine-text-primary-color); color: var(--affine-text-primary-color); } .filter-group-item { padding: 4px 0; display: flex; align-items: start; gap: 8px; } .filter-group-item-ops { margin-top: 4px; padding: 4px; border-radius: 4px; height: max-content; display: flex; cursor: pointer; } .filter-group-item-ops:hover { background-color: var(--affine-hover-color); } .filter-group-item-ops svg { fill: var(--affine-text-secondary-color); color: var(--affine-text-secondary-color); width: 18px; height: 18px; } .filter-group-item-ops:hover svg { fill: var(--affine-text-primary-color); color: var(--affine-text-primary-color); } .delete-style { background-color: var(--affine-background-error-color); } .filter-group-border { border: 1px dashed var(--affine-border-color); } .filter-group-bg-1 { background-color: var(--affine-background-secondary-color); border: 1px solid var(--affine-border-color); } .filter-group-bg-2 { background-color: var(--affine-background-tertiary-color); border: 1px solid var(--affine-border-color); } .hover-style { background-color: var(--affine-hover-color); } .delete-style { background-color: var(--affine-background-error-color); } `}_clickConditionOps(e,t){let i=this.data.conditions[t];(0,e1.$E)(e,[{type:"action",name:"filter"===i.type?"Turn into group":"Wrap in group",icon:e0.ConvertIcon,onHover:e=>{this.containerClass=e?{index:t,class:"hover-style"}:void 0},hide:()=>this.depth+os(i)>3,select:()=>{this.setData({type:"group",op:"and",conditions:[this.data]})}},{type:"action",name:"Duplicate",icon:Y.jaP,onHover:e=>{this.containerClass=e?{index:t,class:"hover-style"}:void 0},select:()=>{let e=[...this.data.conditions];e.splice(t+1,0,JSON.parse(JSON.stringify(e[t]))),this.setData({...this.data,conditions:e})}},{type:"group",name:"",children:()=>[{type:"action",name:"Delete",icon:e0.DeleteIcon,class:"delete-item",onHover:e=>{this.containerClass=e?{index:t,class:"delete-style"}:void 0},select:()=>{let e=[...this.data.conditions];e.splice(t,1),this.setData({...this.data,conditions:e})}}]}])}get isMaxDepth(){return 3===this.depth}render(){let e=this.data;return(0,s.qy)`
${(0,el.u)(e.conditions,(t,i)=>{let o;let r=e=>{e.stopPropagation(),e.preventDefault(),this._clickConditionOps(e.target,i)};o=0===i?(0,s.qy)`
Where
`:(0,s.qy)`
${this.opMap[e.op]}
`;let a=(0,k.H)({"filter-root-item":!0,"filter-exactly-hover-container":!0,"dv-pd-4 dv-round-4":!0,[this.containerClass?.class??""]:this.containerClass?.index===i}),n=(0,k.H)({[`filter-group-bg-${this.depth}`]:"filter"!==t.type});return(0,s.qy)`
${o}
${"filter"===t.type?(0,s.qy)` `:(0,s.qy)` `}
${e0.MoreHorizontalIcon}
`})}
${e0.PlusIcon} Add ${this.isMaxDepth?s.s6:Y.SAc}
`}#tY;get containerClass(){return this.#tY}set containerClass(e){this.#tY=e}#tl;get data(){return this.#tl}set data(e){this.#tl=e}#tK;get depth(){return this.#tK}set depth(e){this.#tK=e}#tF;get setData(){return this.#tF}set setData(e){this.#tF=e}#tN;get vars(){return this.#tN}set vars(e){this.#tN=e}constructor(){super(...arguments),this._addNew=e=>{if(this.isMaxDepth){this.setData({...this.data,conditions:[...this.data.conditions,(0,tR.RL)(this.vars)]});return}oe(e.target,{value:this.data,onChange:this.setData,vars:this.vars})},this._selectOp=e=>{(0,e1.$E)(e.target,[{type:"action",name:"And",select:()=>{this.setData({...this.data,op:"and"})}},{type:"action",name:"Or",select:()=>{this.setData({...this.data,op:"or"})}}])},this._setFilter=(e,t)=>{this.setData({...this.data,conditions:this.data.conditions.map((i,s)=>e===s?t:i)})},this.opMap={and:"And",or:"Or"},this.#tY=oi(this,u,void 0),this.#tl=(oi(this,p),oi(this,f,void 0)),this.#tK=(oi(this,g),oi(this,m,1)),this.#tF=(oi(this,v),oi(this,y,void 0)),this.#tN=(oi(this,b),oi(this,x,void 0)),oi(this,_)}static{oi(t,d)}})})();let os=e=>"filter"===e.type?1:Math.max(...e.conditions.map(os))+1,oo=(e,t,i)=>({type:"custom",render:()=>(0,s.qy)`
${or(e,t)}
${i?.right}
`}),or=(e,t)=>(0,s.qy)`
${e0.ArrowLeftBigIcon}
${e}
`;var oa=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},on=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c=[(0,o.EM)("filter-root-view")],d=[],h=(0,w.Tm)(w.ao),u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],x=[],_=[];(class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.wk)()],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],oa(this,null,i,{kind:"accessor",name:"containerClass",static:!1,private:!1,access:{has:e=>"containerClass"in e,get:e=>e.containerClass,set:(e,t)=>{e.containerClass=t}},metadata:s},u,p),oa(this,null,r,{kind:"accessor",name:"data",static:!1,private:!1,access:{has:e=>"data"in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:s},f,g),oa(this,null,a,{kind:"accessor",name:"onBack",static:!1,private:!1,access:{has:e=>"onBack"in e,get:e=>e.onBack,set:(e,t)=>{e.onBack=t}},metadata:s},m,v),oa(this,null,n,{kind:"accessor",name:"setData",static:!1,private:!1,access:{has:e=>"setData"in e,get:e=>e.setData,set:(e,t)=>{e.setData=t}},metadata:s},y,b),oa(this,null,l,{kind:"accessor",name:"vars",static:!1,private:!1,access:{has:e=>"vars"in e,get:e=>e.vars,set:(e,t)=>{e.vars=t}},metadata:s},x,_),oa(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` filter-root-view { border-radius: 4px; display: flex; flex-direction: column; user-select: none; } .filter-root-title { padding: 12px; font-size: 14px; font-weight: 600; line-height: 22px; color: var(--affine-text-primary-color); } .filter-root-op { width: 60px; display: flex; justify-content: end; padding: 4px; height: 34px; align-items: center; } .filter-root-op-clickable { border-radius: 4px; cursor: pointer; } .filter-root-op-clickable:hover { background-color: var(--affine-hover-color); } .filter-root-container { display: flex; flex-direction: column; gap: 4px; max-height: 400px; overflow: auto; padding: 0 12px 0 8px; } .filter-root-button { margin: 4px 8px 8px; padding: 8px 12px; display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 22px; border-radius: 4px; cursor: pointer; color: var(--affine-text-secondary-color); } .filter-root-button svg { fill: var(--affine-text-secondary-color); color: var(--affine-text-secondary-color); width: 20px; height: 20px; } .filter-root-button:hover { background-color: var(--affine-hover-color); color: var(--affine-text-primary-color); } .filter-root-button:hover svg { fill: var(--affine-text-primary-color); color: var(--affine-text-primary-color); } .filter-root-item { padding: 4px 0; display: flex; align-items: start; gap: 8px; } .filter-group-title { font-size: 14px; font-style: normal; font-weight: 500; line-height: 22px; display: flex; align-items: center; color: var(--affine-text-primary-color); gap: 6px; } .filter-root-item-ops { margin-top: 2px; padding: 4px; border-radius: 4px; height: max-content; display: flex; cursor: pointer; } .filter-root-item-ops:hover { background-color: var(--affine-hover-color); } .filter-root-item-ops svg { fill: var(--affine-text-secondary-color); color: var(--affine-text-secondary-color); width: 18px; height: 18px; } .filter-root-item-ops:hover svg { fill: var(--affine-text-primary-color); color: var(--affine-text-primary-color); } .filter-root-grabber { cursor: grab; width: 4px; height: 12px; background-color: var(--affine-placeholder-color); border-radius: 1px; } .divider { height: 1px; background-color: var(--affine-divider-color); flex-shrink: 0; margin: 8px 0; } `}_clickConditionOps(e,t){let i=this.data.conditions[t];(0,e1.$E)(e,[{type:"action",name:"filter"===i.type?"Turn into group":"Wrap in group",icon:e0.ConvertIcon,onHover:e=>{this.containerClass=e?{index:t,class:"hover-style"}:void 0},hide:()=>os(i)>3,select:()=>{this.setData({type:"group",op:"and",conditions:[this.data]})}},{type:"action",name:"Duplicate",icon:Y.jaP,onHover:e=>{this.containerClass=e?{index:t,class:"hover-style"}:void 0},select:()=>{let e=[...this.data.conditions];e.splice(t+1,0,JSON.parse(JSON.stringify(e[t]))),this.setData({...this.data,conditions:e})}},{type:"group",name:"",children:()=>[{type:"action",name:"Delete",icon:e0.DeleteIcon,class:"delete-item",onHover:e=>{this.containerClass=e?{index:t,class:"delete-style"}:void 0},select:()=>{let e=[...this.data.conditions];e.splice(t,1),this.setData({...this.data,conditions:e})}}]}])}render(){let e=this.data;return(0,s.qy)`
${or("FILTER",()=>{this.onBack?.()})}
${(0,el.u)(e.conditions,(t,i)=>{let o=e=>{e.stopPropagation(),e.preventDefault(),this._clickConditionOps(e.target,i)},r=(0,s.qy)`
${e0.MoreHorizontalIcon}
`,a="filter"===t.type?(0,s.qy)`
${r}
`:(0,s.qy)`
Filter group
${r}
`,n=(0,k.H)({"filter-root-item":!0,"filter-exactly-hover-container":!0,"dv-pd-4 dv-round-4":!0,[this.containerClass?.class??""]:this.containerClass?.index===i});return(0,s.qy)` ${e.conditions[i-1]?.type==="group"||"group"===t.type?(0,s.qy)`
`:s.s6}
${a}
`})}
${e0.PlusIcon} Add ${Y.SAc}
`}#tY;get containerClass(){return this.#tY}set containerClass(e){this.#tY=e}#tl;get data(){return this.#tl}set data(e){this.#tl=e}#tX;get onBack(){return this.#tX}set onBack(e){this.#tX=e}#tF;get setData(){return this.#tF}set setData(e){this.#tF=e}#tN;get vars(){return this.#tN}set vars(e){this.#tN=e}constructor(){super(...arguments),this._addNew=e=>{oe(e.target,{value:this.data,onChange:this.setData,vars:this.vars})},this._setFilter=(e,t)=>{this.setData({...this.data,conditions:this.data.conditions.map((i,s)=>e===s?t:i)})},this.#tY=on(this,u,void 0),this.#tl=(on(this,p),on(this,f,void 0)),this.#tX=(on(this,g),on(this,m,void 0)),this.#tF=(on(this,v),on(this,y,void 0)),this.#tN=(on(this,b),on(this,x,void 0)),on(this,_)}static{on(t,d)}})})();var ol=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oc=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c,d=[(0,o.EM)("advanced-filter-modal")],h=[],u=(0,w.Tm)(w.ao),p=[],f=[],g=[],m=[],v=[],y=[],b=[],x=[],_=[],C=[],k=[],S=[];return class extends u{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],c=[(0,o.MZ)({attribute:!1})],ol(this,null,i,{kind:"accessor",name:"data",static:!1,private:!1,access:{has:e=>"data"in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:s},p,f),ol(this,null,r,{kind:"accessor",name:"isRoot",static:!1,private:!1,access:{has:e=>"isRoot"in e,get:e=>e.isRoot,set:(e,t)=>{e.isRoot=t}},metadata:s},g,m),ol(this,null,a,{kind:"accessor",name:"onBack",static:!1,private:!1,access:{has:e=>"onBack"in e,get:e=>e.onBack,set:(e,t)=>{e.onBack=t}},metadata:s},v,y),ol(this,null,n,{kind:"accessor",name:"onDelete",static:!1,private:!1,access:{has:e=>"onDelete"in e,get:e=>e.onDelete,set:(e,t)=>{e.onDelete=t}},metadata:s},b,x),ol(this,null,l,{kind:"accessor",name:"setData",static:!1,private:!1,access:{has:e=>"setData"in e,get:e=>e.setData,set:(e,t)=>{e.setData=t}},metadata:s},_,C),ol(this,null,c,{kind:"accessor",name:"vars",static:!1,private:!1,access:{has:e=>"vars"in e,get:e=>e.vars,set:(e,t)=>{e.vars=t}},metadata:s},k,S),ol(null,e={value:t},d,{kind:"class",name:t.name,metadata:s},null,h),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` advanced-filter-modal { background-color: var(--affine-background-overlay-panel-color); position: absolute; border-radius: 8px; box-shadow: var(--affine-shadow-2); min-width: 500px; } .filter-modal-bottom { border-top: 1px solid var(--affine-border-color); padding: 8px; } .filter-modal-button { padding: 8px 12px; display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 22px; border-radius: 4px; cursor: pointer; color: var(--affine-text-secondary-color); } .filter-modal-button svg { fill: var(--affine-text-secondary-color); color: var(--affine-text-secondary-color); width: 20px; height: 20px; } .filter-modal-button:hover { background-color: var(--affine-hover-color); color: var(--affine-text-primary-color); } .filter-modal-button:hover svg { fill: var(--affine-text-primary-color); color: var(--affine-text-primary-color); } .filter-delete-button:hover { background-color: var(--affine-background-error-color); color: var(--affine-error-color); } .filter-exactly-hover-container { transition: background-color 0.2s ease-in-out; } .filter-exactly-hover-background { background-color: var(--affine-hover-color); } `}connectedCallback(){super.connectedCallback(),this.disposables.addFromEvent(this,"mouseover",e=>{let t=e.target;for(;t&&t!==this;){if(t.classList.contains("filter-exactly-hover-container")){t.classList.add("filter-exactly-hover-background");break}t=t.parentElement}}),this.disposables.addFromEvent(this,"mouseout",e=>{let t=e.target;for(;t&&t!==this;){if(t.classList.contains("filter-exactly-hover-container")){t.classList.remove("filter-exactly-hover-background");break}t=t.parentElement}})}render(){return(0,s.qy)`
${this.isRoot?(0,s.qy)` `:(0,s.qy)` `}
Delete
`}#tl=oc(this,p,void 0);get data(){return this.#tl}set data(e){this.#tl=e}#tQ=(oc(this,f),oc(this,g,!1));get isRoot(){return this.#tQ}set isRoot(e){this.#tQ=e}#tX=(oc(this,m),oc(this,v,void 0));get onBack(){return this.#tX}set onBack(e){this.#tX=e}#tG=(oc(this,y),oc(this,b,void 0));get onDelete(){return this.#tG}set onDelete(e){this.#tG=e}#tF=(oc(this,x),oc(this,_,void 0));get setData(){return this.#tF}set setData(e){this.#tF=e}#tN=(oc(this,C),oc(this,k,void 0));get vars(){return this.#tN}set vars(e){this.#tN=e}constructor(){super(...arguments),oc(this,S)}static{oc(t,h)}},t})(),oh=(e,t)=>{let i=new od;i.vars=t.vars,i.data=t.value,i.isRoot=t.isRoot,i.onDelete=()=>{t.onDelete(),s()},i.onBack=()=>{t.onBack(),s()},i.setData=e=>{t.onChange(e),i.data=e};let s=(0,e1.fx)(e,i)};var ou=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},op=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n=[(0,o.EM)("filter-bar")],l=[],c=(0,w.Tm)(w.ao),d=[],h=[],u=[],p=[],f=[],g=[];(class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],ou(this,null,i,{kind:"accessor",name:"data",static:!1,private:!1,access:{has:e=>"data"in e,get:e=>e.data,set:(e,t)=>{e.data=t}},metadata:s},d,h),ou(this,null,r,{kind:"accessor",name:"setData",static:!1,private:!1,access:{has:e=>"setData"in e,get:e=>e.setData,set:(e,t)=>{e.setData=t}},metadata:s},u,p),ou(this,null,a,{kind:"accessor",name:"vars",static:!1,private:!1,access:{has:e=>"vars"in e,get:e=>e.vars,set:(e,t)=>{e.vars=t}},metadata:s},f,g),ou(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` filter-bar { margin-top: 8px; display: flex; gap: 8px; } .filter-group-tag { font-size: 12px; font-style: normal; font-weight: 600; line-height: 20px; display: flex; align-items: center; padding: 4px; background-color: var(--affine-white); } .filter-bar-add-filter { color: var(--affine-text-secondary-color); padding: 4px 8px; display: flex; align-items: center; gap: 6px; font-size: 14px; font-style: normal; font-weight: 400; line-height: 22px; } `}deleteFilter(e){this.setData({...this.data,conditions:this.data.conditions.filter((t,i)=>i!==e)})}render(){return(0,s.qy)` `}renderCondition(e){let t=this.data.conditions[e],i=()=>{this.deleteFilter(e)};if("filter"===t.type)return(0,s.qy)` `;let o=t.conditions.length,r=o>1?`${o} rules`:`${o} rule`;return(0,s.qy)`
${e0.FilterIcon} ${r}
${e0.CrossIcon}
`}renderFilters(){return this.data.conditions.map((e,t)=>()=>this.renderCondition(t))}updated(){this.updateMoreFilterPanel?.()}#tl;get data(){return this.#tl}set data(e){this.#tl=e}#tF;get setData(){return this.#tF}set setData(e){this.#tF=e}#tN;get vars(){return this.#tN}set vars(e){this.#tN=e}constructor(){super(...arguments),this._setFilter=(e,t)=>{this.setData({...this.data,conditions:this.data.conditions.map((i,s)=>e===s?t:i)})},this.addFilter=e=>{let t=e.target;sj(t,{vars:this.vars,onSelect:e=>{let i=this.data.conditions.length;this.setData({...this.data,conditions:[...this.data.conditions,e]}),requestAnimationFrame(()=>{this.expandGroup(t,i)})}})},this.expandGroup=(e,t)=>{let i=this.data.conditions[t];"group"===i.type&&oh(e,{isRoot:!1,vars:this.vars,value:i,onBack:()=>{},onChange:e=>this._setFilter(t,e),onDelete:()=>{this.deleteFilter(t)}})},this.renderAddFilter=()=>(0,s.qy)`
${Y.N7w} Add filter
`,this.renderMore=e=>{let t=this.data.conditions.length;return e===t?this.renderAddFilter():(0,s.qy)`
${t-e} More
`},this.renderMoreFilter=e=>(0,s.qy)`
${(0,el.u)(this.data.conditions.slice(e),(t,i)=>(0,s.qy)`
${this.renderCondition(i+e)}
`)}
${this.renderAddFilter()}
`,this.showMoreFilter=(e,t)=>{let i=sF(()=>this.renderMoreFilter(t));i.style.position="absolute",this.updateMoreFilterPanel=()=>{if(t===this.data.conditions.length){s(),this.updateMoreFilterPanel=void 0;return}i.requestUpdate()};let s=(0,e1.fx)(e.target,i,{onClose:()=>{this.updateMoreFilterPanel=void 0}})},this.#tl=op(this,d,void 0),this.#tF=(op(this,h),op(this,u,void 0)),this.#tN=(op(this,p),op(this,f,void 0)),op(this,g)}static{op(t,l)}})})();let of=(0,e5.F5)(e=>{let t=e.view;return t.filterVisible$.value?(0,s.qy)``:(0,s.qy)``});var og=i(50620),om=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ov=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=(0,eK.Jb)((0,w.Tm)(w.ao)),s=[],r=[],a=[],n=[];return class extends i{static{let l="function"==typeof Symbol&&Symbol.metadata?Object.create(i[Symbol.metadata]??null):void 0;e=[(0,o.MZ)({attribute:!1})],t=[(0,o.MZ)({attribute:!1})],om(this,null,e,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:l},s,r),om(this,null,t,{kind:"accessor",name:"viewMethods",static:!1,private:!1,access:{has:e=>"viewMethods"in e,get:e=>e.viewMethods,set:(e,t)=>{e.viewMethods=t}},metadata:l},a,n),l&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:l})}get dataSource(){return this.view.viewManager.dataSource}get viewManager(){return this.view.viewManager}#tt=ov(this,s,void 0);get view(){return this.#tt}set view(e){this.#tt=e}#tJ=(ov(this,r),ov(this,a,void 0));get viewMethods(){return this.#tJ}set viewMethods(e){this.#tJ=e}constructor(){super(...arguments),ov(this,n)}}})();var ob=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ow=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("expand-database-block-modal")],r=[],a=oy;return class extends a{static{t=this}constructor(){super(...arguments),this.expandDatabase=()=>{let e=this.closest("affine-database");e&&function(e){new o_().database=e;let t=document.querySelector("editor-host");(0,W.Z1)(t);let i=(0,e1.mP)(t),o=()=>{i.remove()},r=sF(()=>(0,s.qy)`
${Y.w0d}
`);r.onclick=e=>{e.stopPropagation()},i.onclick=o,i.style.backgroundColor="var(--affine-black-60)",i.append(r)}(e)}}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;ob(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),ow(t,r)}render(){if(!this.closest("database-block-modal-preview")&&this.database?.doc.awarenessStore.getFlag("enable_expand_database_block"))return(0,s.qy)`
${Y.JvT}
`}get database(){return this.closest("affine-database")}},t})(),o_=(()=>{let e,t,i=[(0,o.EM)("database-block-modal-preview")],r=[],a=(0,w.Tm)(w.ao),n=[],l=[];return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;ob(this,null,[(0,o.MZ)({attribute:!1})],{kind:"accessor",name:"database",static:!1,private:!1,access:{has:e=>"database"in e,get:e=>e.database,set:(e,t)=>{e.database=t}},metadata:s},n,l),ob(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` database-block-modal-preview { display: flex; flex-direction: column; flex: 1; overflow: hidden; } `}firstUpdated(e){super.firstUpdated(e),requestAnimationFrame(()=>{this.querySelector("affine-data-view-renderer")?.focusFirstCell()})}render(){let e={bindHotkey:this.bindHotkey,handleEvent:this.handleEvent,selection$:this.viewSelection$,setSelection:this.setSelection,dataSource:this.database.dataSource,headerWidget:this.database.headerWidget,std:this.database.std};return(0,s.qy)` `}#t1;get database(){return this.#t1}set database(e){this.#t1=e}constructor(){super(...arguments),this.bindHotkey=e=>({dispose:this.database.host.event.bindHotkey(e,{path:[]})}),this.blockId="database-modal-preview",this.handleEvent=(e,t)=>({dispose:this.database.host.event.add(e,t,{path:[]})}),this.selectionUpdated=new og.D,this.setSelection=e=>{this.database.host.selection.set(e?[new eY.G({blockId:this.blockId,viewSelection:e})]:[])},this.viewSelection$=(0,eK.EW)(()=>{let e=this.database.selection.value.find(e=>e.blockId===this.blockId&&e instanceof eY.G);return e?.viewSelection}),this.#t1=ow(this,n,void 0),ow(this,l)}static{ow(t,r)}},t})();var oC=i(25420),ok=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oS=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("data-view-header-tools-filter")],r=[],a=oy;return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;ok(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=oM}get _filter(){return this.view.filter$.value??tR.hh}set _filter(e){this.view.updateFilter(e)}addFilter(e){if(!this._filter.conditions.length&&!this.view.filterVisible$.value){this.showToolBar(!0),sj(e.target,{vars:this.view.vars$.value,onSelect:e=>{this._filter={...this._filter,conditions:[e]},this.view.filterSetVisible(!0)},onClose:()=>{this.showToolBar(!1)}});return}this.view.filterSetVisible(!this.view.filterVisible$.value)}get readonly(){return this.view.readonly$.value}render(){return this.readonly?s.s6:(0,s.qy)`
${e0.FilterIcon} Filter
`}showToolBar(e){let t=this.closest("data-view-header-tools");t&&(t.showToolBar=e)}static{oS(t,r)}},t})();var oI=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oB=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a=[(0,o.EM)("data-view-header-tools-search")],n=[],l=oy,c=[],d=[],h=[],u=[];return class extends l{static{t=this}constructor(){super(...arguments),this._clearSearch=()=>{this._searchInput.value="",this.view.setSearch(""),this.preventBlur=!0,setTimeout(()=>{this.preventBlur=!1})},this._clickSearch=e=>{e.stopPropagation(),this.showSearch=!0},this._onSearch=e=>{let t=e.target.value.trim();this.view.setSearch(t)},this._onSearchBlur=()=>{this._searchInput.value||this.preventBlur||(this.showSearch=!1)},this._onSearchKeydown=e=>{"Escape"===e.key&&(this._searchInput.value?(this._searchInput.value="",this.view.setSearch("")):this.showSearch=!1)},this.preventBlur=!1,this.#t0=oB(this,c,void 0),this.#t2=(oB(this,d),oB(this,h,!1)),this.#tt=oB(this,u)}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,o.P)(".affine-database-search-input")],r=[(0,o.wk)()],oI(this,null,i,{kind:"accessor",name:"_searchInput",static:!1,private:!1,access:{has:e=>"_searchInput"in e,get:e=>e._searchInput,set:(e,t)=>{e._searchInput=t}},metadata:s},c,d),oI(this,null,r,{kind:"accessor",name:"_showSearch",static:!1,private:!1,access:{has:e=>"_showSearch"in e,get:e=>e._showSearch,set:(e,t)=>{e._showSearch=t}},metadata:s},h,u),oI(null,e={value:t},a,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=o$}render(){let e=(0,k.H)({"affine-database-search-container":!0,"search-container-expand":this.showSearch});return(0,s.qy)` `}get showSearch(){return this._showSearch}set showSearch(e){this._showSearch=e;let t=this.closest("data-view-header-tools");t&&(t.showToolBar=e)}#t0;get _searchInput(){return this.#t0}set _searchInput(e){this.#t0=e}#t2;get _showSearch(){return this.#t2}set _showSearch(e){this.#t2=e}#tt;get view(){return this.#tt}set view(e){this.#tt=e}static{oB(t,n)}},t})();var oO=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oP=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-database-new-record-preview")],r=[],a=w.ao;return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;oO(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),oP(t,r)}render(){return(0,s.qy)` ${Y.c11} `}},t})();var oA=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oL=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("data-view-header-tools-add-row")],r=[],a=oy,n=[],l=[];return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;oA(this,null,[(0,o.wk)()],{kind:"accessor",name:"showToolBar",static:!1,private:!1,access:{has:e=>"showToolBar"in e,get:e=>e.showToolBar,set:(e,t)=>{e.showToolBar=t}},metadata:s},n,l),oA(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=oD}get readonly(){return this.view.readonly$.value}connectedCallback(){super.connectedCallback(),this.readonly||this.disposables.addFromEvent(this,"pointerdown",e=>{this._dragStart(e)})}render(){if(!this.readonly)return(0,s.qy)`
${Y.c11}New Record
`}#t5;get showToolBar(){return this.#t5}set showToolBar(e){this.#t5=e}constructor(){super(...arguments),this._dragStart=e=>{e.preventDefault(),e.stopPropagation();let t=this.closest("affine-data-view-renderer"),i=t?.querySelector("affine-database-table")?.getBoundingClientRect(),s=t?.querySelectorAll(".affine-database-block-row");if(!s||!i)return;let o=Array.from(s).map(e=>{let t=e.getBoundingClientRect();return{id:e.dataset.rowId,top:t.top,bottom:t.bottom,mid:(t.top+t.bottom)/2,width:t.width,left:t.left}}),r=e=>{let t=o.find(t=>ee,onDrag:()=>({}),onMove:e=>{n.display(e.x,e.y);let t=r(e.y);return t?a.display(i.left,t.y,i.width):a.remove(),{position:t?.position}},onDrop:e=>{e.position&&this.viewMethods.addRow?.(e.position)},onClear:()=>{a.remove(),n.remove()}})},this._onAddNewRecord=()=>{if(this.readonly)return;let e=this.viewMethods.getSelection?.();if(e){if("table"===e.type&&"area"===e.selectionType){let{rowsSelection:t,columnsSelection:i,focus:s}=e,o=0;t&&!i?o=t.end:t&&i?o=t.end:t||i||!s||(o=s.rowIndex),this.addRow(o+1)}}else this.addRow("start")},this.addRow=e=>{this.viewMethods.addRow?.(e)},this.#t5=oL(this,n,!1),oL(this,l)}static{oL(t,r)}},t})(),oj=()=>{let e=document.createElement("div");return e.dataset.isDropPreview="true",e.style.pointerEvents="none",e.style.position="fixed",e.style.zIndex="9999",e.style.height="4px",e.style.borderRadius="2px",e.style.backgroundColor="var(--affine-primary-color)",e.style.boxShadow="0px 0px 8px 0px rgba(30, 150, 235, 0.35)",{display(t,i,s){document.body.append(e),e.style.left=`${t}px`,e.style.top=`${i-2}px`,e.style.width=`${s}px`},remove(){e.remove()}}},oV=()=>{let e=new oH;return document.body.append(e),{display(t,i){e.style.left=`${t}px`,e.style.top=`${i}px`},remove(){e.remove()}}};var oz=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oR=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a=[(0,o.EM)("data-view-group-setting")],n=[],l=(0,w.Tm)(w.ao),c=[],d=[],h=[],u=[];(class extends l{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,o.P)(".group-sort-setting")],r=[(0,o.MZ)({attribute:!1})],oz(this,null,i,{kind:"accessor",name:"groupContainer",static:!1,private:!1,access:{has:e=>"groupContainer"in e,get:e=>e.groupContainer,set:(e,t)=>{e.groupContainer=t}},metadata:s},c,d),oz(this,null,r,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:s},h,u),oz(null,e={value:t},a,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` data-view-group-setting { display: flex; flex-direction: column; gap: 4px; ${(0,s.iz)((0,eJ.F)())}; } .group-item { display: flex; padding: 4px 12px; position: relative; cursor: grab; } .group-item-drag-bar { width: 4px; height: 12px; border-radius: 1px; background-color: #efeff0; position: absolute; left: 4px; top: 0; bottom: 0; margin: auto; } .group-item:hover .group-item-drag-bar { background-color: #c0bfc1; } `}connectedCallback(){super.connectedCallback(),this._disposables.addFromEvent(this,"pointerdown",e=>{e.stopPropagation()})}firstUpdated(e){super.firstUpdated(e);let t=new tX.Ay(this.groupContainer,{animation:150,group:`group-sort-${this.view.id}`,onEnd:e=>{let t=this.view.groupHelper;if(!t)return;let i=[...t.groups],s=e.oldIndex??-1,o=i[s];i.splice(s,1);let r=i[e.newIndex??-1];t.moveGroupTo(o.key,r?{before:!0,id:r.key}:"end")}});this._disposables.add({dispose:()=>t.destroy()})}render(){let e=this.view.groupHelper;if(e)return(0,s.qy)`
Groups
${(0,el.u)(e.groups,e=>e.key,e=>{let t={value:e.value,data:e.helper.data,readonly:!0},i=e.helper.groupConfig();return(0,s.qy)`
${(0,e2.ep)(i?.view,t)}
`})}
`}#t7=oR(this,c,void 0);get groupContainer(){return this.#t7}set groupContainer(e){this.#t7=e}#tt=(oR(this,d),oR(this,h,void 0));get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),oR(this,u)}static{oR(t,n)}})})();let oF=(e,t)=>({onClose:t,input:{search:!0,placeholder:"Search"},items:[...e.columnsWithoutFilter$.value.filter(t=>"title"!==e.columnGet(t).type&&!!tm.H.match(e.columnGet(t).dataType)).map(t=>{let i=e.columnGet(t);return{type:"action",name:i.name,isSelected:e.viewData$.value?.groupBy?.columnId===t,icon:(0,s.qy)` `,select:()=>{(e instanceof iP.u||e instanceof tG)&&e.changeGroup(t)}}}),{type:"group",name:"",hide:()=>e instanceof tG||e.viewData$.value?.groupBy==null,children:()=>[{type:"action",icon:e0.DeleteIcon,class:"delete-item",name:"Remove Grouping",select:()=>{e instanceof iP.u&&e.changeGroup(void 0)}}]}]}),oN=(e,t,i)=>{(0,e1.zs)(e,{options:oF(t,i)})},oq=(e,t,i)=>{let o=t.viewData$.value?.groupBy;if(null==o)return;let r=t.columnGetType(o.columnId);if(!r)return;let a=()=>{oq(e,t,i)},n=t.getIcon(r),l=(0,e1.zs)(e,{options:{input:{search:!0},items:[oo("GROUP",()=>{i(),l.close()}),{type:"group",name:"",children:()=>[{type:"sub-menu",name:"Group By",postfix:(0,s.qy)`
${(0,e2.ep)(n,{})} ${t.columnGetName(o.columnId)}
${Y.OTM} `,options:oF(t,a)}]},{type:"group",name:"",children:()=>[{type:"custom",render:()=>(0,s.qy)` `}]}]}})};var oU=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oW=function(e,t,i){for(var s=arguments.length>2,o=0;o `,oY=(0,s.qy)` `,oK=(()=>{let e,t,i,r,a,n=[(0,o.EM)("data-view-properties-setting")],l=[],c=(0,w.Tm)(w.ao),d=[],h=[],u=[],p=[],f=[],g=[];return class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.P)(".properties-group")],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],oU(this,null,i,{kind:"accessor",name:"groupContainer",static:!1,private:!1,access:{has:e=>"groupContainer"in e,get:e=>e.groupContainer,set:(e,t)=>{e.groupContainer=t}},metadata:s},d,h),oU(this,null,r,{kind:"accessor",name:"onBack",static:!1,private:!1,access:{has:e=>"onBack"in e,get:e=>e.onBack,set:(e,t)=>{e.onBack=t}},metadata:s},u,p),oU(this,null,a,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:s},f,g),oU(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` data-view-properties-setting { position: absolute; background-color: var(--affine-background-overlay-panel-color); border-radius: 8px; box-shadow: var(--affine-shadow-2); padding: 8px; min-width: 300px; } .properties-group-header { user-select: none; padding: 4px 12px 12px 12px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--affine-divider-color); } .properties-group-title { font-size: 12px; line-height: 20px; color: var(--affine-text-secondary-color); display: flex; align-items: center; gap: 8px; } .properties-group-op { padding: 4px 8px; font-size: 12px; line-height: 20px; font-weight: 500; border-radius: 4px; cursor: pointer; } .properties-group-op:hover { background-color: var(--affine-hover-color); } .properties-group { min-height: 40px; } .property-item { padding: 4px; display: flex; align-items: center; gap: 8px; user-select: none; cursor: pointer; border-radius: 4px; } .property-item:hover { background-color: var(--affine-hover-color); } .property-item-drag-bar { width: 4px; height: 12px; border-radius: 1px; background-color: #efeff0; } .property-item:hover .property-item-drag-bar { background-color: #c0bfc1; } .property-item-icon { display: flex; align-items: center; } .property-item-icon svg { color: var(--affine-icon-color); fill: var(--affine-icon-color); width: 20px; height: 20px; } .property-item-op-icon { display: flex; align-items: center; border-radius: 4px; } .property-item-op-icon:hover { background-color: var(--affine-hover-color); } .property-item-op-icon.disabled:hover { background-color: transparent; } .property-item-op-icon svg { fill: var(--affine-icon-color); color: var(--affine-icon-color); width: 20px; height: 20px; } .property-item-op-icon.disabled svg { fill: var(--affine-text-disable-color); color: var(--affine-text-disable-color); } .property-item-name { font-size: 14px; line-height: 22px; flex: 1; } `}itemsGroup(){return this.view.columnsWithoutFilter$.value.map(e=>this.view.columnGet(e))}connectedCallback(){super.connectedCallback(),this._disposables.addFromEvent(this,"pointerdown",e=>{e.stopPropagation()})}firstUpdated(){let e=new tX.Ay(this.groupContainer,{animation:150,group:`properties-sort-${this.view.id}`,onEnd:e=>{let t=[...this.view.columnsWithoutFilter$.value],i=e.oldIndex??-1,s=t[i];t.splice(i,1);let o=t[e.newIndex??-1];this.view.columnMove(s,o?{before:!0,id:o}:"end")}});this._disposables.add({dispose:()=>e.destroy()})}render(){let e=this.itemsGroup(),t=e.every(e=>!e.hide);return(0,s.qy)`
${Y.oik}
PROPERTIES
${t?"Hide All":"Show All"}
${(0,el.u)(e,e=>e.id,this.renderColumn)}
`}#t7;get groupContainer(){return this.#t7}set groupContainer(e){this.#t7=e}#tX;get onBack(){return this.#tX}set onBack(e){this.#tX=e}#tt;get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),this.clickChangeAll=e=>{this.view.columnsWithoutFilter$.value.forEach(t=>{"title"!==this.view.columnGetType(t)&&this.view.columnUpdateHide(t,e)})},this.renderColumn=e=>{let t="title"===e.type,i=e.hide?oY:oG,o=(0,k.H)({"property-item-op-icon":!0,disabled:t});return(0,s.qy)`
${e.name}
${i}
`},this.#t7=oW(this,d,void 0),this.#tX=(oW(this,h),oW(this,u,void 0)),this.#tt=(oW(this,p),oW(this,f,void 0)),oW(this,g)}static{oW(t,l)}},t})(),oX=(e,t)=>{let i=new oK;i.view=t.view,i.onBack=()=>{s(),t.onBack?.()};let s=(0,e1.fx)(e,i,{onClose:t.onClose})};var oQ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oJ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("data-view-header-tools-view-options")],r=[],a=oy;return class extends a{static{t=this}constructor(){super(...arguments),this.clickMoreAction=e=>{e.stopPropagation(),this.openMoreAction(e.target)},this.openMoreAction=e=>{this.showToolBar(!0),o2(e,this.view,()=>{this.showToolBar(!1)})}}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;oQ(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=o1}render(){if(!this.view.readonly$.value)return(0,s.qy)`
${Y.jNK}
`}showToolBar(e){let t=this.closest("data-view-header-tools");t&&(t.showToolBar=e)}#tt;get view(){return this.#tt}set view(e){this.#tt=e}static{oJ(t,r)}},t})(),o2=(e,t,i)=>{let s=()=>{o2(e,t)};(0,e1.zs)(e,{options:{style:"min-width:300px",input:{initValue:t.name$.value,onComplete:e=>{t.updateName(e)}},items:[{type:"action",name:"Properties",icon:e0.InfoIcon,postfix:Y.OTM,select:()=>{requestAnimationFrame(()=>{oX(e,{view:t,onBack:s})})}},{type:"action",name:"Filter",icon:e0.FilterIcon,postfix:Y.OTM,select:()=>{oh(e,{vars:t.vars$.value,value:t.filter$.value??tR.hh,onChange:t.updateFilter.bind(t),isRoot:!0,onBack:s,onDelete:()=>{t.updateFilter({...t.filter$.value??tR.hh,conditions:[]})}})}},{type:"action",name:"Group",icon:e0.GroupingIcon,postfix:Y.OTM,select:()=>{t.viewData$.value?.groupBy?oq(e,t,s):oN(e,t)}},{type:"action",name:"Duplicate",icon:Y.jaP,select:()=>{t.duplicate()}},{type:"group",name:"",children:()=>[{type:"action",name:"Delete View",icon:Y.d7y,select:()=>{t.delete()},class:"delete-item"}]}],onClose:i}})};var o5=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},o7=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a=[(0,o.EM)("data-view-header-tools")],n=[],l=oy,c=[],d=[],h=[],u=[];return class extends l{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,o.wk)()],r=[(0,o.MZ)({attribute:!1})],o5(this,null,i,{kind:"accessor",name:"showToolBar",static:!1,private:!1,access:{has:e=>"showToolBar"in e,get:e=>e.showToolBar,set:(e,t)=>{e.showToolBar=t}},metadata:s},c,d),o5(this,null,r,{kind:"accessor",name:"toolsMap",static:!1,private:!1,access:{has:e=>"toolsMap"in e,get:e=>e.toolsMap,set:(e,t)=>{e.toolsMap=t}},metadata:s},h,u),o5(null,e={value:t},a,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=o3}render(){let e=(0,k.H)({"show-toolbar":this.showToolBar,"affine-database-toolbar":!0}),t=this.toolsMap[this.view.type];return(0,s.qy)`
${(0,el.u)(t??[],e=>{let t={view:this.view,viewMethods:this.viewMethods};return(0,e5.ep)(e,t)})}
`}#t5=o7(this,c,!1);get showToolBar(){return this.#t5}set showToolBar(e){this.#t5=e}#t3=(o7(this,d),o7(this,h,void 0));get toolsMap(){return this.#t3}set toolsMap(e){this.#t3=e}constructor(){super(...arguments),o7(this,u)}static{o7(t,n)}},t})(),o6={filter:(0,e5.Z4)(oE),expand:(0,e5.Z4)(ox),search:(0,e5.Z4)(oT),viewOptions:(0,e5.Z4)(o0),tableAddRow:(0,e5.Z4)(oZ)};var o8=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},o9=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c=[(0,o.EM)("component-overflow")],d=[],h=(0,eK.Jb)((0,w.Tm)(w.ao)),u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],x=[],_=[];(class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.YG)(":scope > .component-overflow-item")],r=[(0,o.P)(":scope > .component-overflow-more")],a=[(0,o.wk)()],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],o8(this,null,i,{kind:"accessor",name:"items",static:!1,private:!1,access:{has:e=>"items"in e,get:e=>e.items,set:(e,t)=>{e.items=t}},metadata:s},u,p),o8(this,null,r,{kind:"accessor",name:"more",static:!1,private:!1,access:{has:e=>"more"in e,get:e=>e.more,set:(e,t)=>{e.more=t}},metadata:s},f,g),o8(this,null,a,{kind:"accessor",name:"renderCount",static:!1,private:!1,access:{has:e=>"renderCount"in e,get:e=>e.renderCount,set:(e,t)=>{e.renderCount=t}},metadata:s},m,v),o8(this,null,n,{kind:"accessor",name:"renderItem",static:!1,private:!1,access:{has:e=>"renderItem"in e,get:e=>e.renderItem,set:(e,t)=>{e.renderItem=t}},metadata:s},y,b),o8(this,null,l,{kind:"accessor",name:"renderMore",static:!1,private:!1,access:{has:e=>"renderMore"in e,get:e=>e.renderMore,set:(e,t)=>{e.renderMore=t}},metadata:s},x,_),o8(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` component-overflow { display: flex; flex-wrap: wrap; width: 100%; position: relative; } .component-overflow-item { } .component-overflow-item.hidden { opacity: 0; pointer-events: none; position: absolute; } `}adjustStyle(){let e=this.getBoundingClientRect().width-this.more.getBoundingClientRect().width;for(let t=0;t{this.adjustStyle()});e.observe(this),this.disposables.add(()=>{e.unobserve(this)})}render(){return(0,s.qy)` ${(0,el.u)(this.renderItem,(e,t)=>{let i=(0,k.H)({"component-overflow-item":!0,hidden:t>=this.renderCount});return(0,s.qy)`
${e()}
`})}
${this.renderMore(this.renderCount)}
`}updated(e){super.updated(e),requestAnimationFrame(()=>{this.adjustStyle()})}#t4=o9(this,u,void 0);get items(){return this.#t4}set items(e){this.#t4=e}#t6=(o9(this,p),o9(this,f,void 0));get more(){return this.#t6}set more(e){this.#t6=e}#t8=(o9(this,g),o9(this,m,0));get renderCount(){return this.#t8}set renderCount(e){this.#t8=e}#t9=(o9(this,v),o9(this,y,void 0));get renderItem(){return this.#t9}set renderItem(e){this.#t9=e}#ie=(o9(this,b),o9(this,x,void 0));get renderMore(){return this.#ie}set renderMore(e){this.#ie=e}constructor(){super(...arguments),o9(this,_)}static{o9(t,d)}})})();var re=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},rt=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("data-view-header-views")],r=[],a=oy;return class extends a{static{t=this}constructor(){super(...arguments),this._addViewMenu=e=>{(0,e1.$E)(e.target,this.dataSource.viewMetas.map(e=>({type:"action",name:e.model.defaultName,icon:(0,s.qy)``,select:()=>{let t=this.viewManager.viewAdd(e.type);this.viewManager.setCurrentView(t)}})))},this._showMore=e=>{let t=this.viewManager.views$.value;(0,e1.$E)(e.target,[...t.map(e=>{let t=this.viewManager.viewGet(e);return{type:"action",icon:(0,s.qy)``,name:t.viewData$.value?.name??"",label:()=>(0,s.qy)`${t.viewData$.value?.name}`,isSelected:this.viewManager.currentViewId$.value===e,select:()=>{this.viewManager.setCurrentView(e)},postfix:(0,s.qy)`
${Y.jNK}
`}}),{type:"group",name:"",hide:()=>this.readonly,children:()=>this.dataSource.viewMetas.map(e=>({type:"action",name:`Create ${e.model.defaultName}`,icon:(0,s.qy)``,select:()=>{let t=this.viewManager.viewAdd(e.type);this.viewManager.setCurrentView(t)}}))}])},this.openViewOption=(e,t)=>{if(this.readonly)return;let i=this.viewManager.views$.value,s=i.findIndex(e=>e===t),o=this.viewManager.viewGet(i[s]);o&&(0,e1.zs)(e,{options:{input:{initValue:o.viewData$.value?.name,onComplete:e=>{o.viewDataUpdate(t=>({name:e}))}},items:[{type:"action",name:"Edit View",icon:(0,e5.ep)(this.getRenderer(t).icon,{}),select:()=>{this.closest("affine-data-view-renderer")?.querySelector("data-view-header-tools-view-options")?.openMoreAction(e)}},{type:"action",name:"Move Left",hide:()=>0===s,icon:Y.aiU,select:()=>{let e=i[s-1];this.viewManager.moveTo(t,e?{before:!0,id:e}:"start")}},{type:"action",name:"Move Right",icon:Y.hhC,hide:()=>s===i.length-1,select:()=>{let e=i[s+1];this.viewManager.moveTo(t,e?{before:!1,id:e}:"end")}},{type:"action",name:"Duplicate",icon:Y.jaP,select:()=>{this.viewManager.viewDuplicate(t)}},{type:"group",name:"",children:()=>[{type:"action",name:"Delete View",icon:e0.DeleteIcon,select:()=>{o.delete()},class:"delete-item"}]}]}})},this.renderMore=e=>{let t=this.viewManager.views$.value;if(e===t.length){if(this.readonly)return;return(0,s.qy)`
${Y.N7w}
`}return(0,s.qy)`
${t.length-e} More
`},this.renderViews=()=>this.viewManager.views$.value.map(e=>()=>{let t=(0,k.H)({"database-view-button":!0,"dv-hover":!0,active:this.viewManager.currentViewId$.value===e}),i=this.viewManager.viewDataGet(e);return(0,s.qy)`
${i?.name}
`})}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;re(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` data-view-header-views { height: 32px; display: flex; user-select: none; gap: 4px; } data-view-header-views::-webkit-scrollbar-thumb { width: 1px; } .database-view-button { height: 100%; cursor: pointer; padding: 4px 8px; border-radius: 4px; font-size: 14px; display: flex; align-items: center; color: var(--affine-text-secondary-color); white-space: nowrap; } .database-view-button .name { align-items: center; height: 22px; max-width: 100px; overflow: hidden; text-overflow: ellipsis; } .database-view-button .icon { margin-right: 6px; display: block; } .database-view-button .icon svg { width: 16px; height: 16px; } .database-view-button.active { color: var(--affine-text-primary-color); background-color: var(--affine-hover-color-filled); } `}_clickView(e,t){if(this.viewManager.currentViewId$.value!==t){this.viewManager.setCurrentView(t);return}this.openViewOption(e.target,t)}getRenderer(e){return this.dataSource.viewMetaGetById(e).renderer}render(){return(0,s.qy)` `}get readonly(){return this.viewManager.readonly$.value}static{rt(t,r)}},t})(),rs={viewBar:(0,e5.Z4)(ri),filterBar:of,createTools:e=>(0,oC.T)((0,e5.Z4)(o4),t=>({...t,toolsMap:e})),tools:o6}},99023:(e,t,i)=>{i.d(t,{Gt:()=>a,Qc:()=>o,ae:()=>c,dG:()=>n,l0:()=>d,si:()=>r,vi:()=>l});var s=i(50307);let o=s.Sy.defineData({name:"Number",supers:[]}),r=s.Sy.defineData({name:"String",supers:[]}),a=s.Sy.defineData({name:"RichText",supers:[r]}),n=s.Sy.defineData({name:"Boolean",supers:[]}),l=s.Sy.defineData({name:"Date",supers:[]});s.Sy.defineData({name:"URL",supers:[r]});let c=s.Sy.defineData({name:"Image",supers:[]});s.Sy.defineData({name:"Email",supers:[r]}),s.Sy.defineData({name:"Phone",supers:[r]});let d=s.Sy.defineData({name:"Tag",supers:[]})},47607:(e,t,i)=>{i.d(t,{H:()=>n});var s=i(42764),o=i(52676);let r=(e,t)=>{if("ref"===e.type)return t[e.name];let i=r(e.ref,t),s=o.E.findData(t=>t.name===e.propertyFuncName);try{return s?.impl(i)}catch(e){console.error(e);return}},a=(e,t)=>e.value,n=(e,t)=>{let i=e=>{if("filter"===e.type){let i=r(e.left,t),o=s.p.findData(t=>t.name===e.function),n=e.args.map(e=>a(e,t));try{if((o?.impl.length??0)>n.length+1)return!0;return o?.impl(i,...n)??!0}catch(e){console.error(e)}}else if("group"===e.type){if("and"===e.op)return e.conditions.every(e=>i(e));if("or"===e.op)return e.conditions.some(e=>i(e))}return!0};return i(e)}},39514:(e,t,i)=>{i.d(t,{P:()=>o});var s=i(50307);class o{constructor(e=s.Sy.isSubtype.bind(s.Sy)){this._match=e,this.list=[]}all(){return this.list}allMatched(e){let t=[];for(let i of this.list)this._match(i.type,e)&&t.push(i);return t}allMatchedData(e){let t=[];for(let i of this.list)this._match(i.type,e)&&t.push(i.data);return t}find(e){return this.list.find(e)}findData(e){return this.list.find(t=>e(t.data))?.data}isMatched(e,t){return this._match(e,t)}match(e){for(let t of this.list)if(this._match(t.type,e))return t.data}register(e,t){this.list.push({type:e,data:t})}}},52676:(e,t,i)=>{i.d(t,{E:()=>a});var s=i(99023),o=i(39514),r=i(50307);let a=new o.P((e,t)=>{if("function"!==e.type)return!1;let i=r.Sy.subst(Object.fromEntries(e.typeVars?.map(e=>[e.name,e.bound])??[]),e).args[0];return i&&r.Sy.isSubtype(i,t)});a.register((0,r.dz)({args:[s.si.create()],rt:s.Qc.create()}),{name:"Length",impl:e=>"string"!=typeof e?0:e.length}),a.register((0,r.dz)({args:[s.vi.create()],rt:s.Qc.create()}),{name:"Day of month",impl:e=>"number"!=typeof e?0:new Date(e).getDate()}),a.register((0,r.dz)({args:[s.vi.create()],rt:s.Qc.create()}),{name:"Day of week",impl:e=>"number"!=typeof e?0:new Date(e).getDay()}),a.register((0,r.dz)({args:[s.vi.create()],rt:s.Qc.create()}),{name:"Month of year",impl:e=>"number"!=typeof e?0:new Date(e).getMonth()+1}),a.register((0,r.dz)({args:[(0,r.cX)(r.Zb.create())],rt:s.Qc.create()}),{name:"Size",impl:e=>Array.isArray(e)?e.length:0})},50307:(e,t,i)=>{i.d(t,{I3:()=>c,Oq:()=>n,Ou:()=>l,Sy:()=>f,Zb:()=>g,cX:()=>a,dz:()=>d});var s=i(68419),o=i(73134);let r=e=>({type:"union",title:"union",list:e}),a=e=>({type:"array",title:"array",ele:e}),n=e=>"array"===e.type,l=(e,t)=>({type:"typeVar",title:"typeVar",name:e,bound:t}),c=e=>({type:"typeRef",title:"typeRef",name:e}),d=e=>({type:"function",title:"function",typeVars:e.typeVars??[],args:e.args,rt:e.rt});class h{constructor(e,t){this.config=e,this.dataMap=t}isByName(e){return e===this.config.name}isSubOfByName(e){return!!this.isByName(e)||this.config.supers.some(t=>t.isSubOfByName(e))}create(e){return{type:"data",name:this.config.name,data:e}}is(e){return"data"===e.type&&e.name===this.config.name}isSubOf(e){return!!this.is(e)||this.config.supers.some(t=>t.isSubOf(e))}isSuperOf(e){let t=this.dataMap.get(e.name);if(!t)throw new s.Ss(o.O.DatabaseBlockError,"data config not found");return t.isSubOfByName(this.config.name)}}let u=(...e)=>({create:t=>({name:t,supers:e}),extends:t=>u(...e,t)}),p=u(),f=new class{constructor(){this.dataMap=new Map}defineData(e){let t=new h(e,this.dataMap);return this.dataMap.set(e.name,t),t}instance(e,t,i,s){let o={...e};return s.args.forEach((e,i)=>{let s=t[i];s&&this.isSubtype(e,s,o)}),this.isSubtype(i,s.rt),this.subst(o,s)}isDataType(e){return"data"===e.type}isSubtype(e,t,i){if("typeRef"===e.type)return i&&"typeRef"!=t.type&&(i[e.name]=t),!0;if("typeRef"===t.type)return i&&(i[t.name]=e),!0;if(g.is(e))return!0;if("union"===e.type)return e.list.some(e=>this.isSubtype(e,t,i));if("union"===t.type)return t.list.every(t=>this.isSubtype(e,t,i));if(this.isDataType(t)){let i=this.dataMap.get(t.name);if(!i)throw new s.Ss(o.O.DatabaseBlockError,"data config not found");return!!this.isDataType(e)&&i.isSubOf(e)}return("array"===e.type||"array"===t.type)&&"array"===e.type&&"array"===t.type&&this.isSubtype(e.ele,t.ele,i)}subst(e,t){let i=t=>{if(this.isDataType(t))return t;switch(t.type){case"typeRef":return{...e[t.name]};case"union":return r(t.list.map(e=>i(e)));case"array":return a(i(t.ele));case"function":throw new s.Ss(o.O.DatabaseBlockError,"not implement yet")}};return d({args:t.args.map(e=>i(e)),rt:i(t.rt)})}},g=f.defineData(p.create("Unknown"))},29734:(e,t,i)=>{i.d(t,{d:()=>s});function s(e){e.stopPropagation()}},73297:(e,t,i)=>{function s(e,t,i=e=>e.id){return"object"==typeof e?t.findIndex(t=>i(t)===e.id)+(e.before?0:1):null==e||"start"===e?0:"end"===e?t.length:t.findIndex(t=>i(t)===e)+1}i.d(t,{b:()=>o,q:()=>s});let o=(e,t,i)=>{let s=e.findIndex(e=>t(e));if(s<0)return e;let o=[...e],[r]=o.splice(s,1),a=i(o);return o.splice(a,0,r),o}},7548:(e,t,i)=>{i.d(t,{C:()=>s,y:()=>r});let s=[{color:"var(--affine-tag-red)",name:"Red"},{color:"var(--affine-tag-pink)",name:"Pink"},{color:"var(--affine-tag-orange)",name:"Orange"},{color:"var(--affine-tag-yellow)",name:"Yellow"},{color:"var(--affine-tag-green)",name:"Green"},{color:"var(--affine-tag-teal)",name:"Teal"},{color:"var(--affine-tag-blue)",name:"Blue"},{color:"var(--affine-tag-purple)",name:"Purple"},{color:"var(--affine-tag-gray)",name:"Gray"},{color:"var(--affine-tag-white)",name:"White"}],o=s.map(e=>e.color),r=function(){let e=[...o];return()=>{0===e.length&&(e=[...o]);let t=Math.floor(Math.random()*e.length);return e.splice(t,1)[0]}}()},64051:(e,t,i)=>{i.d(t,{o:()=>_});var s=i(7595),o=i(73711),r=i(41507),a=i(4564),n=i(83951),l=i(22805),c=i(54719),d=i(3874),h=i(1325),u=i(82750),p=i(1497),f=i(29734),g=i(7548),m=i(99971),v=i(91449);let y=(0,v.AH)` affine-multi-tag-select { position: absolute; z-index: 2; border: 1px solid var(--affine-border-color); border-radius: 8px; background: var(--affine-background-primary-color); box-shadow: var(--affine-shadow-2); font-family: var(--affine-font-family); min-width: 300px; max-width: 720px; } .affine-select-cell-select { font-size: var(--affine-font-sm); } @media print { .affine-select-cell-select { display: none; } } .select-input-container { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 44px; padding: 10px 8px; background: var(--affine-hover-color); border-radius: 8px; } .select-input { flex: 1 1 0; height: 24px; border: none; font-family: ${(0,v.iz)(m.$7.fontSansFamily)}; color: inherit; background: transparent; line-height: 24px; } .select-input:focus { outline: none; } .select-input::placeholder { color: var(--affine-placeholder-color); } .select-option-container { padding: 8px; color: var(--affine-black-90); fill: var(--affine-black-90); max-height: 400px; overflow-y: auto; } .select-option-container-header { padding: 0px 4px 8px 4px; color: var(--affine-black-60); font-size: 12px; user-select: none; } .select-input-container .select-selected { display: flex; align-items: center; padding: 2px 10px; gap: 10px; height: 28px; background: var(--affine-tag-white); border-radius: 4px; color: var(--affine-black-90); background: var(--affine-tertiary-color); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .select-selected-text { width: calc(100% - 16px); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .select-selected > .close-icon { display: flex; align-items: center; } .select-selected > .close-icon:hover { cursor: pointer; } .select-selected > .close-icon > svg { fill: var(--affine-black-90); } .select-option-new { display: flex; flex-direction: row; align-items: center; height: 36px; padding: 4px; gap: 5px; border-radius: 4px; background: var(--affine-selected-color); } .select-option-new-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; height: 28px; padding: 2px 10px; border-radius: 4px; background: var(--affine-tag-red); } .select-option-new-icon { display: flex; align-items: center; gap: 6px; height: 28px; color: var(--affine-text-primary-color); margin-right: 8px; } .select-option-new-icon svg { width: 16px; height: 16px; } .select-option { position: relative; display: flex; justify-content: space-between; align-items: center; padding: 4px; border-radius: 4px; margin-bottom: 4px; cursor: pointer; } .select-option.selected { background: var(--affine-hover-color); } .select-option-text-container { width: 100%; overflow: hidden; display: flex; } .select-option-group-name { font-size: 9px; padding: 0 2px; border-radius: 2px; } .select-option-name { padding: 4px 8px; border-radius: 4px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .select-option-icon { display: flex; justify-content: center; align-items: center; width: 28px; height: 28px; border-radius: 3px; cursor: pointer; opacity: 0; } .select-option.selected .select-option-icon { opacity: 1; } .select-option-icon:hover { background: var(--affine-hover-color); } .select-option-icon svg { width: 16px; height: 16px; pointer-events: none; } `;var b=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},w=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,m,v,x,_,C,k,S,M,E=[(0,a.EM)("affine-multi-tag-select")],I=[],B=(0,s.Tm)(s.ao),$=[],T=[],O=[],P=[],H=[],A=[],L=[],D=[],Z=[],j=[],V=[],z=[],R=[],F=[],N=[],q=[],U=[],W=[];return class extends B{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(B[Symbol.metadata]??null):void 0;i=[(0,a.P)(".select-input")],m=[(0,a.MZ)({attribute:!1})],v=[(0,a.MZ)()],x=[(0,a.MZ)({attribute:!1})],_=[(0,a.MZ)({attribute:!1})],C=[(0,a.MZ)({attribute:!1})],k=[(0,a.wk)()],S=[(0,a.wk)()],M=[(0,a.MZ)({attribute:!1})],b(this,null,i,{kind:"accessor",name:"_selectInput",static:!1,private:!1,access:{has:e=>"_selectInput"in e,get:e=>e._selectInput,set:(e,t)=>{e._selectInput=t}},metadata:s},$,T),b(this,null,m,{kind:"accessor",name:"editComplete",static:!1,private:!1,access:{has:e=>"editComplete"in e,get:e=>e.editComplete,set:(e,t)=>{e.editComplete=t}},metadata:s},O,P),b(this,null,v,{kind:"accessor",name:"mode",static:!1,private:!1,access:{has:e=>"mode"in e,get:e=>e.mode,set:(e,t)=>{e.mode=t}},metadata:s},H,A),b(this,null,x,{kind:"accessor",name:"onChange",static:!1,private:!1,access:{has:e=>"onChange"in e,get:e=>e.onChange,set:(e,t)=>{e.onChange=t}},metadata:s},L,D),b(this,null,_,{kind:"accessor",name:"onOptionsChange",static:!1,private:!1,access:{has:e=>"onOptionsChange"in e,get:e=>e.onOptionsChange,set:(e,t)=>{e.onOptionsChange=t}},metadata:s},Z,j),b(this,null,C,{kind:"accessor",name:"options",static:!1,private:!1,access:{has:e=>"options"in e,get:e=>e.options,set:(e,t)=>{e.options=t}},metadata:s},V,z),b(this,null,k,{kind:"accessor",name:"selectedIndex",static:!1,private:!1,access:{has:e=>"selectedIndex"in e,get:e=>e.selectedIndex,set:(e,t)=>{e.selectedIndex=t}},metadata:s},R,F),b(this,null,S,{kind:"accessor",name:"text",static:!1,private:!1,access:{has:e=>"text"in e,get:e=>e.text,set:(e,t)=>{e.text=t}},metadata:s},N,q),b(this,null,M,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:s},U,W),b(null,e={value:t},E,{kind:"class",name:t.name,metadata:s},null,I),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=y}_filterOptions(){let e=this.optionsIdMap(),t=!1,i=this.options.map(t=>({...t,group:this.getTagGroup(t,e)})).filter(e=>!this.text||this.getTagFullName(e,e.group).toLocaleLowerCase().includes(this.text.toLocaleLowerCase())).map(e=>(this.getTagFullName(e,e.group)===this.text&&(t=!0),{...e,isCreate:!1,select:()=>this._onSelect(e.id)}));return this.text&&!t&&i.push({id:"create",color:this.color,value:this.text,isCreate:!0,group:[],select:this._createOption}),i}clearColor(){this._currentColor=void 0}get color(){return this._currentColor||(this._currentColor=(0,g.y)()),this._currentColor}getGroupInfoByFullName(e){let t=e.split("/"),i=t.slice(0,-1),s=[];for(let e of i){let t=s[s.length-1],i=this.options.find(i=>i.parentId===t?.id&&i.value===e);if(!i)return;s.push(i)}return{name:t[t.length-1],group:s,parent:s[s.length-1]}}getTagFullName(e,t){return[...t,e].map(e=>e.value).join("/")}getTagGroup(e,t=this.optionsIdMap()){let i=[],s=e.parentId;for(;s;){let e=t[s];i.unshift(e),s=e.parentId}return i}optionsIdMap(){return Object.fromEntries(this.options.map(e=>[e.id,e]))}get selectedTag(){return this.filteredOptions[this.selectedIndex]}setSelectedOption(e){this.selectedIndex=(0,u.Kf)(e,0,this.filteredOptions.length)}firstUpdated(){requestAnimationFrame(()=>{this._selectInput.focus()}),this._disposables.addFromEvent(this,"click",()=>{this._selectInput.focus()}),this._disposables.addFromEvent(this._selectInput,"copy",e=>{e.stopPropagation()}),this._disposables.addFromEvent(this._selectInput,"cut",e=>{e.stopPropagation()})}render(){this.filteredOptions=this._filterOptions(),this.setSelectedOption(this.selectedIndex);let e=this.value,t=new Map(this.options.map(e=>[e.id,e]));return(0,d.qy)`
${e.map(i=>{let s=t.get(i);if(!s)return;let o=(0,c.W)({backgroundColor:s.color});return(0,d.qy)`
${s.value}
${p.DatabaseSearchClose}
`})}
Select tag or create one
${(0,l.u)(this.filteredOptions,e=>e.id,(e,t)=>{let i=t===this.selectedIndex,s=(0,n.H)({"select-option":!0,selected:i}),o=(0,c.W)({backgroundColor:e.color});return(0,d.qy)`
${e.isCreate?(0,d.qy)`
Create ${p.PlusIcon}
`:""}
${e.group.map((e,t)=>{let i=(0,c.W)({backgroundColor:e.color});return(0,d.qy)`${0===t?"":(0,d.qy)`/`}${e.value}`})}
${e.value}
${e.isCreate?null:(0,d.qy)`
${p.MoreHorizontalIcon}
`}
`})}
`}get isSingleMode(){return"single"===this.mode}#it;get _selectInput(){return this.#it}set _selectInput(e){this.#it=e}#ii;get editComplete(){return this.#ii}set editComplete(e){this.#ii=e}#is;get mode(){return this.#is}set mode(e){this.#is=e}#eY;get onChange(){return this.#eY}set onChange(e){this.#eY=e}#io;get onOptionsChange(){return this.#io}set onOptionsChange(e){this.#io=e}#z;get options(){return this.#z}set options(e){this.#z=e}#ir;get selectedIndex(){return this.#ir}set selectedIndex(e){this.#ir=e}#ia;get text(){return this.#ia}set text(e){this.#ia=e}#eJ;get value(){return this.#eJ}set value(e){this.#eJ=e}constructor(){super(...arguments),this._clickItemOption=(e,t)=>{e.stopPropagation();let i=this.options.find(e=>e.id===t);i&&(0,h.zs)(e.target,{options:{input:{initValue:i.value,onComplete:e=>{this.changeTag({...i,value:e})}},items:[{type:"action",name:"Delete",icon:p.DeleteIcon,class:"delete-item",select:()=>{this.deleteTag(t)}},{type:"group",name:"color",children:()=>g.C.map(e=>{let t=(0,c.W)({backgroundColor:e.color,borderRadius:"50%",width:"20px",height:"20px"});return{type:"action",name:e.name,icon:(0,d.qy)`
`,isSelected:i.color===e.color,select:()=>{this.changeTag({...i,color:e.color})}}})}]},middleware:[(0,r.RK)()]})},this._createOption=()=>{let e=this.text.trim();if(""===e)return;let t=this.getGroupInfoByFullName(e);if(!t)return;let i=t.name,s=this.color;this.clearColor();let r={id:(0,o.Ak)(),value:i,color:s,parentId:t.parent?.id};this.newTags([r]);let a=this.isSingleMode?[r.id]:[...this.value,r.id];this.onChange(a),this.text="",this.isSingleMode&&this.editComplete()},this._currentColor=void 0,this._onDeleteSelected=(e,t)=>{let i=e.filter(e=>e!==t);this.onChange(i)},this._onInput=e=>{this.text=e.target.value},this._onInputKeydown=e=>{e.stopPropagation();let t=this.text.trim();if("Backspace"===e.key&&""===t)this._onDeleteSelected(this.value,this.value[this.value.length-1]);else if("Enter"!==e.key||e.isComposing){if("ArrowUp"===e.key)e.preventDefault(),this.setSelectedOption(this.selectedIndex-1);else if("ArrowDown"===e.key)e.preventDefault(),this.setSelectedOption(this.selectedIndex+1);else if("Escape"===e.key)this.editComplete();else if("Tab"===e.key){e.preventDefault();let t=this.selectedTag;t&&(this.text=this.getTagFullName(t,t.group))}}else this.selectedTag?.select()},this._onSelect=e=>{if(!this.value.some(t=>t===e)){if(!(this.value.indexOf(e)>-1)){let t=this.isSingleMode?[e]:[...this.value,e];this.onChange(t),this.isSingleMode&&setTimeout(()=>{this.editComplete()},4)}this.text=""}},this.filteredOptions=[],this.changeTag=e=>{this.onOptionsChange(this.options.map(t=>t.id===e.id?e:t))},this.deleteTag=e=>{this.onOptionsChange(this.options.filter(t=>t.id!==e).map(t=>({...t,parentId:t.parentId===e?void 0:t.parentId})))},this.newTags=e=>{this.onOptionsChange([...e,...this.options])},this.#it=w(this,$,void 0),this.#ii=(w(this,T),w(this,O,void 0)),this.#is=(w(this,P),w(this,H,"multi")),this.#eY=(w(this,A),w(this,L,void 0)),this.#io=(w(this,D),w(this,Z,void 0)),this.#z=(w(this,j),w(this,V,[])),this.#ir=(w(this,z),w(this,R,0)),this.#ia=(w(this,F),w(this,N,"")),this.#eJ=(w(this,q),w(this,U,[])),w(this,W)}static{w(t,I)}},t})(),_=(e,t)=>{let i=new x;t.mode&&(i.mode=t.mode),i.style.width=`${Math.max(t.minWidth??e.offsetWidth,e.offsetWidth)}px`,i.value=t.value,i.onChange=e=>{t.onChange(e),i.value=e},i.options=t.options,i.onOptionsChange=e=>{t.onOptionsChange(e),i.options=e},i.editComplete=()=>{t.onComplete?.(),s()};let s=(0,h.fx)(e,i,{onClose:t.onComplete,middleware:[(0,r.UU)(),(0,r.cY)({mainAxis:-28,crossAxis:112})],container:t.container});return s}},25721:(e,t,i)=>{i.d(t,{F5:()=>s.F5,Z4:()=>s.Z4,ep:()=>s.ep});var s=i(91837)},25420:(e,t,i)=>{i.d(t,{T:()=>s});let s=(e,t)=>(i,s)=>{let o=e(i,t(s));return{unmount:o.unmount,update:e=>{o.update(t(e))},expose:o.expose}}},91837:(e,t,i)=>{i.d(t,{F5:()=>p,Z4:()=>h,ep:()=>d});var s=i(7595),o=i(31980),r=i(91449),a=i(4564),n=i(54719),l=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},c=function(e,t,i){for(var s=arguments.length>2,o=0;o(0,r.qy)` `;(()=>{let e,t,i,o,n,d=[(0,a.EM)("uni-lit")],h=[],u=s.ao,p=[],f=[],g=[],m=[],v=[],y=[];(class extends u{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;i=[(0,a.MZ)({attribute:!1})],o=[(0,a.MZ)({attribute:!1})],n=[(0,a.MZ)({attribute:!1})],l(this,null,i,{kind:"accessor",name:"props",static:!1,private:!1,access:{has:e=>"props"in e,get:e=>e.props,set:(e,t)=>{e.props=t}},metadata:s},p,f),l(this,null,o,{kind:"accessor",name:"ref",static:!1,private:!1,access:{has:e=>"ref"in e,get:e=>e.ref,set:(e,t)=>{e.ref=t}},metadata:s},g,m),l(this,null,n,{kind:"accessor",name:"uni",static:!1,private:!1,access:{has:e=>"uni"in e,get:e=>e.uni,set:(e,t)=>{e.uni=t}},metadata:s},v,y),l(null,e={value:t},d,{kind:"class",name:t.name,metadata:s},null,h),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,r.AH)` uni-lit { display: contents; } `}mount(){this.uniReturn=this.uni?.(this,this.props),this.ref&&(this.ref.value=this.uniReturn?.expose)}unmount(){this.uniReturn?.unmount()}connectedCallback(){super.connectedCallback(),this.mount()}disconnectedCallback(){super.disconnectedCallback(),this.unmount()}render(){return(0,r.qy)``}updated(e){super.updated(e),e.has("uni")?(this.unmount(),this.mount()):e.has("props")&&this.uniReturn?.update(this.props)}get expose(){return this.uniReturn?.expose}#tq=c(this,p,void 0);get props(){return this.#tq}set props(e){this.#tq=e}#il=(c(this,f),c(this,g,void 0));get ref(){return this.#il}set ref(e){this.#il=e}#ic=(c(this,m),c(this,v,void 0));get uni(){return this.#ic}set uni(e){this.#ic=e}constructor(){super(...arguments),c(this,y)}static{c(t,h)}})})();let h=e=>(t,i)=>{let s=new e;return Object.assign(s,i),t.append(s),{update:e=>{Object.assign(s,e),s.requestUpdate()},unmount:()=>{s.remove()},expose:s}},u=(()=>{let e,t,i,r,n,d=[(0,a.EM)("uni-any-render")],h=[],u=(0,o.Jb)(s.ao),p=[],f=[],g=[],m=[],v=[],y=[];return class extends u{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;i=[(0,a.MZ)({attribute:!1})],r=[(0,a.MZ)({attribute:!1})],n=[(0,a.MZ)({attribute:!1})],l(this,null,i,{kind:"accessor",name:"expose",static:!1,private:!1,access:{has:e=>"expose"in e,get:e=>e.expose,set:(e,t)=>{e.expose=t}},metadata:s},p,f),l(this,null,r,{kind:"accessor",name:"props",static:!1,private:!1,access:{has:e=>"props"in e,get:e=>e.props,set:(e,t)=>{e.props=t}},metadata:s},g,m),l(this,null,n,{kind:"accessor",name:"renderTemplate",static:!1,private:!1,access:{has:e=>"renderTemplate"in e,get:e=>e.renderTemplate,set:(e,t)=>{e.renderTemplate=t}},metadata:s},v,y),l(null,e={value:t},d,{kind:"class",name:t.name,metadata:s},null,h),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),c(t,h)}render(){return this.renderTemplate(this.props,this.expose)}#id=c(this,p,void 0);get expose(){return this.#id}set expose(e){this.#id=e}#tq=(c(this,f),c(this,g,void 0));get props(){return this.#tq}set props(e){this.#tq=e}#tU=(c(this,m),c(this,v,void 0));get renderTemplate(){return this.#tU}set renderTemplate(e){this.#tU=e}constructor(){super(...arguments),c(this,y)}},t})(),p=e=>(t,i)=>{let s=new u;return s.props=i,s.expose={},s.renderTemplate=e,t.append(s),{update:e=>{s.props=e,s.requestUpdate()},unmount:()=>{s.remove()},expose:s.expose}}},65967:(e,t,i)=>{i.d(t,{w:()=>u});var s=i(7595),o=i(91449),r=i(4564),a=i(1497),n=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},l=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,r.EM)("affine-lit-icon")],c=[],d=s.ao,h=[],u=[];return class extends d{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;n(this,null,[(0,r.MZ)({attribute:!1})],{kind:"accessor",name:"name",static:!1,private:!1,access:{has:e=>"name"in e,get:e=>e.name,set:(e,t)=>{e.name=t}},metadata:s},h,u),n(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,c),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,o.AH)` affine-lit-icon { display: flex; align-items: center; justify-content: center; } affine-lit-icon svg { fill: var(--affine-icon-color); } `}render(){return(0,o.qy)`${a[this.name]}`}#ih=l(this,h,void 0);get name(){return this.#ih}set name(e){this.#ih=e}constructor(){super(...arguments),l(this,u)}static{l(t,c)}},t})();var d=i(25420);let h=(0,i(91837).Z4)(c),u=e=>(0,d.T)(h,()=>({name:e}))},502:(e,t,i)=>{i.d(t,{Q:()=>o});var s=i(31980);class o{constructor(e,t){this.view=e,this.columnId=t,this.data$=(0,s.EW)(()=>this.view.columnGetData(this.id)),this.detailRenderer$=(0,s.EW)(()=>this.view.columnGetMeta(this.type)?.renderer.detailCellRenderer??this.renderer$.value),this.readonly$=(0,s.EW)(()=>this.view.readonly$.value||this.view.columnGetReadonly(this.id)),this.renderer$=(0,s.EW)(()=>this.view.columnGetMeta(this.type)?.renderer.cellRenderer)}cellGet(e){return this.view.cellGet(e,this.id)}getStringValue(e){return this.cellGet(e).stringValue$.value}getValue(e){return this.cellGet(e).value$.value}setValue(e,t){return this.cellGet(e).setValue(t)}setValueFromString(e,t){let i=this.view.columnParseValueFromString(this.id,t);i&&(i.data&&this.updateData(()=>i.data),this.setValue(e,i.value))}updateData(e){let t=this.data$.value;this.view.columnUpdateData(this.id,{...t,...e(t)})}updateHide(e){this.view.columnUpdateHide(this.id,e)}updateName(e){this.view.columnUpdateName(this.id,e)}get dataType(){return this.view.columnGetDataType(this.id)}get delete(){return()=>this.view.columnDelete(this.id)}get duplicate(){return()=>this.view.columnDuplicate(this.id)}get hide(){return this.view.columnGetHide(this.id)}get icon(){if(this.type)return this.view.getIcon(this.type)}get id(){return this.columnId}get index(){return this.view.columnGetIndex(this.id)}get isFirst(){return 0===this.view.columnGetIndex(this.id)}get isLast(){return this.view.columnGetIndex(this.id)===this.view.columnManagerList$.value.length-1}get name(){return this.view.columnGetName(this.id)}get type(){return this.view.columnGetType(this.id)}get updateType(){return e=>this.view.columnUpdateType(this.id,e)}}},26219:(e,t,i)=>{i.d(t,{d:()=>a});var s=i(31980);class o{constructor(e,t,i){this.view=e,this.columnId=t,this.rowId=i,this.column$=(0,s.EW)(()=>this.view.columnGet(this.columnId)),this.isEmpty$=(0,s.EW)(()=>this.meta$.value.model.ops.isEmpty(this.value$.value)),this.jsonValue$=(0,s.EW)(()=>this.view.cellGetJsonValue(this.rowId,this.columnId)),this.meta$=(0,s.EW)(()=>this.view.viewManager.dataSource.getPropertyMeta(this.column.type)),this.stringValue$=(0,s.EW)(()=>this.view.cellGetStringValue(this.rowId,this.columnId)),this.value$=(0,s.EW)(()=>this.view.viewManager.dataSource.cellGetValue(this.rowId,this.columnId))}getExtra(){}setValue(e){this.view.viewManager.dataSource.cellChangeValue(this.rowId,this.columnId,e)}get column(){return this.column$.value}get row(){return this.view.rowGet(this.rowId)}}class r{constructor(e,t){this.singleView=e,this.rowId=t,this.cells$=(0,s.EW)(()=>this.singleView.columns$.value.map(e=>new o(this.singleView,e,this.rowId)))}}class a{constructor(e,t){this.viewManager=e,this.id=t,this._filterVisible$=(0,s.vP)(!1),this.searchString=(0,s.vP)(""),this.columnManagerList$=(0,s.EW)(()=>this.columns$.value.map(e=>this.columnGet(e))),this.filterVisible$=(0,s.EW)(()=>this._filterVisible$.value??(this.filter$.value?.conditions.length??0)>0),this.name$=(0,s.EW)(()=>this.viewData$.value?.name??""),this.rows$=(0,s.EW)(()=>this.filteredRows(this.searchString.value)),this.vars$=(0,s.EW)(()=>this.columnsWithoutFilter$.value.map(e=>{let t=this.columnGet(e),i=this.dataSource.getPropertyMeta(t.type);return{id:t.id,name:t.name,type:i.model.dataType(t.data$.value),icon:t.icon}})),this.viewData$=(0,s.EW)(()=>this.dataSource.viewDataGet(this.id))}filteredRows(e){return this.dataSource.rows$.value.filter(t=>(!e||!!this.columns$.value.some(i=>this.cellGetStringValue(t,i)?.toLowerCase().includes(e?.toLowerCase())))&&this.isShow(t))}cellGet(e,t){return new o(this,t,e)}cellGetJsonValue(e,t){let i=this.columnGetType(t);if(i)return this.dataSource.getPropertyMeta(i).model.toJson(this.dataSource.cellGetValue(e,t),this.columnGetData(t))}cellGetStringValue(e,t){let i=this.columnGetType(t);if(i)return this.dataSource.getPropertyMeta(i).model.toString(this.dataSource.cellGetValue(e,t),this.columnGetData(t))??""}cellGetValue(e,t){let i=this.columnGetType(t);if(i)return this.dataSource.getPropertyMeta(i).model.formatValue(this.dataSource.cellGetValue(e,t),this.columnGetData(t))}cellUpdateRenderValue(e,t,i){this.dataSource.cellChangeValue(e,t,i)}cellUpdateValue(e,t,i){this.dataSource.cellChangeValue(e,t,i)}columnAdd(e,t){let i=this.dataSource.propertyAdd(e,t);return this.columnMove(i,e),i}columnDelete(e){this.dataSource.propertyDelete(e)}columnDuplicate(e){let t=this.dataSource.propertyDuplicate(e);this.columnMove(t,{before:!1,id:e})}columnGetData(e){return this.dataSource.propertyGetData(e)}columnGetDataType(e){let t=this.columnGetType(e);if(t)return this.dataSource.getPropertyMeta(t).model.dataType(this.columnGetData(e))}columnGetIdByIndex(e){return this.columns$.value[e]}columnGetIndex(e){return this.columns$.value.indexOf(e)}columnGetMeta(e){return this.dataSource.getPropertyMeta(e)}columnGetName(e){return this.dataSource.propertyGetName(e)}columnGetNextColumn(e){return this.columnGet(this.columnGetIdByIndex(this.columnGetIndex(e)+1))}columnGetPreColumn(e){return this.columnGet(this.columnGetIdByIndex(this.columnGetIndex(e)-1))}columnGetReadonly(e){return this.dataSource.propertyGetReadonly(e)}columnGetType(e){return this.dataSource.propertyGetType(e)}columnParseValueFromString(e,t){let i=this.columnGetType(e);if(i)return this.dataSource.getPropertyMeta(i).model.fromString(t,this.columnGetData(e))??""}columnUpdateData(e,t){this.dataSource.propertyChangeData(e,t)}columnUpdateName(e,t){this.dataSource.propertyChangeName(e,t)}columnUpdateType(e,t){this.dataSource.propertyChangeType(e,t)}delete(){this.viewManager.viewDelete(this.id)}duplicate(){this.viewManager.viewDuplicate(this.id)}filterSetVisible(e){this._filterVisible$.value=e}getContext(e){return this.dataSource.getContext(e)}getIcon(e){return this.dataSource.getPropertyMeta(e).renderer.icon}rowAdd(e){return this.dataSource.rowAdd(e)}rowDelete(e){this.dataSource.rowDelete(e)}rowGet(e){return new r(this,e)}rowMove(e,t){this.dataSource.rowMove(e,t)}setSearch(e){this.searchString.value=e}updateName(e){this.viewDataUpdate(()=>({name:e}))}viewDataUpdate(e){this.dataSource.viewDataUpdate(this.id,e)}get allColumnConfig(){return this.dataSource.addPropertyConfigList}get dataSource(){return this.viewManager.dataSource}get detailSlots(){return this.dataSource.detailSlots}get featureFlags$(){return this.dataSource.featureFlags$}get viewMeta(){return this.dataSource.viewMetaGet(this.type)}}},57178:(e,t,i)=>{i.d(t,{u:()=>f});var s=i(31980),o=i(29072),r=i(71006);class a{constructor(e){this.column=e,this.dataViewManager=e.view}_assertColumnType(e){(0,r.U2)(this.column.type,e,`This function should only be called in a column of type ${e}`)}_getAllValuesAsString(e){let t=this.column.type,i=[];for(let s of e?.rows??this.dataViewManager.rows$.value)if("multi-select"===t){let e=this.column.data$.value.options??[],t=this.column.getValue(s)??[],o=new Map(e?.map(e=>[e.id,e]));for(let e of t){let t=o.get(e);t&&i.push(t.value)}}else{let e=this.column.getStringValue(s);""!==e.trim()&&i.push(e)}return i}_getCheckBoxColValues(e){return this._assertColumnType("checkbox"),(e?.rows??this.dataViewManager.rows$.value).map(e=>this.column.getValue(e))}_getColValuesAsNumber(e){this._assertColumnType("number");let t=[];for(let i of e?.rows??this.dataViewManager.rows$.value){let e=this.column.getValue(i);void 0!==e&&t.push(e)}return t}_getColValuesAsString(e,t=!1){let i=(e?.rows??this.dataViewManager.rows$.value).map(e=>this.column.getStringValue(e));return t?i.filter(e=>""!==e.trim()):i}_getColumnValueCounts(e){return this._getAllValuesAsString(e).length}_getEmptyCellCount(e){let t=0;for(let i of e?.rows??this.dataViewManager.rows$.value)""===this.column.getStringValue(i).trim()&&t++;return t}_getNonEmptyCellCount(e){let t=0;for(let i of e?.rows??this.dataViewManager.rows$.value)""!==this.column.getStringValue(i).trim()&&t++;return t}checked(e){let t=0;for(let i of this._getCheckBoxColValues(e))i&&t++;return t}countAll(e){return e?.rows.length??this.dataViewManager.rows$.value.length}countEmpty(e){return this._getEmptyCellCount(e)}countNonEmpty(e){return this._getNonEmptyCellCount(e)}countUniqueValues(e){return[...new Set(this._getAllValuesAsString(e))].length}countValues(e){return this._getColumnValueCounts(e)}max(e){return Math.max(...this._getColValuesAsNumber(e))}mean(e){let t=this._getColValuesAsNumber(e),i=0;for(let e of t)i+=e;return i/t.length}median(e){let t=this._getColValuesAsNumber(e).sort((e,t)=>e-t),i=t.length,s=Math.floor(i/2);return i%2==0?(t[s-1]+t[s])/2:t[s]}min(e){return Math.min(...this._getColValuesAsNumber(e))}mode(e){let t=this._getColValuesAsNumber(e),i=new Map;t.forEach(e=>{let t=i.get(e);void 0===t?i.set(e,1):i.set(e,t+1)});let s=0,o=0;return i.forEach((e,t)=>{e>o&&(s=t,o=e)}),s}notChecked(e){let t=0;for(let i of this._getCheckBoxColValues(e))!i&&t++;return t}percentChecked(e){return this._assertColumnType("checkbox"),this.checked(e)/this.countAll(e)}percentEmpty(e){return this._getEmptyCellCount(e)/this.countAll(e)}percentNonEmpty(e){return 1-this.percentEmpty(e)}percentNotChecked(e){return this._assertColumnType("checkbox"),1-this.percentChecked(e)}range(e){return this.max(e)-this.min(e)}sum(e){let t=this._getColValuesAsNumber(e),i=0;for(let e of t)i+=e;return i}}var n=i(16921),l=i(90044),c=i(12552),d=i(47607),h=i(73297),u=i(502),p=i(26219);class f extends p.d{constructor(e,t){super(e,t),this.computedColumns$=(0,s.EW)(()=>this.columnsWithoutFilter$.value.map(e=>{let t=this.columnGet(e);return{id:t.id,hide:t.hide,width:t.width$.value,statCalcType:t.statCalcOp}})),this.columns$=(0,s.EW)(()=>this.columnsWithoutFilter$.value.filter(e=>!this.columnGetHide(e))),this.columnsWithoutFilter$=(0,s.EW)(()=>{let e=new Set(this.dataSource.properties$.value),t=[];return this.viewData$.value?.columns.forEach(i=>{e.has(i.id)&&(t.push(i.id),e.delete(i.id))}),t.push(...e),t}),this.detailColumns$=(0,s.EW)(()=>this.columnsWithoutFilter$.value.filter(e=>"title"!==this.columnGetType(e))),this.filter$=(0,s.EW)(()=>this.viewData$.value?.filter??o.hh),this.header$=(0,s.EW)(()=>this.viewData$.value?.header??{titleColumn:this.columnsWithoutFilter$.value.find(e=>"title"===this.columnGetType(e)),iconColumn:"type"}),this.readonly$=(0,s.EW)(()=>this.viewManager.readonly$.value)}changeGroup(e){if(null==e){this.viewDataUpdate(()=>({groupBy:void 0}));return}let t=this.columnGet(e);this.viewDataUpdate(e=>({groupBy:(0,n.A)(this.columnGetMeta(t.type),t.id,t.data$)}))}checkGroup(e,t,i){return!!c.H.isMatched(t,i)||(this.changeGroup(e),!1)}columnGet(e){return new g(this,e)}columnGetHide(e){return this.viewData$.value?.columns.find(t=>t.id===e)?.hide??!1}columnGetStatCalcOp(e){return this.viewData$.value?.columns.find(t=>t.id===e)?.statCalcType??"none"}columnGetWidth(e){return this.viewData$.value?.columns.find(t=>t.id===e)?.width??this.dataSource.propertyGetDefaultWidth(e)}columnMove(e,t){this.viewDataUpdate(()=>{let i=this.computedColumns$.value.findIndex(t=>t.id===e);if(i<0)return{};let s=[...this.computedColumns$.value],[o]=s.splice(i,1),r=(0,h.q)(t,s);return s.splice(r,0,o),{columns:s}})}columnUpdateHide(e,t){this.viewDataUpdate(()=>({columns:this.computedColumns$.value.map(i=>i.id===e?{...i,hide:t}:i)}))}columnUpdateStatCalcOp(e,t){this.viewDataUpdate(()=>({columns:this.computedColumns$.value.map(i=>i.id===e?{...i,statCalcType:t}:i)}))}columnUpdateWidth(e,t){this.viewDataUpdate(()=>({columns:this.computedColumns$.value.map(i=>i.id===e?{...i,width:t}:i)}))}hasHeader(e){return Object.values(this.header$).some(t=>this.cellGetValue(e,t))}isInHeader(e){return Object.values(this.header$).some(t=>t===e)}isShow(e){if(this.filter$.value?.conditions.length){let t=Object.fromEntries(this.columnManagerList$.value.map(t=>[t.id,t.cellGet(e).jsonValue$.value]));return(0,d.H)(this.filter$.value,t)}return!0}rowAdd(e,t){let i=super.rowAdd(e);return t&&this.groupHelper?.addToGroup(i,t),i}rowGetNext(e){let t=this.rows$.value.indexOf(e);return this.rows$.value[t+1]}rowGetPrev(e){let t=this.rows$.value.indexOf(e);return this.rows$.value[t-1]}rowMove(e,t,i,s){if(null==s){super.rowMove(e,t);return}this.groupHelper?.moveCardTo(e,i,s,t)}updateFilter(e){this.viewDataUpdate(()=>({filter:e}))}get groupHelper(){let e=this.viewData$.value?.groupBy;if(!e)return;let t=c.H.find(t=>t.data.name===e.name);if(!t)return;let i=t.data,s=this.columnGetDataType(e.columnId);return s?this.checkGroup(e.columnId,t.type,s)?new l.e(e,i,s,this,{sortGroup:e=>(0,l.R)(e,e=>e,this.groupProperties.map(e=>e.key)),sortRow:(e,t)=>{let i=this.groupProperties.find(t=>t.key===e);return(0,l.R)(t,e=>e,i?.manuallyCardSort??[])},changeGroupSort:e=>{let t=new Map(this.groupProperties.map(e=>[e.key,e]));this.viewDataUpdate(()=>({groupProperties:e.map(e=>t.get(e)||{key:e,hide:!1,manuallyCardSort:[]})}))},changeRowSort:(e,t,i)=>{let s=new Map(this.groupProperties.map(e=>[e.key,e]));this.viewDataUpdate(()=>({groupProperties:e.map(e=>{if(e!==t)return s.get(e)??{key:e,hide:!1,manuallyCardSort:[]};{let t=s.get(e);return t?{...t,manuallyCardSort:i}:{key:e,hide:!1,manuallyCardSort:i}}})}))}}):this.groupHelper:void 0}get groupProperties(){return this.viewData$.value?.groupProperties??[]}get name(){return this.viewData$.value?.name??""}get type(){return this.viewData$.value?.mode??"table"}}class g extends u.Q{constructor(e,t){super(e,t),this.tableView=e,this.stats=new a(this),this.width$=(0,s.EW)(()=>this.tableView.columnGetWidth(this.id))}updateStatCalcOp(e){return this.tableView.columnUpdateStatCalcOp(this.id,e)}updateWidth(e){this.tableView.columnUpdateWidth(this.id,e)}get statCalcOp(){return this.tableView.columnGetStatCalcOp(this.id)}}},42764:(e,t,i)=>{i.d(t,{p:()=>p});var s=i(39514),o=i(50307),r=i(99023);let a={isChecked:{type:(0,o.dz)({args:[r.dG.create()],rt:r.dG.create()}),label:"Is checked",impl:e=>!!e},isUnchecked:{type:(0,o.dz)({args:[r.dG.create()],rt:r.dG.create()}),label:"Is unchecked",impl:e=>!e}},n={before:{type:(0,o.dz)({args:[r.vi.create(),r.vi.create()],rt:r.dG.create()}),label:"Before",impl:(e,t)=>"number"!=typeof e||"number"!=typeof t||e"number"!=typeof e||"number"!=typeof t||e>t}},l={containsAll:{type:(0,o.dz)({typeVars:[(0,o.Ou)("options",r.l0.create())],args:[(0,o.cX)((0,o.I3)("options")),(0,o.cX)((0,o.I3)("options"))],rt:r.dG.create()}),label:"Contains all",impl:(e,t)=>!(Array.isArray(t)&&Array.isArray(e))||!t.length||t.every(t=>e.includes(t))},containsOneOf:{type:(0,o.dz)({typeVars:[(0,o.Ou)("options",r.l0.create())],args:[(0,o.cX)((0,o.I3)("options")),(0,o.cX)((0,o.I3)("options"))],rt:r.dG.create()}),name:"containsOneOf",label:"Contains one of",impl:(e,t)=>!(Array.isArray(t)&&Array.isArray(e))||!t.length||t.some(t=>e.includes(t))},doesNotContainsOneOf:{type:(0,o.dz)({typeVars:[(0,o.Ou)("options",r.l0.create())],args:[(0,o.cX)((0,o.I3)("options")),(0,o.cX)((0,o.I3)("options"))],rt:r.dG.create()}),label:"Does not contains one of",impl:(e,t)=>!(Array.isArray(t)&&Array.isArray(e))||!t.length||t.every(t=>!e.includes(t))},doesNotContainsAll:{type:(0,o.dz)({typeVars:[(0,o.Ou)("options",r.l0.create())],args:[(0,o.cX)((0,o.I3)("options")),(0,o.cX)((0,o.I3)("options"))],rt:r.dG.create()}),label:"Does not contains all",impl:(e,t)=>!(Array.isArray(t)&&Array.isArray(e))||!t.length||!t.every(t=>e.includes(t))}},c={greatThan:{type:(0,o.dz)({args:[r.Qc.create(),r.Qc.create()],rt:r.dG.create()}),label:">",impl:(e,t)=>"number"!=typeof(e=e??0)||"number"!=typeof t||e>t},greatThanOrEqual:{type:(0,o.dz)({args:[r.Qc.create(),r.Qc.create()],rt:r.dG.create()}),label:">=",impl:(e,t)=>"number"!=typeof(e=e??0)||"number"!=typeof t||e>=t},lessThan:{type:(0,o.dz)({args:[r.Qc.create(),r.Qc.create()],rt:r.dG.create()}),label:"<",impl:(e,t)=>"number"!=typeof(e=e??0)||"number"!=typeof t||e"number"!=typeof(e=e??0)||"number"!=typeof t||e<=t},equal:{type:(0,o.dz)({args:[r.Qc.create(),r.Qc.create()],rt:r.dG.create()}),label:"==",impl:(e,t)=>"number"!=typeof(e=e??0)||"number"!=typeof t||e==t},notEqual:{type:(0,o.dz)({args:[r.Qc.create(),r.Qc.create()],rt:r.dG.create()}),label:"!=",impl:(e,t)=>"number"!=typeof(e=e??0)||"number"!=typeof t||e!=t}},d={is:{type:(0,o.dz)({args:[r.si.create(),r.si.create()],rt:r.dG.create()}),label:"Is",impl:(e,t)=>"string"!=typeof e||"string"!=typeof t||""===t||e==t},isNot:{type:(0,o.dz)({args:[r.si.create(),r.si.create()],rt:r.dG.create()}),label:"Is not",impl:(e,t)=>"string"!=typeof e||"string"!=typeof t||""===t||e!=t},contains:{type:(0,o.dz)({args:[r.si.create(),r.si.create()],rt:r.dG.create()}),label:"Contains",impl:(e,t)=>"string"!=typeof e||"string"!=typeof t||""===t||e.includes(t)},doesNoContains:{type:(0,o.dz)({args:[r.si.create(),r.si.create()],rt:r.dG.create()}),label:"Does no contains",impl:(e,t)=>"string"!=typeof e||"string"!=typeof t||""===t||!e.includes(t)},startsWith:{type:(0,o.dz)({args:[r.si.create(),r.si.create()],rt:r.dG.create()}),label:"Starts with",impl:(e,t)=>"string"!=typeof e||"string"!=typeof t||""===t||e.startsWith(t)},endsWith:{type:(0,o.dz)({args:[r.si.create(),r.si.create()],rt:r.dG.create()}),label:"Ends with",impl:(e,t)=>"string"!=typeof e||"string"!=typeof t||""===t||e.endsWith(t)}},h={isOneOf:{type:(0,o.dz)({typeVars:[(0,o.Ou)("options",r.l0.create())],args:[(0,o.I3)("options"),(0,o.cX)((0,o.I3)("options"))],rt:r.dG.create()}),label:"Is one of",impl:(e,t)=>!Array.isArray(t)||!t.length||t.includes(e)},isNotOneOf:{type:(0,o.dz)({typeVars:[(0,o.Ou)("options",r.l0.create())],args:[(0,o.I3)("options"),(0,o.cX)((0,o.I3)("options"))],rt:r.dG.create()}),label:"Is not one of",impl:(e,t)=>!Array.isArray(t)||!t.length||!t.includes(e)}},u={isNotEmpty:{type:(0,o.dz)({args:[o.Zb.create()],rt:r.dG.create()}),label:"Is not empty",impl:e=>Array.isArray(e)?e.length>0:"string"==typeof e?!!e:null!=e},isEmpty:{type:(0,o.dz)({args:[o.Zb.create()],rt:r.dG.create()}),label:"Is empty",impl:e=>Array.isArray(e)?0===e.length:"string"==typeof e?!e:null==e}},p=new s.P((e,t)=>{if("function"!==e.type)return!1;let i=o.Sy.subst(Object.fromEntries(e.typeVars?.map(e=>[e.name,e.bound])??[]),e).args[0];return i&&o.Sy.isSubtype(i,t)});Object.entries({...n,...l,...c,...d,...h,...a,...u}).forEach(([e,{type:t,...i}])=>{p.register(t,{name:e,...i})})},94108:(e,t,i)=>{i.d(t,{A:()=>n});var s=i(73711),o=i(73297);class r extends s.zg{addColumn(e,t){let i=t.id??this.doc.generateBlockId();return this.columns.some(e=>e.id===i)||this.doc.transact(()=>{let s={...t,id:i};this.columns.splice((0,o.q)(e,this.columns),0,s)}),i}applyCellsUpdate(){this.doc.updateBlock(this,{cells:this.cells})}applyColumnUpdate(){this.doc.updateBlock(this,{columns:this.columns})}applyViewsUpdate(){this.doc.updateBlock(this,{views:this.views})}copyCellsByColumn(e,t){this.doc.transact(()=>{Object.keys(this.cells).forEach(i=>{let s=this.cells[i][e];s&&(this.cells[i][t]={...s,columnId:t})})})}deleteColumn(e){let t=this.findColumnIndex(e);t<0||this.doc.transact(()=>{this.columns.splice(t,1)})}deleteRows(e){this.doc.transact(()=>{for(let t of e)delete this.cells[t]})}deleteView(e){this.doc.captureSync(),this.doc.transact(()=>{this.views=this.views.filter(t=>t.id!==e)})}duplicateView(e){let t=this.doc.generateBlockId();return this.doc.transact(()=>{let i=this.views.findIndex(t=>t.id===e),s=this.views[i];s&&this.views.splice(i+1,0,JSON.parse(JSON.stringify({...s,id:t})))}),t}findColumnIndex(e){return this.columns.findIndex(t=>t.id===e)}getCell(e,t){if("title"===t)return{columnId:"title",value:e};let i=this.cells$.value[e],s=i?.[t]??null;return s?{columnId:s.columnId,value:s.value}:null}getColumn(e){return this.columns.find(t=>t.id===e)}getViewList(){return this.views}moveViewTo(e,t){this.doc.transact(()=>{this.views=(0,o.b)(this.views,t=>t.id===e,e=>(0,o.q)(t,e))}),this.applyViewsUpdate()}updateCell(e,t){e in this.cells||(this.cells[e]=Object.create(null)),this.doc.transact(()=>{this.cells[e][t.columnId]={columnId:t.columnId,value:t.value}})}updateCells(e,t){this.doc.transact(()=>{Object.entries(t).forEach(([t,i])=>{this.cells[t][e]={columnId:e,value:i}})})}updateColumn(e,t){let i=this.columns.findIndex(t=>t.id===e);if(null!=i)return this.doc.transact(()=>{let e=this.columns[i],s=t(e);this.columns[i]={...e,...s}}),e}updateView(e,t){this.doc.transact(()=>{this.views=this.views.map(i=>i.id!==e?i:{...i,...t(i)})}),this.applyViewsUpdate()}}let a={toV3:e=>{let t=(0,s.Ak)(),i=e.titleColumnName,o=e.titleColumnWidth;delete e.titleColumnName,delete e.titleColumnWidth,e.columns.unshift({id:t,type:"title",name:i,data:{}}),e.views.forEach(e=>{"table"===e.mode&&e.columns.unshift({id:t,width:o,statCalcType:"none"})})}},n=(0,s.A9)({flavour:"affine:database",props:e=>({views:[],title:e.Text(),cells:Object.create(null),columns:[]}),metadata:{role:"hub",version:3,parent:["affine:note"],children:["affine:paragraph","affine:list"]},toModel:()=>new r,onUpgrade:(e,t,i)=>{t<3&&i>=3&&a.toV3(e)}})},40048:(e,t,i)=>{i.d(t,{Rg:()=>b,_0:()=>v,gG:()=>y,nP:()=>w});var s=i(68419),o=i(73134),r=i(73711),a=i(21984),n=i(75973),l=i(59634),c=i(6125),d=i(78946),h=i(54399),u=i(16921),p=i(12552),f=i(35018),g=i(7548);let m={table:(e,t,i,s)=>({id:i,name:s,mode:"table",columns:[],filter:{type:"group",op:"and",conditions:[]},header:{titleColumn:t.columns.find(e=>"title"===e.type)?.id,iconColumn:"type"}}),kanban(e,t,i,r){let a=t.columns.filter(t=>{let i=e[t.type].model.dataType(t.data);return!!p.H.match(i)&&"title"!==t.type}),n=e=>[l.r.type,d.C.type].includes(e.type)?3:[c.H.type,h.p.type].includes(e.type)?2:1,f=a.sort((e,t)=>n(t)-n(e))[0];if(!f)throw new s.Ss(o.O.DatabaseBlockError,"not implement yet");return{id:i,name:r,mode:"kanban",columns:t.columns.map(e=>({id:e.id,hide:!1})),filter:{type:"group",op:"and",conditions:[]},groupBy:(0,u.A)(e[f.type],f.id,f.data),header:{titleColumn:t.columns.find(e=>"title"===e.type)?.id,iconColumn:"type"},groupProperties:[]}}},v=(e,t)=>{e.addColumn("start",n.I.create(n.I.model.name)),w(e,t)},y=(e,t)=>{e.addColumn("end",f.Xx.multiSelectColumnConfig.model.create("Tag",{options:[]})),v(e,t)},b=(e,t)=>{let i=[(0,r.Ak)(),(0,r.Ak)(),(0,r.Ak)()],s=e.addColumn("end",f.Xx.selectColumnConfig.model.create("Status",{options:[{id:i[0],color:(0,g.y)(),value:"TODO"},{id:i[1],color:(0,g.y)(),value:"In Progress"},{id:i[2],color:(0,g.y)(),value:"Done"}]}));for(let t=0;t<4;t++){let o=e.doc.addBlock("affine:paragraph",{text:new e.doc.Text(`Task ${t+1}`)},e.id);e.updateCell(o,{columnId:s,value:i[t]})}v(e,t)},w=(e,t)=>{let i=e.doc.generateBlockId(),s=m[t.type](a.GA,e,i,t.model.defaultName);return e.doc.transact(()=>{e.views=[...e.views,s]}),s}},82192:(e,t,i)=>{i.d(t,{C:()=>s});let s=(0,i(73711).A9)({flavour:"affine:divider",metadata:{version:1,role:"content",children:[]}})},19860:(e,t,i)=>{i.d(t,{C:()=>a,Q:()=>n});var s=i(73711),o=i(31971),r=i(16019);let a=(0,s.A9)({flavour:"affine:edgeless-text",props:()=>({xywh:"[0,0,16,16]",index:"a0",color:"#000000",fontFamily:r.ay.Inter,fontStyle:r.zz.Normal,fontWeight:r.IT.Regular,textAlign:r.nO.Left,scale:1,rotate:0,hasMaxWidth:!1}),metadata:{version:1,role:"hub",parent:["affine:surface"],children:["affine:paragraph","affine:list","affine:code","affine:image","affine:bookmark","affine:attachment","affine:embed-!(synced-doc)"]},toModel:()=>new n});class n extends(0,o.S)(s.zg){}},77824:(e,t,i)=>{i.d(t,{TE:()=>r,eE:()=>a,zy:()=>n});var s=i(73711),o=i(76020);let r=/https:\/\/[\w.-]+\.?figma.com\/([\w-]+)\/([0-9a-zA-Z]{22,128})(?:\/.*)?$/,a=["figma"];class n extends(0,o.I)(s.zg){}},45170:(e,t,i)=>{i.d(t,{S:()=>a});var s=i(91721),o=i(77824);let r={style:o.eE[0],url:"",caption:null,title:null,description:null},a=(0,s.E)({name:"figma",version:1,toModel:()=>new o.zy,props:()=>r})},9456:(e,t,i)=>{i.d(t,{EO:()=>r,gy:()=>n,js:()=>a});var s=i(73711),o=i(76020);let r=/^(?:https?:\/\/)?(?:www\.)?github\.com\/([^/]+)\/([^/]+)\/(issue|pull)s?\/(\d+)$/,a=["vertical","horizontal","list","cube"];class n extends(0,o.I)(s.zg){}},23746:(e,t,i)=>{i.d(t,{f:()=>a});var s=i(91721),o=i(9456);let r={style:o.js[1],owner:"",repo:"",githubType:"issue",githubId:"",url:"",caption:null,image:null,status:null,statusReason:null,title:null,description:null,createdAt:null,assignees:null},a=(0,s.E)({name:"github",version:1,toModel:()=>new o.gy,props:()=>r})},58280:(e,t,i)=>{i.d(t,{P:()=>r,_:()=>a});var s=i(73711),o=i(76020);let r=["html"];class a extends(0,o.I)(s.zg){}},22042:(e,t,i)=>{i.d(t,{D:()=>a});var s=i(91721),o=i(58280);let r={style:o.P[0],caption:null,html:void 0,design:void 0},a=(0,s.E)({name:"html",version:1,toModel:()=>new o._,props:()=>r})},3714:(e,t,i)=>{i.d(t,{T:()=>r,w:()=>a});var s=i(73711),o=i(76020);let r=["vertical","horizontal","list","cube","horizontalThin"];class a extends(0,o.I)(s.zg){}},55012:(e,t,i)=>{i.d(t,{V:()=>a});var s=i(91721),o=i(3714);let r={pageId:"",style:o.T[1],caption:null},a=(0,s.E)({name:"linked-doc",version:1,toModel:()=>new o.w,props:()=>r})},88680:(e,t,i)=>{i.d(t,{S_:()=>n,kn:()=>r,lE:()=>a});var s=i(73711),o=i(76020);let r=/(?:https?:\/\/)??(?:www\.)?loom\.com\/share\/([a-zA-Z0-9]+)/,a=["video"];class n extends(0,o.I)(s.zg){}},61082:(e,t,i)=>{i.d(t,{L:()=>a});var s=i(91721),o=i(88680);let r={style:o.lE[0],url:"",caption:null,image:null,title:null,description:null,videoId:null},a=(0,s.E)({name:"loom",version:1,toModel:()=>new o.S_,props:()=>r})},62652:(e,t,i)=>{i.d(t,{A:()=>r,F:()=>a});var s=i(73711),o=i(76020);let r=["syncedDoc"];class a extends(0,o.I)(s.zg){}},29838:(e,t,i)=>{i.d(t,{O:()=>a});var s=i(91721),o=i(62652);let r={pageId:"",style:o.A[0],caption:void 0,scale:void 0},a=(0,s.E)({name:"synced-doc",version:1,toModel:()=>new o.F,props:()=>r})},55708:(e,t,i)=>{i.d(t,{QH:()=>n,R_:()=>a,iB:()=>r});var s=i(73711),o=i(76020);let r=/(?:https?:\/\/)?(?:(?:www|m)\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([\w-_]+)/,a=["video"];class n extends(0,o.I)(s.zg){}},58542:(e,t,i)=>{i.d(t,{X:()=>a});var s=i(91721),o=i(55708);let r={style:o.R_[0],url:"",caption:null,image:null,title:null,description:null,creator:null,creatorUrl:null,creatorImage:null,videoId:null},a=(0,s.E)({name:"youtube",version:1,toModel:()=>new o.QH,props:()=>r})},33096:(e,t,i)=>{i.d(t,{K:()=>n,o:()=>a});var s=i(94098),o=i(73711),r=i(31971);let a=(0,o.A9)({flavour:"affine:frame",props:e=>({title:e.Text(),background:"--affine-palette-transparent",xywh:"[0,0,100,100]",index:"a0"}),metadata:{version:1,role:"content",parent:["affine:surface"],children:[]},toModel:()=>new n});class n extends(0,r.S)(o.zg){includesPoint(e,t,i){return!!s.z.deserialize(this.xywh).isPointNearBound([e,t],5)||(this.externalBound?.isPointInBound([e,t])??!1)}intersectsBound(e){let t=s.z.deserialize(this.xywh);return t.isIntersectWithBound(e)||e.contains(t)}}},14558:(e,t,i)=>{i.d(t,{m:()=>l,e:()=>n});var s=i(73711),o=i(31971);class r extends s.S4{async fromSnapshot(e){let t=await super.fromSnapshot(e),i=t.props.sourceId;return e.assets.isEmpty()||!i||i.startsWith("/")||await e.assets.writeToBlob(i),t}async toSnapshot(e){let t=await super.toSnapshot(e),i=e.model.sourceId;return i&&await e.assets.readFromBlob(i),t}}let a={caption:"",sourceId:"",width:0,height:0,index:"a0",xywh:"[0,0,0,0]",rotate:0,size:-1},n=(0,s.A9)({flavour:"affine:image",props:()=>a,metadata:{version:1,role:"content"},transformer:()=>new r,toModel:()=>new l});class l extends(0,o.S)(s.zg){}},21167:(e,t,i)=>{i.d(t,{v1U:()=>nU,VCv:()=>la,O1o:()=>G.O1o,orQ:()=>G.orQ,wER:()=>nW,rjt:()=>v.rj,wYV:()=>aR,sq2:()=>hc,vw3:()=>vS,IfI:()=>mA,SAc:()=>G.SAc,cPQ:()=>vt,Q_W:()=>vi,yYJ:()=>wR,$oz:()=>G.$oz,dYB:()=>vs,n1p:()=>vo,RyS:()=>G.RyS,J9s:()=>v.J9,lOw:()=>G.lOw,CY:()=>wb,loI:()=>G.loI,B19:()=>v.B1,cc9:()=>vT,a16:()=>vL,yni:()=>G.yni,d7y:()=>G.d7y,c8j:()=>b$,u05:()=>vD,UdY:()=>G.UdY,BAN:()=>G.BAN,FrX:()=>he,MyE:()=>iC,rYV:()=>i_,exN:()=>ld,tX8:()=>ln,BH6:()=>yA,gWp:()=>ht,npq:()=>yB,JaD:()=>fG,fFq:()=>mX,U1$:()=>mK,wwJ:()=>m3,Xtf:()=>ve,n6F:()=>fh,QLR:()=>tu.Q,EXs:()=>iM,Ats:()=>vz,dyY:()=>vF,z1s:()=>vN,ZVR:()=>vW,JTL:()=>rH,xP9:()=>rD,PoU:()=>vY,FTM:()=>vK,W8j:()=>vJ,Frf:()=>wV.F,J3u:()=>v0,nig:()=>v2,U9e:()=>iI,irK:()=>y5,xhi:()=>wn.xh,BQZ:()=>G.BQZ,SoJ:()=>G.SoJ,Nrq:()=>G.Nrq,WXD:()=>G.WXD,TXg:()=>G.TXg,ma5:()=>G.ma5,n9L:()=>U.n9,FZ8:()=>aJ,mK9:()=>v5.m,mFI:()=>v4,YXb:()=>v6,fA2:()=>vn,amD:()=>G.amD,yOR:()=>G.yOR,qYV:()=>G.qYV,hhn:()=>G.hhn,x_r:()=>ou,P5Y:()=>bF,xkA:()=>yu,FNZ:()=>eN.F,TG:()=>a1,ARu:()=>v.AR,i6S:()=>wz.i,xAB:()=>eq,NTi:()=>ue.N,B6b:()=>yI,ko3:()=>e$.ko,gZg:()=>G.gZg,kbk:()=>yZ,MNr:()=>yD,rFg:()=>nC,ZIh:()=>m7,a4$:()=>m9,DNe:()=>b8,b16:()=>yT,jlj:()=>yO,yPR:()=>wn.yP,YE2:()=>U.YE,JBs:()=>eY,c11:()=>G.c11,cyi:()=>G.cyi,Edk:()=>vB,NAP:()=>G.NAP,sDQ:()=>U.sD,B5W:()=>v.B5,fs6:()=>iU.f,t64:()=>G.t64,P3Z:()=>G.P3Z,n6X:()=>v.n6,N$i:()=>G.N$i,Qtn:()=>j.Q,m_M:()=>U.m_,D_h:()=>wn.D_,qpS:()=>G.qpS,bMW:()=>a0,j0U:()=>O.j0,clE:()=>U.cl,xqQ:()=>eX,HzZ:()=>e0,afe:()=>e2,aKu:()=>ez.aK,hw5:()=>v.hw,TUT:()=>v.TU,UNy:()=>vE,qZN:()=>v.qZ,Arh:()=>of.Ar,zU6:()=>of.zU,fp4:()=>v.fp,op$:()=>O.op,on:()=>O.on,OoU:()=>O.Oo,p6j:()=>O.p6,O40:()=>tn,oVP:()=>wj.o,kMM:()=>U.kM,showImportModal:()=>oa,tO3:()=>eQ});var s,o,r,a,n,l,c=i(68419),d=i(73134),h=i(43228),u=i(46427),p=i(94098),f=i(73711),g=i(48520),m=i(40942),v=i(12194);let y={gapHorizontal:130,gapVertical:10,x:0,y:0},b=e=>e.reduce((e,t)=>e+t,0),w=(e,t)=>{let{height:i}=e,s=e.children.map(e=>w(e,t));return{self:e,height:Math.max(i,s.reduce((e,t)=>e+t.height,0)+t.gapVertical*(s.length-1)),children:s}},x=(e,t,i,s)=>{let{self:o,children:r,height:a}=e,n={self:{x:t,y:i-o.height/2,width:o.width,height:o.height},children:[]},l=i-a/2;return r.forEach(i=>{let{height:o}=i,r=l+o/2;l+=o+s.gapVertical,n.children.push(x(i,t+e.self.width+s.gapHorizontal,r,s))}),n},_=(e,t,i,s)=>{let{self:o,children:r,height:a}=e,n={self:{x:t-o.width,y:i-o.height/2,width:o.width,height:o.height},children:[]},l=i-a/2;return r.forEach(i=>{let{height:o}=i,r=l+o/2;l+=o+s.gapVertical,n.children.push(_(i,t-e.self.width-s.gapHorizontal,r,s))}),n},C=(e,t)=>{let{width:i}=e,s=e.children.map(e=>C(e,t));return{self:e,width:Math.max(i,s.reduce((e,t)=>e+t.width,0)+t.gapHorizontal*(s.length-1)),children:s}},k=(e,t,i,s)=>{let{self:o,children:r,width:a}=e,n={self:{x:t,y:i,width:o.width,height:o.height},children:[]},l=t-a/2;return r.forEach(e=>{let{self:t,width:o}=e,r=l+o/2;l+=o+s.gapHorizontal,n.children.push(k(e,r,i-t.height-s.gapVertical,s))}),n},S=(e,t,i,s)=>{let{self:o,children:r,width:a}=e,n={self:{x:t,y:i,width:o.width,height:o.height},children:[]},l=t-a/2;return r.forEach(e=>{let{self:t,width:o}=e,r=l+o/2;l+=o+s.gapHorizontal,n.children.push(S(e,r,i+t.height+s.gapVertical,s))}),n},M={right:(e,t)=>{let i={...y,...t};return x(w(e,i),i.x,i.y,i)},left:(e,t)=>{let i={...y,...t};return _(w(e,i),0,0,i)},leftRight:(e,t)=>{let i={...y,...t},s=e.children.map(e=>w(e,i)),o=s.reduce((e,t)=>Math.max(e,t.height),0)/2,r=[],a=[],n=!0,l=0;s.forEach(e=>{n?r.push(e):a.push(e),l+=e.height,n&&l>o&&(n=!1,l=0)});let c=0-(b(a.map(e=>e.height))+i.gapVertical*(a.length-1))/2,d=0-(r.reduce((e,t)=>e+t.height,0)+i.gapVertical*(r.length-1))/2,h={self:{x:0-e.width/2,y:0-e.height/2,width:e.width,height:e.height},children:[]};return r.forEach(t=>{h.children.push(_(t,0-(e.width/2+i.gapHorizontal),d+t.height/2,i)),d+=t.height+i.gapVertical}),a.forEach(t=>{h.children.push(x(t,e.width/2+i.gapHorizontal,c+t.height/2,i)),c+=t.height+i.gapVertical}),h},top:(e,t)=>{let i={...y,...t};return k(C(e,i),0,0,i)},bottom:(e,t)=>{let i={...y,...t};return S(C(e,i),0,0,i)},topBottom:(e,t)=>{let i={...y,...t},s=e.children.map(e=>C(e,i)),o=s.reduce((e,t)=>Math.max(e,t.width),0)/2,r=[],a=[],n=!0,l=0;s.forEach(e=>{n?r.push(e):a.push(e),l+=e.width,n&&l>o&&(n=!1,l=0)});let c=0-(b(r.map(e=>e.width))+i.gapHorizontal*(r.length-1))/2,d=0-(a.reduce((e,t)=>e+t.width,0)+i.gapHorizontal*(a.length-1))/2,h={self:{x:0,y:0,width:e.width,height:e.height},children:[]};return r.forEach(t=>{h.children.push(k(t,c+t.width/2,0-(e.height/2+i.gapVertical),i)),c+=t.width+i.gapHorizontal}),a.forEach(t=>{h.children.push(S(t,d+t.width/2,e.height/2+i.gapVertical,i)),d+=t.width+i.gapHorizontal}),h}},E={shapeType:"rect",strokeColor:"--affine-palette-line-blue",fillColor:"--affine-palette-shape-blue",radius:.1,strokeWidth:2,strokeStyle:v.u1.Solid,shapeStyle:v.lH.General},I={stroke:"--affine-palette-line-black",mode:v.B1.Orthogonal,strokeWidth:2,strokeStyle:v.u1.Solid,frontEndpointStyle:"None",rearEndpointStyle:"None"},B={left:{from:[0,.5],to:[1,.5]},right:{from:[1,.5],to:[0,.5]},top:{from:[.5,0],to:[.5,1]},bottom:{from:[.5,1],to:[.5,0]}},$=(e,t,i)=>{let s=[],o=[],r=(e,a=!1)=>{let{text:n,children:l}=e,c=e.id?e.id:a&&i?.rootId?i.rootId:t.addElement(v.J9.SHAPE,{...E,xywh:"[0,0,0,0]",text:new f.rl.Y.Text(n)});s.push(c);let d=t.getElementById(c),h=Math.max(...n.split("\n").map(e=>(0,v.Lu)(e,(0,g.Dy)(d))))+2*m.OL,u=(0,v.dN)(d,new p.z(0,0,Math.max(148,Math.min(600,h)),78));return{id:c,width:u.w,height:u.h,children:l.map(e=>{let t=r(e);return o.push({from:c,to:t.id}),t})}},a=r(e,!0),n=i?.rootId?t.getElementById(i.rootId):void 0,l=M.right(a,{gapHorizontal:130,gapVertical:10,x:n?n.x:i?.x??0,y:n?n.y:i?.y??0}),c=(e,i)=>{let{id:s,width:o,height:r}=e,{x:a,y:n}=i.self;t.updateElement(s,{xywh:`[${a},${n},${o},${r}]`}),e.children.forEach((e,t)=>{c(e,i.children[t])})};return c(a,l),{shapeIds:s,connectorIds:[]}},T=(e,t,i)=>{let s=e=>{let{children:i,id:o}=e,r=t.getElementById(o);return{id:o,width:r.w,height:r.h,children:i.map(e=>s(e))}},o=s(e),r=i?.rootId?t.getElementById(i.rootId):void 0,a=M.right(o,{gapHorizontal:130,gapVertical:10,x:r?r.x:i?.x??0,y:r?r.y:i?.y??0}),n=(e,i)=>{let{id:s,width:o,height:r}=e,{x:a,y:l}=i.self;t.updateElement(s,{xywh:`[${a},${l},${o},${r}]`}),e.children.forEach((e,t)=>{n(e,i.children[t])})};n(o,a)};var O=i(60019),P=i(7595),H=i(71006),A=i(46317),L=i(91449),D=i(4564),Z=i(54719),j=i(66050),V=i(10859);let z=new class{constructor(e){this.maxSize=e,this.cache=new Map}get(e){let t=this.cache.get(e);return void 0===t?null:(this.cache.delete(e),this.cache.set(e,t),t)}set(e,t){if(this.cache.size>=this.maxSize){let e=this.cache.keys().next().value;this.cache.delete(e)}this.cache.set(e,t)}}(4e3);var R=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},F=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("affine-code-line")],r=[],a=P.ao,n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({type:Object})],s=[(0,D.MZ)({attribute:!1})],R(this,null,i,{kind:"accessor",name:"delta",static:!1,private:!1,access:{has:e=>"delta"in e,get:e=>e.delta,set:(e,t)=>{e.delta=t}},metadata:h},n,l),R(this,null,s,{kind:"accessor",name:"highlightOptionsGetter",static:!1,private:!1,access:{has:e=>"highlightOptionsGetter"in e,get:e=>e.highlightOptionsGetter,set:(e,t)=>{e.highlightOptionsGetter=t}},metadata:h},c,d),R(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h}),F(t,r)}render(){(0,H.Z1)(this.highlightOptionsGetter,"highlightOptionsGetter is not set");let{lang:e,highlighter:t}=this.highlightOptionsGetter();if(!t||!t.getLoadedLanguages().includes(e))return(0,L.qy)``;let i=j.Q.mode,s=`${this.delta.insert}-${e}-${i}`,o=z.get(s),r=[{content:this.delta.insert}];o?r=o:(r=t.codeToTokensBase(this.delta.insert,{lang:e,theme:"dark"===i?V.n0:V.dA})[0],z.set(s,r));let a=r.map(e=>(0,L.qy)``);return(0,L.qy)`${a}`}#iu=F(this,n,{insert:A.pe});get delta(){return this.#iu}set delta(e){this.#iu=e}#ip=(F(this,l),F(this,c,null));get highlightOptionsGetter(){return this.#ip}set highlightOptionsGetter(e){this.#ip=e}constructor(){super(...arguments),F(this,d)}})})(),i(42766);var N=i(35018),q=i(31980),U=i(1325),W=i(35632),G=i(69147);let Y=(e,t)=>{let i=e.path??e.currentSelectionPath;(0,H.Z1)(i,"`path` is required, you need to pass it in args or ctx before adding this command to the pipeline.");let s=e.std.doc.getParent(i);if(!s)return;let o=e.std.view.getBlock(s.id);o&&t({blockIndex:o.childBlocks.findIndex(e=>e.blockId===i),parentBlock:o})},K=(e,t)=>{let i=e.path??e.currentSelectionPath;(0,H.Z1)(i,"`path` is required, you need to pass it in args or ctx before adding this command to the pipeline.");let s=function(e,t){let i=e.view.getBlock(t);if(!i)return null;let s=null;return(i.childBlocks[0]&&(s=i.childBlocks[0]),s||(s=function(e,t){let i=e.view,s=e.doc.getNext(t.model);return s?i.getBlock(s.id):null}(e,i)),s&&!s.contains(i))?s:null}(e.std,i);s&&t({nextBlock:s})},X=(e,t)=>{let i=e.path??e.currentSelectionPath;(0,H.Z1)(i,"`path` is required, you need to pass it in args or ctx before adding this command to the pipeline.");let s=function(e,t){let i=e.view,s=function(e,t){let i=e.view,s=i.getBlock(t);if(!s)return null;let o=e.doc.getPrev(s.model);return o?i.getBlock(o.id):null}(e,t);return s&&i.getBlock(t)&&s&&s.blockId!==t?s:null}(e.std,i);s&&t({prevBlock:s})},Q=(e,t)=>{let{types:i=["block","text","image"],roles:s=["content"],mode:o="flat"}=e,r=[],a=e.textSelection??e.currentTextSelection;if(i.includes("text")&&a)try{let t=e.std.range.textSelectionToRange(a);if(!t)return;let i=e.std.range.getSelectedBlockComponentsByRange(t,{match:e=>s.includes(e.model.role),mode:o});r.push(...i)}catch{return}let n=e.blockSelections??e.currentBlockSelections;if(i.includes("block")&&n){let t=e.std.view,i=e.std.doc,a=n.flatMap(e=>{let r=t.getBlock(e.blockId);if(!r)return[];let a=[r],n=e.blockId;if("all"===o){let e=null;do{if(!(e=i.getParent(n)))break;let t=e;if(t instanceof P.p_&&!s.includes(t.model.role))break;n=e.id}while(e)(e=t.getBlock(n))&&a.push(e)}return["all","flat"].includes(o)&&t.walkThrough(e=>{if(!(e instanceof P.p_))return!0;s.includes(e.model.role)&&a.push(e)},n),a});r.push(...a)}let l=e.imageSelections??e.currentImageSelections;if(i.includes("image")&&l){let t=e.std.view,i=l.map(e=>t.getBlock(e.blockId)).filter(e=>!!e);r.push(...i)}e.filter&&(r=r.filter(e.filter));let c=r.filter((e,t)=>r.indexOf(e)===t).sort((e,t)=>{if(e===t)return 0;let i=e.compareDocumentPosition(t);return i&Node.DOCUMENT_POSITION_FOLLOWING||i&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:i&Node.DOCUMENT_POSITION_PRECEDING||i&Node.DOCUMENT_POSITION_CONTAINS?1:0});0!==c.length&&t({selectedBlocks:c})},J=(e,t)=>{let i=e.draftedModels;if(!i){console.error("`draftedModels` is required, you need to use `draftSelectedModels` command before adding this command to the pipeline.");return}return i.then(t=>{let i=f.Ji.fromModels(e.std.doc,t);return e.std.clipboard.copy(i)}).then(()=>e.onCopy?.()).catch(console.error),t()},ee=(e,t)=>{let i=e.selectedModels;return(0,H.Z1)(i,"`selectedModels` is required, you need to use `getSelectedModels` command before adding this command to the pipeline."),i.forEach(t=>{e.std.doc.deleteBlock(t)}),t()},et=(e,t)=>{let i=e.selectedModels;if(!i){console.error("`selectedModels` is required, you need to use `getSelectedModels` command before adding this command to the pipeline.");return}return t({draftedModels:new Promise(e=>{let t=i.map(f.uS),s=new Map(t.map(e=>[e.id,e])),o=e=>{let t="affine:database"===e.flavour?e.children:e.children.filter(e=>s.has(e.id));t.forEach(e=>{s.delete(e.id),o(e)}),e.children=t};t.forEach(o),e(Array.from(s.values()))})})},ei=(e,t)=>{let i=e.types??["block","text","image"],s=e.mode??"flat",o=[];e.std.command.chain().tryAll(e=>[e.getTextSelection(),e.getBlockSelections(),e.getImageSelections()]).getSelectedBlocks({types:i,mode:s}).inline(e=>{let{selectedBlocks:t=[]}=e;o.push(...t.map(e=>e.model))}).run(),t({selectedModels:o})},es=(e,t)=>{let i=e.std.selection.filter("block");0!==i.length&&t({currentBlockSelections:i})},eo=(e,t)=>{let i=e.std.selection.filter("image");0!==i.length&&t({currentImageSelections:i})},er=(e,t)=>{let i=e.std.selection.find("text");i&&t({currentTextSelection:i})},ea=(e,t)=>{let i;let s=e.textSelection??e.currentTextSelection;if(!s)return;let o=e.std.range.textSelectionToRange(s);if(!o)return;let r=e.std.range.getSelectedBlockComponentsByRange(o,{mode:"flat"}),{from:a,to:n}=s,l=r.find(e=>a.blockId===e.blockId);if(!l||!(i=(0,O.op)(l.model,["affine:page"])?l.model.title:l.model.text))return;if(!n)return i.delete(a.index,a.length),e.std.selection.setGroup("note",[e.std.selection.create("text",{from:{blockId:a.blockId,index:a.index,length:0},to:null})]),t();let c=r.find(e=>n.blockId===e.blockId);if(!c)return;let d=c.model.text;d&&(i.delete(a.index,a.length),d.delete(0,n.length),i.join(d),r.filter(e=>e.model.id!==l.model.id).forEach(t=>{e.std.doc.deleteBlock(t.model)}),e.std.selection.setGroup("note",[e.std.selection.create("text",{from:{blockId:n.blockId,index:n.index,length:0},to:null})]),t())},en=["affine:paragraph","affine:list"],el=["affine:paragraph","affine:list"],ec=["affine:database"],ed=(e,t)=>{let i=e.blockSelections??e.currentBlockSelections;if((0,H.Z1)(i,"`blockSelections` is required, you need to pass it in args or use `getBlockSelections` command before adding this command to the pipeline."),0===i.length)return;let s=e.styles,o=e.mode??"merge";e.std.command.chain().getSelectedBlocks({blockSelections:i,filter:e=>el.includes(e.model.flavour),types:["block"]}).inline((e,t)=>{let{selectedBlocks:i}=e;(0,H.Z1)(i),i.flatMap(e=>{let t=e.querySelector(`[${A.jN}]`);return t?t.inlineEditor:[]}).forEach(e=>{e.formatText({index:0,length:e.yTextLength},s,{mode:o})}),t()}).run()&&t()};var eh=i(93574);let eu=(e,t)=>{let{styles:i,mode:s="merge"}=e,o=e.range;if(!o){let e=document.getSelection();if(!e||0===e.rangeCount)return;o=e.getRangeAt(0)}o&&(Array.from(e.std.host.querySelectorAll(`[${A.jN}]`)).filter(e=>o?.intersectsNode(e)).filter(e=>{let t=e.closest(`[${eh.u_}]`);return!!t&&ec.includes(t.model.flavour)}).map(e=>e.inlineEditor).forEach(e=>{let t=e.getInlineRange();t&&e.formatText(t,i,{mode:s})}),t())};function ep(e){let t=e.getInlineRange(),i=e.slots.inlineRangeUpdate.on(([s,o])=>{t&&s&&(!o&&s.index===t.index||o&&s.index===t.index+1)?t=s:(e.resetMarks(),i.dispose())})}let ef=(e,t)=>{let{styles:i,mode:s="merge"}=e,o=e.textSelection??e.currentTextSelection;o&&e.std.command.chain().getSelectedBlocks({textSelection:o,filter:e=>en.includes(e.model.flavour),types:["text"]}).inline((e,t)=>{let{selectedBlocks:r}=e;r&&(r.flatMap(e=>{let t=e.querySelector(`[${A.jN}]`);return t&&t.inlineEditor.getInlineRange()?t.inlineEditor:[]}).forEach(e=>{let t=e.getInlineRange();if(t){if(0===t.length){let s=e.getDeltaByRangeIndex(t.index);if(!s)return;e.setMarks({...e.marks,...Object.fromEntries(Object.entries(i).map(([t,i])=>"boolean"==typeof i?[t,e.marks&&e.marks[t]||s.attributes&&s.attributes[t]?null:i]:[t,i]))}),ep(e)}else e.formatText(t,i,{mode:s})}}),Promise.all(r.map(e=>e.updateComplete)).then(()=>{e.std.range.syncTextSelectionToRange(o)}).catch(console.error),t())}).run()&&t()};var eg=i(69050),em=i(96509);class ev extends f.Dy{fromBlockSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"AttachmentAdapter.fromBlockSnapshot is not implemented.")}fromDocSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"AttachmentAdapter.fromDocSnapshot is not implemented.")}fromSliceSnapshot(e){let t=[];for(let i of e.snapshot.content)if("block"===i.type){let{flavour:s,props:o}=i;if("affine:attachment"===s){let{sourceId:i}=o,s=e.assets?.getAssets().get(i);s&&t.push(s)}}return Promise.resolve({file:t,assetsIds:[]})}toBlockSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"AttachmentAdapter.toBlockSnapshot is not implemented.")}toDocSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"AttachmentAdapter.toDocSnapshot is not implemented.")}async toSliceSnapshot(e){let t=[];for(let i of e.file){let s=await (0,em.h)(await i.arrayBuffer());e.assets?.getAssets().set(s,i),await e.assets?.writeToBlob(s),t.push({type:"block",flavour:"affine:attachment",id:(0,f.Ak)(),props:{name:i.name,size:i.size,type:i.type,embed:!1,style:"horizontalThin",index:"a0",xywh:"[0,0,0,0]",rotate:0,sourceId:s},children:[]})}return 0===t.length?null:{type:"slice",content:t,pageVersion:e.pageVersion,workspaceVersion:e.workspaceVersion,workspaceId:e.workspaceId,pageId:e.pageId}}}var ey=i(67560),eb=i(30272),ew=i(26859),ex=i(73969),e_=i(81463),eC=i(71249);let ek=["python","c","java","cpp","csharp","vb","javascript","php","sql","asm","pascal","go","swift","matlab","r","rust","ruby","sas","ada","perl","objective-c","cobol","lisp","dart","lua","julia","d","kotlin","logo","scala","haskell","fsharp","scheme","typescript","groovy","abap","prolog","plsql","bash","apex","markdown","json","html","css","diff","jsx","tsx","vue"].reduce((e,t,i)=>({[t]:i,...e}),{});function eS(e){return(0,eC.Tu)(e)||V.XR.id===e}let eM=(e,t=!1)=>!e||eS(e)?null:ex.WL.find(t=>t.id.toLowerCase()===e.toLowerCase())||(t?null:ex.WL.find(t=>t.aliases?.includes(e.toLowerCase()))??null);var eE=i(73616);let eI=null,eB=async e=>{if(eI){let{langs:t}=e;return t&&await eI.loadLanguage(...t),eI}return eI=await (0,eE.kS)({...e})};var e$=i(38509),eT=i(74597);let eO=(e,t="")=>{if(!e)return t;switch(e.type){case"text":return e.value.replace(/\s+/g," ");case"element":if("br"===e.tagName)return"\n";return e.children.map(e=>eO(e)).join("")}return t},eP=e=>e&&"element"===e.type?e.children.filter(e=>"element"===e.type):[],eH=e=>e&&"element"===e.type?e.children.filter(e=>"text"===e.type):[],eA=e=>({...e,children:eH(e)}),eL=(e,t)=>{if("element"===e.type){if(e.tagName===t)return e;for(let i of e.children){let e=eL(i,t);if(e)return e}}},eD=(e,t)=>{if("element"===e.type){if(Array.isArray(e.properties?.className)&&e.properties.className.includes(t))return e;for(let i of e.children){let e=eD(i,t);if(e)return e}}},eZ=(e,t)=>{if("element"===e.type){if(e.properties.id===t)return e;for(let i of e.children){let e=eZ(i,t);if(e)return e}}},ej=(e,t)=>{if("root"===e.type)for(let i of e.children){let e=ej(i,t);if(e)return e}else if("element"===e.type)return t.startsWith(".")?eD(e,t.slice(1)):t.startsWith("#")?eZ(e,t.slice(1)):eL(e,t)},eV=(e,t)=>{if("element"===e.type){let i=e.children.map(e=>eV(e,t));return{...e,children:i.flatMap(e=>"element"===e.type&&t(e.tagName)?e.children:e)}}return e};var ez=i(62112);class eR extends f.Dy{constructor(){super(...arguments),this._astToHtml=e=>(0,e_.l)().use(ew.A).stringify(e),this._deltaToHast=e=>e.map(e=>{let t={type:"text",value:e.insert};if(e.attributes?.reference){let i=this.configs.get("title:"+e.attributes.reference.pageId);"string"==typeof i&&(t={type:"text",value:i})}return e.attributes&&(e.attributes.bold&&(t={type:"element",tagName:"strong",properties:{},children:[t]}),e.attributes.italic&&(t={type:"element",tagName:"em",properties:{},children:[t]}),e.attributes.code&&(t={type:"element",tagName:"code",properties:{},children:[t]}),e.attributes.strike&&(t={type:"element",tagName:"del",properties:{},children:[t]}),e.attributes.underline&&(t={type:"element",tagName:"u",properties:{},children:[t]}),e.attributes.link&&(t={type:"element",tagName:"a",properties:{href:e.attributes.link},children:[t]})),t}),this._deltaToHighlightHasts=async(e,t)=>{let i;if(!(e=e.reduce((e,t)=>(0,ez.Y3)(e,t,{force:!0}),[])).length)return[{type:"element",tagName:"span",children:[{type:"text",value:""}]}];let s=e[0];if("string"==typeof t&&(t=t.toLowerCase()),!t||"string"!=typeof t||eS(t)||"Text"===t||!ex.WL.map(({id:e})=>e).includes(t))return[{type:"text",value:s.insert}];let o=t,r=await eB({langs:[o],themes:[V.dA,V.n0]}),a=`${s.insert}-${t}-light`,n=z.get(a);return n?i=n:(i=r.codeToTokensBase(s.insert,{lang:o}).reduce((e,t,i)=>0===i?t:[...e,{content:"\n",color:"inherit"},...t],[]),z.set(a,i)),i.map(e=>({type:"element",tagName:"span",properties:{style:`word-wrap: break-word; color: ${e.color};`},children:[{type:"text",value:e.content}]}))},this._hastToDelta=(e,t={trim:!0,pre:!1})=>this._hastToDeltaSpreaded(e,t).reduce((e,t)=>(0,ez.Y3)(e,t),[]),this._hastToDeltaSpreaded=(e,t={trim:!0,pre:!1})=>{switch(void 0===t.trim&&(t.trim=!0),e.type){case"text":if(t.pre)return[{insert:e.value}];if(t.trim){let i=(0,ey.Z)(e.value,{trim:t.trim});if(i)return[{insert:i}];return[]}if(e.value)return[{insert:(0,ey.Z)(e.value)}];return[];case"element":switch(e.tagName){case"ol":case"ul":return[];case"span":case"bdi":case"bdo":case"ins":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,{trim:!1}));case"strong":case"b":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,{trim:!1}).map(e=>(e.attributes={...e.attributes,bold:!0},e)));case"i":case"em":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,{trim:!1}).map(e=>(e.attributes={...e.attributes,italic:!0},e)));case"code":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,{trim:!1}).map(e=>(e.attributes={...e.attributes,code:!0},e)));case"del":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,{trim:!1}).map(e=>(e.attributes={...e.attributes,strike:!0},e)));case"u":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,{trim:!1}).map(e=>(e.attributes={...e.attributes,underline:!0},e)));case"a":{let t=e.properties?.href;if("string"!=typeof t)return[];return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,{trim:!1}).map(e=>(t.startsWith("http")&&(e.attributes={...e.attributes,link:t}),e)))}case"mark":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,{trim:!1}).map(e=>(e.attributes={...e.attributes},e)));case"br":return[{insert:"\n"}]}}return"children"in e?e.children.flatMap(e=>this._hastToDeltaSpreaded(e,t)):[]},this._traverseHtml=async(e,t,i)=>{let s=new f.PV;return s.setONodeTypeGuard(e=>"type"in e&&void 0!==e.type),s.setEnter(async(e,t)=>{if("element"===e.node.type)switch(e.node.tagName){case"header":t.skipAllChildren();break;case"img":{if(!i)break;let s=e.node,o="string"==typeof s?.properties.src?s.properties.src:"";if(o){let e="";if((0,ez.vC)(o))try{let t=await (0,ez.aK)(o,void 0,this.configs.get("imageProxy"));if(!t)break;let s=t.clone(),r=(0,eT.u)(t.headers.get("Content-Disposition")??"")??(o.split("/").at(-1)??"image")+"."+(t.headers.get("Content-Type")?.split("/").at(-1)??"png"),a=new File([await t.blob()],r,{type:t.headers.get("Content-Type")??""});e=await (0,em.h)(await s.arrayBuffer()),i?.getAssets().set(e,a),await i?.writeToBlob(e)}catch(e){break}else i.getAssets().forEach((t,s)=>{let r=(0,f.wm)(i.getAssets(),s);decodeURIComponent(o).includes(r)&&(e=s)});t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:image",props:{sourceId:e},children:[]},"children").closeNode(),t.skipAllChildren()}break}case"pre":{let i=ej(e.node,"code");if(!i)break;let s=1===i.children.length&&"text"===i.children[0].type?i.children[0]:{...i,tagName:"div"},o=Array.isArray(i.properties?.className)?i.properties.className.find(e=>"string"==typeof e&&e.startsWith("code-")):void 0;o="string"==typeof o?o.replace("code-",""):void 0,t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:code",props:{language:o??"Plain Text",text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(s,{trim:!1,pre:!0})}},children:[]},"children").closeNode(),t.skipAllChildren();break}case"blockquote":{t.setGlobalContext("hast:blockquote",!0);let i=eH(e.node),s=i.every(e=>!e.value.trim());i&&!s&&t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:"quote",text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(eA(e.node))}},children:[]},"children").closeNode();break}case"body":case"div":case"span":case"footer":e.parent?.node.type==="element"&&"li"!==e.parent.node.tagName&&(eP(e.node).every(e=>["a","b","bdi","bdo","br","code","del","em","i","ins","mark","span","strong","u"].includes(e.tagName))||e.node.children.map(e=>e.type).every(e=>"text"===e))&&(t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:"text",text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(e.node)}},children:[]},"children").closeNode(),t.skipAllChildren());break;case"p":t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:t.getGlobalContext("hast:blockquote")?"quote":"text",text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(e.node)}},children:[]},"children");break;case"ul":case"ol":t.setNodeContext("hast:list:type","bulleted"),"ol"===e.node.tagName?t.setNodeContext("hast:list:type","numbered"):Array.isArray(e.node.properties?.className)&&(e.node.properties.className.includes("to-do-list")?t.setNodeContext("hast:list:type","todo"):e.node.properties.className.includes("toggle")?t.setNodeContext("hast:list:type","toggle"):e.node.properties.className.includes("bulleted-list")&&t.setNodeContext("hast:list:type","bulleted"));break;case"li":{let i=eP(e.node)[0],s=t.getNodeContext("hast:list:type");e.node=eV(e.node,e=>"div"===e||"p"===e),t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:list",props:{type:s,text:{"$blocksuite:internal:text$":!0,delta:"toggle"!==s?this._hastToDelta(e.node):this._hastToDelta(ej(e.node,"summary")??e.node)},checked:"todo"===s&&i&&Array.isArray(i.properties?.className)&&i.properties.className.includes("checkbox-on"),collapsed:"toggle"===s&&i&&"details"===i.tagName&&void 0===i.properties.open},children:[]},"children");break}case"hr":t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:divider",props:{},children:[]},"children").closeNode();break;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:e.node.tagName,text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(e.node)}},children:[]},"children").closeNode();break;case"iframe":{let i=e.node.properties?.src;if("string"!=typeof i)break;if(i.startsWith("https://www.youtube.com/embed/")){let e=i.substring(30,-1!==i.indexOf("?")?i.indexOf("?"):void 0);t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:embed-youtube",props:{url:`https://www.youtube.com/watch?v=${e}`},children:[]},"children").closeNode()}}}}),s.setLeave((e,t)=>{if("element"===e.node.type)switch(e.node.tagName){case"div":e.parent?.node.type==="element"&&"li"!==e.parent.node.tagName&&Array.isArray(e.node.properties?.className)&&(e.node.properties.className.includes("affine-paragraph-block-container")||e.node.properties.className.includes("affine-block-children-container")||e.node.properties.className.includes("indented"))&&t.closeNode();break;case"blockquote":t.setGlobalContext("hast:blockquote",!1);break;case"p":if(e.next?.type==="element"&&"div"===e.next.tagName&&Array.isArray(e.next.properties?.className)&&(e.next.properties.className.includes("affine-block-children-container")||e.next.properties.className.includes("indented")))break;t.closeNode();break;case"li":t.closeNode()}}),s.walk(e,t)},this._traverseSnapshot=async(e,t,i)=>{let s=[],o=new f.PV;return o.setONodeTypeGuard(e=>f.T1.safeParse(e).success),o.setEnter(async(e,t)=>{let o=e.node.props.text??{delta:[]};switch(e.node.flavour){case"affine:page":t.openNode({type:"element",tagName:"html",properties:{},children:[]},"children").openNode({type:"element",tagName:"head",properties:{},children:[]},"children").openNode({type:"element",tagName:"style",properties:{},children:[]},"children").openNode({type:"text",value:` input[type='checkbox'] { display: none; } label:before { background: rgb(30, 150, 235); border-radius: 3px; height: 16px; width: 16px; display: inline-block; cursor: pointer; } input[type='checkbox'] + label:before { content: ''; background: rgb(30, 150, 235); color: #fff; font-size: 16px; line-height: 16px; text-align: center; } input[type='checkbox']:checked + label:before { content: '✓'; } `.replace(/\s\s+/g,"")},"children").closeNode().closeNode().closeNode().openNode({type:"element",tagName:"body",properties:{},children:[]},"children").openNode({type:"element",tagName:"div",properties:{style:"width: 70vw; margin: 60px auto;"},children:[]},"children").openNode({type:"comment",value:"BlockSuiteDocTitlePlaceholder"}).closeNode();break;case"affine:code":"string"==typeof e.node.props.language&&(e.node.props.language=e.node.props.language.toLowerCase()),t.openNode({type:"element",tagName:"pre",properties:{},children:[]},"children").openNode({type:"element",tagName:"code",properties:{className:[`code-${e.node.props.language}`]},children:await this._deltaToHighlightHasts(o.delta,e.node.props.language)},"children").closeNode().closeNode();break;case"affine:paragraph":switch(e.node.props.type){case"text":t.openNode({type:"element",tagName:"div",properties:{className:["affine-paragraph-block-container"]},children:[]},"children").openNode({type:"element",tagName:"p",properties:{},children:this._deltaToHast(o.delta)},"children").closeNode().openNode({type:"element",tagName:"div",properties:{className:["affine-block-children-container"],style:"padding-left: 26px;"},children:[]},"children");break;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":t.openNode({type:"element",tagName:"div",properties:{className:["affine-paragraph-block-container"]},children:[]},"children").openNode({type:"element",tagName:e.node.props.type,properties:{},children:this._deltaToHast(o.delta)},"children").closeNode().openNode({type:"element",tagName:"div",properties:{className:["affine-block-children-container"],style:"padding-left: 26px;"},children:[]},"children");break;case"quote":t.openNode({type:"element",tagName:"div",properties:{className:["affine-paragraph-block-container"]},children:[]},"children").openNode({type:"element",tagName:"blockquote",properties:{className:["quote"]},children:[]},"children").openNode({type:"element",tagName:"p",properties:{},children:this._deltaToHast(o.delta)},"children").closeNode().closeNode().openNode({type:"element",tagName:"div",properties:{className:["affine-block-children-container"],style:"padding-left: 26px;"},children:[]},"children")}break;case"affine:list":{t.openNode({type:"element",tagName:"div",properties:{className:["affine-list-block-container"]},children:[]},"children").openNode({type:"element",tagName:"numbered"===e.node.props.type?"ol":"ul",properties:{style:"todo"===e.node.props.type?"list-style-type: none;":""},children:[]},"children");let i=this._deltaToHast(o.delta);"todo"===e.node.props.type&&i.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.node.props.checked},children:[{type:"element",tagName:"label",properties:{},children:[]}]}),t.openNode({type:"element",tagName:"li",properties:{},children:i},"children").closeNode().closeNode().openNode({type:"element",tagName:"div",properties:{className:["affine-block-children-container"],style:"padding-left: 26px;"},children:[]},"children");break}case"affine:divider":t.openNode({type:"element",tagName:"hr",properties:{},children:[]},"children").closeNode();break;case"affine:image":{let o=e.node.props.sourceId??"";if(!i)break;await i.readFromBlob(o);let r=i.getAssets().get(o);if(s.push(o),!r)break;let a=(0,f.wm)(i.getAssets(),o),n=e.node.props.width&&e.node.props.height?{width:`${e.node.props.width}px`,height:`${e.node.props.height}px`}:{};t.openNode({type:"element",tagName:"figure",properties:{className:["affine-image-block-container"]},children:[]},"children").openNode({type:"element",tagName:"img",properties:{src:`assets/${a}`,alt:a,title:e.node.props.caption??null,...n},children:[]},"children").closeNode().closeNode()}}}),o.setLeave((e,t)=>{switch(e.node.flavour){case"affine:page":t.closeNode().closeNode().closeNode();break;case"affine:paragraph":case"affine:list":t.closeNode().closeNode()}}),{ast:await o.walk(e,t),assetsIds:s}}}_htmlToAst(e){return(0,e_.l)().use(eb.A).parse(e)}async fromBlockSnapshot(e){let{ast:t,assetsIds:i}=await this._traverseSnapshot(e.snapshot,{type:"root",children:[{type:"doctype"}]},e.assets);return{file:this._astToHtml(t),assetsIds:i}}async fromDocSnapshot(e){let{file:t,assetsIds:i}=await this.fromBlockSnapshot({snapshot:e.snapshot.blocks,assets:e.assets});return{file:t.replace("",`

${e.snapshot.meta.title}

`),assetsIds:i}}async fromSliceSnapshot(e){let t="",i=[];for(let s of e.snapshot.content){let o={type:"root",children:[]},{ast:r,assetsIds:a}=await this._traverseSnapshot(s,o,e.assets);i.push(...a),t+=this._astToHtml(r)}return{file:t,assetsIds:i}}toBlockSnapshot(e){let t=this._htmlToAst(e.file),i={type:"block",id:(0,f.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:e$.ko.DocAndEdgeless},children:[]};return this._traverseHtml(t,i,e.assets)}async toDocSnapshot(e){let t=this._htmlToAst(e.file),i=ej(t,"title"),s={type:"block",id:(0,f.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:e$.ko.DocAndEdgeless},children:[]};return{type:"page",meta:{id:(0,f.Ak)(),title:eO(i,"Untitled"),createDate:Date.now(),tags:[]},blocks:{type:"block",id:(0,f.Ak)(),flavour:"affine:page",props:{title:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(i??{type:"text",value:"Untitled"})}},children:[{type:"block",id:(0,f.Ak)(),flavour:"affine:surface",props:{elements:{}},children:[]},await this._traverseHtml(t,s,e.assets)]}}}async toSliceSnapshot(e){let t=this._htmlToAst(e.file),i={type:"block",id:(0,f.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:e$.ko.DocAndEdgeless},children:[]},s=await this._traverseHtml(t,i,e.assets);return 0===s.children.length?null:{type:"slice",content:[s],pageVersion:e.pageVersion,workspaceVersion:e.workspaceVersion,workspaceId:e.workspaceId,pageId:e.pageId}}}class eF extends f.Dy{fromBlockSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"ImageAdapter.fromBlockSnapshot is not implemented.")}fromDocSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"ImageAdapter.fromDocSnapshot is not implemented.")}fromSliceSnapshot(e){let t=[];for(let i of e.snapshot.content)if("block"===i.type){let{flavour:s,props:o}=i;if("affine:image"===s){let{sourceId:i}=o,s=e.assets?.getAssets().get(i);s&&t.push(s)}}return Promise.resolve({file:t,assetsIds:[]})}toBlockSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"ImageAdapter.toBlockSnapshot is not implemented.")}toDocSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"ImageAdapter.toDocSnapshot is not implemented")}async toSliceSnapshot(e){let t=[];for(let i of e.file){let s=await (0,em.h)(await i.arrayBuffer());e.assets?.getAssets().set(s,i),await e.assets?.writeToBlob(s),t.push({type:"block",flavour:"affine:image",id:(0,f.Ak)(),props:{sourceId:s},children:[]})}return 0===t.length?null:{type:"slice",content:t,pageVersion:e.pageVersion,workspaceVersion:e.workspaceVersion,workspaceId:e.workspaceId,pageId:e.pageId}}}var eN=i(80650);class eq extends f.Dy{constructor(e){super(e),this._markdownAdapter=new eN.F(e)}async _traverseSnapshot(e){let t="",i=new f.PV;return i.setONodeTypeGuard(e=>f.T1.safeParse(e).success),i.setEnter(e=>{let i=e.node.props.text??{delta:[]};switch(e.node.flavour){case"affine:code":t+=i.delta.map(e=>e.insert).join("")+"\n";break;case"affine:paragraph":t+=i.delta.map(e=>e.insert).join("")+"\n";break;case"affine:list":t+=i.delta.map(e=>e.insert).join("")+"\n";break;case"affine:divider":t+="---\n"}}),await i.walkONode(e),{mixtext:t}}async fromBlockSnapshot({snapshot:e}){let{mixtext:t}=await this._traverseSnapshot(e);return{file:t,assetsIds:[]}}async fromDocSnapshot({snapshot:e,assets:t}){let i="";e.meta.title&&(i+=`${e.meta.title} `);let{file:s,assetsIds:o}=await this.fromBlockSnapshot({snapshot:e.blocks,assets:t});return{file:i+=s,assetsIds:o}}async fromSliceSnapshot({snapshot:e}){let t="";for(let i of e.content){let{mixtext:e}=await this._traverseSnapshot(i);t+=e}return{file:t.match(/\n/g)?.length===1?t.trimEnd():t,assetsIds:[]}}toBlockSnapshot(e){return e.file=e.file.replaceAll("\r",""),{type:"block",id:(0,f.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:e$.ko.DocAndEdgeless},children:e.file.split("\n").map(e=>({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:"text",text:{"$blocksuite:internal:text$":!0,delta:[{insert:e}]}},children:[]}))}}toDocSnapshot(e){return e.file=e.file.replaceAll("\r",""),{type:"page",meta:{id:(0,f.Ak)(),title:"Untitled",createDate:Date.now(),tags:[]},blocks:{type:"block",id:(0,f.Ak)(),flavour:"affine:page",props:{title:{"$blocksuite:internal:text$":!0,delta:[{insert:"Untitled"}]}},children:[{type:"block",id:(0,f.Ak)(),flavour:"affine:surface",props:{elements:{}},children:[]},{type:"block",id:(0,f.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:e$.ko.DocAndEdgeless},children:e.file.split("\n").map(e=>({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:"text",text:{"$blocksuite:internal:text$":!0,delta:[{insert:e}]}},children:[]}))}]}}}async toSliceSnapshot(e){return 0===e.file.trim().length?null:(e.file=e.file.replaceAll("\r",""),await this._markdownAdapter.toSliceSnapshot({file:e.file,assets:e.assets,pageVersion:e.pageVersion,workspaceVersion:e.workspaceVersion,workspaceId:e.workspaceId,pageId:e.pageId}))}}var eU=i(7548);let eW={typesSelect:"select",typesMultipleSelect:"multi-select",typesNumber:"number",typesCheckbox:"checkbox",typesText:"rich-text",typesTitle:"title"};class eG extends f.Dy{constructor(){super(...arguments),this._hastToDelta=(e,t={trim:!0,pre:!1})=>this._hastToDeltaSpreaded(e,t).reduce((e,t)=>{if(0===e.length)return[t];let i=e[e.length-1];return"string"==typeof i.insert&&"string"==typeof t.insert&&(0,H.n4)(i.attributes,t.attributes)?(i.insert+=t.insert,e):[...e,t]},[]),this._hastToDeltaSpreaded=(e,t={trim:!0,pre:!1})=>{switch(void 0===t.trim&&(t.trim=!0),e.type){case"text":if(t.pre)return[{insert:e.value}];if(t.trim){let i=(0,ey.Z)(e.value,{trim:t.trim});if(i)return[{insert:i}];return[]}if(e.value)return[{insert:(0,ey.Z)(e.value)}];return[];case"element":switch(e.tagName){case"ol":case"ul":return[];case"span":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,t));case"strong":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,t).map(e=>(e.attributes={...e.attributes,bold:!0},e)));case"em":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,t).map(e=>(e.attributes={...e.attributes,italic:!0},e)));case"code":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,t).map(e=>(e.attributes={...e.attributes,code:!0},e)));case"del":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,t).map(e=>(e.attributes={...e.attributes,strike:!0},e)));case"u":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,t).map(e=>(e.attributes={...e.attributes,underline:!0},e)));case"a":{let i=e.properties?.href;if("string"!=typeof i)return[];return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,t).map(e=>{if(t.pageMap){let s=t.pageMap.get(decodeURIComponent(i));if(s)return e.attributes={...e.attributes,reference:{type:"LinkedPage",pageId:s}},e.insert=" ",e}return i.startsWith("http")&&(e.attributes={...e.attributes,link:i}),e}))}case"mark":return e.children.flatMap(e=>this._hastToDeltaSpreaded(e,t).map(e=>(e.attributes={...e.attributes},e)))}}return"children"in e?e.children.flatMap(e=>this._hastToDeltaSpreaded(e,t)):[]},this._traverseNotionHtml=async(e,t,i,s)=>{let o=new f.PV;return o.setONodeTypeGuard(e=>"type"in e&&void 0!==e.type),o.setEnter(async(e,t)=>{if("element"===e.node.type)switch(e.node.tagName){case"header":t.skipAllChildren();break;case"img":{if(!i||t.getGlobalContext("hast:disableimg"))break;let s=e.node,o="string"==typeof s?.properties.src?s.properties.src:"";if(o){let e="";if((0,ez.vC)(o)){let t=await (0,ez.aK)(o,void 0,this.configs.get("imageProxy"));if(!t)break;let s=t.clone(),r=(0,eT.u)(t.headers.get("Content-Disposition")??"")??o.split("/").at(-1)??"image."+(t.headers.get("Content-Type")?.split("/").at(-1)??"png"),a=new File([await t.blob()],r,{type:t.headers.get("Content-Type")??""});e=await (0,em.h)(await s.arrayBuffer()),i?.getAssets().set(e,a),await i?.writeToBlob(e)}else i.getAssets().forEach((t,s)=>{let r=(0,f.wm)(i.getAssets(),s);decodeURIComponent(o).includes(r)&&(e=s)});t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:image",props:{sourceId:e},children:[]},"children").closeNode(),t.skipAllChildren()}break}case"pre":{let i=ej(e.node,"code");if(!i)break;let s=1===i.children.length&&"text"===i.children[0].type?i.children[0]:{...i,tag:"div"};t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:code",props:{language:"Plain Text",text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(s,{trim:!1,pre:!0})}},children:[]},"children").closeNode(),t.skipAllChildren();break}case"blockquote":t.setGlobalContext("hast:blockquote",!0),t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:"quote",text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(eA(e.node),{pageMap:s})}},children:[]},"children").closeNode();break;case"p":if(!e.node.properties.id)break;t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:t.getGlobalContext("hast:blockquote")?"quote":"text",text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(e.node,{pageMap:s})}},children:[]},"children");break;case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:e.node.tagName,text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(e.node,{pageMap:s})}},children:[]},"children").closeNode();break;case"ul":case"ol":t.setNodeContext("hast:list:type","bulleted"),"ol"===e.node.tagName?t.setNodeContext("hast:list:type","numbered"):Array.isArray(e.node.properties?.className)&&(e.node.properties.className.includes("to-do-list")?t.setNodeContext("hast:list:type","todo"):e.node.properties.className.includes("toggle")?t.setNodeContext("hast:list:type","toggle"):e.node.properties.className.includes("bulleted-list")&&t.setNodeContext("hast:list:type","bulleted"));break;case"li":{let i=eP(e.node)[0],o=t.getNodeContext("hast:list:type");t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:list",props:{type:o,text:{"$blocksuite:internal:text$":!0,delta:"toggle"!==o?this._hastToDelta(e.node,{pageMap:s}):this._hastToDelta(ej(e.node,"summary")??e.node,{pageMap:s})},checked:"todo"===o&&i&&Array.isArray(i.properties?.className)&&i.properties.className.includes("checkbox-on"),collapsed:"toggle"===o&&i&&"details"===i.tagName&&void 0===i.properties.open},children:[]},"children");break}case"hr":t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:divider",props:{},children:[]},"children").closeNode();break;case"figure":{if(ej(e.node,".link-to-page")||ej(e.node,".callout")){t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:"text",text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(e.node,{pageMap:s})}},children:[]},"children").closeNode(),t.skipAllChildren();break}let o=ej(e.node,".bookmark");if(o){let e=o.properties?.href,i=eO(ej(o,".bookmark-title")),s=eO(ej(o,".bookmark-description")),r=ej(o,".bookmark-icon"),a="string"==typeof r?.properties?.src?r.properties.src:"";t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:bookmark",props:{type:"card",url:e??"",title:i,description:s,icon:a},children:[]},"children").closeNode(),t.skipAllChildren();break}if(!i)break;let r=ej(e.node,".image"),a="";if(r){let e=ej(r,"img");a="string"==typeof e?.properties.src?e.properties.src:""}if(a){let e="";if((0,ez.vC)(a)){let t=await (0,ez.aK)(a,void 0,this.configs.get("imageProxy"));if(!t)break;let s=t.clone(),o=(0,eT.u)(t.headers.get("Content-Disposition")??"")??(a.split("/").at(-1)??"image")+"."+(t.headers.get("Content-Type")?.split("/").at(-1)??"png"),r=new File([await t.blob()],o,{type:t.headers.get("Content-Type")??""});e=await (0,em.h)(await s.arrayBuffer()),i?.getAssets().set(e,r),await i?.writeToBlob(e)}else i.getAssets().forEach((t,s)=>{let o=(0,f.wm)(i.getAssets(),s);decodeURIComponent(a).includes(o)&&(e=s)});t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:image",props:{sourceId:e},children:[]},"children").closeNode(),t.skipAllChildren();break}let n=ej(e.node,".source"),l="";if(n){let e=ej(n,"a");l="string"==typeof e?.properties.href?e.properties.href:""}if(l){let e="",s="",o="",r=0;if((0,ez.vC)(l)){let t=await fetch(l).catch(e=>(console.warn("Error fetching embed:",e),null));if(!t)break;let a=t.clone();s=(0,eT.u)(t.headers.get("Content-Disposition")??"")??(l.split("/").at(-1)??"file")+"."+(t.headers.get("Content-Type")?.split("/").at(-1)??"blob");let n=new File([await t.blob()],s,{type:t.headers.get("Content-Type")??""});r=n.size,o=n.type,e=await (0,em.h)(await a.arrayBuffer()),i?.getAssets().set(e,n),await i?.writeToBlob(e)}else i.getAssets().forEach((t,a)=>{let n=(0,f.wm)(i.getAssets(),a);decodeURIComponent(l).includes(n)&&(e=a,s=n,r=t.size,o=t.type)});t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:attachment",props:{name:s,size:r,type:o,sourceId:e},children:[]},"children").closeNode(),t.skipAllChildren()}break}case"th":{let i=(0,f.Ak)(),s=ej(e.node,"svg")?.properties?.className,o=Array.isArray(s)?eW[s[0]]??"rich-text":"rich-text";t.pushGlobalContextStack("hast:table:column",{type:o,name:eO(eA(e.node)),data:Object.create(null),id:i}),t.setGlobalContext("hast:disableimg",!0);break}case"tr":if(e.parent?.node.type==="element"&&"tbody"===e.parent.node.tagName){let i=t.getGlobalContextStack("hast:table:column"),o=Object.create(null),r=!1;eP(e.node).forEach((e,a)=>{if(r||void 0===i[a])r=!0,void 0===i[a]&&(i.push({type:"rich-text",name:"",data:Object.create(null),id:(0,f.Ak)()}),t.pushGlobalContextStack("hast:table:children",{type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(e)},type:"text"},children:[]})),t.pushGlobalContextStack("hast:table:children",{type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(e)},type:"text"},children:[]}),o[i[a].id]={columnId:i[a].id,value:eO(e)};else if(ej(e,".cell-title")){t.pushGlobalContextStack("hast:table:children",{type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{text:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(e,{pageMap:s})},type:"text"},children:[]}),i[a].type="title";return}let n=[];if(ej(e,".selected-value"))"options"in i[a].data||(i[a].data.options=[]),["multi-select","select"].includes(i[a].type)||(i[a].type="select"),"select"===i[a].type&&"element"===e.type&&e.children.length>1&&(i[a].type="multi-select"),"element"===e.type&&e.children.forEach(e=>{let t=i[a].data.options?.filter(t=>t.value===eO(e)),s=t?.length?t[0].id:(0,f.Ak)();t?.length||i[a].data.options?.push({id:s,value:eO(e),color:eU.y()}),n.push(s)}),o[i[a].id]={columnId:i[a].id,value:n};else if(ej(e,".checkbox"))"checkbox"!==i[a].type&&(i[a].type="checkbox"),o[i[a].id]={columnId:i[a].id,value:!!ej(e,".checkbox-on")};else if("number"===i[a].type){let t=eO(e),s=Number(t);Number.isNaN(s)?(i[a].type="rich-text",o[i[a].id]={columnId:i[a].id,value:(0,ez.GZ)(t)}):o[i[a].id]={columnId:i[a].id,value:s}}else o[i[a].id]={columnId:i[a].id,value:eO(e)};"rich-text"!==i[a].type||(0,ez.KH)(o[i[a].id].value)||(o[i[a].id]={columnId:i[a].id,value:(0,ez.GZ)(o[i[a].id].value)})}),t.setGlobalContextStack("hast:table:column",i),t.pushGlobalContextStack("hast:table:rows",o)}}}),o.setLeave((e,t)=>{if("element"===e.node.type)switch(e.node.tagName){case"div":e.parent?.node.type==="element"&&"li"!==e.parent.node.tagName&&Array.isArray(e.node.properties?.className)&&e.node.properties.className.includes("indented")&&t.closeNode();break;case"blockquote":t.setGlobalContext("hast:blockquote",!1);break;case"p":if(!e.node.properties.id||e.next?.type==="element"&&"div"===e.next.tagName&&Array.isArray(e.next.properties?.className)&&e.next.properties.className.includes("indented"))break;t.closeNode();break;case"li":t.closeNode();break;case"table":{let e=t.getGlobalContextStack("hast:table:column");t.setGlobalContextStack("hast:table:column",[]);let i=t.getGlobalContextStack("hast:table:children");t.setGlobalContextStack("hast:table:children",[]);let s=Object.create(null);t.getGlobalContextStack("hast:table:rows").map((t,o)=>{Object.keys(t).forEach(i=>{e.find(e=>e.id===i)?.type==="select"&&(t[i].value=t[i].value[0])}),s[i.at(o)?.id??(0,f.Ak)()]=t}),t.setGlobalContextStack("hast:table:cells",[]),t.openNode({type:"block",id:(0,f.Ak)(),flavour:"affine:database",props:{views:[{id:(0,f.Ak)(),name:"Table View",mode:"table",columns:[],filter:{type:"group",op:"and",conditions:[]},header:{titleColumn:e.find(e=>"title"===e.type)?.id??"",iconColumn:"type"}}],title:{"$blocksuite:internal:text$":!0,delta:[]},columns:e,cells:s},children:[]},"children"),i.forEach(e=>{t.openNode(e,"children").closeNode()}),t.closeNode();break}case"th":t.setGlobalContext("hast:disableimg",!1)}}),o.walk(e,t)}}_htmlToAst(e){return(0,e_.l)().use(eb.A).parse(e)}fromBlockSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"NotionHtmlAdapter.fromBlockSnapshot is not implemented")}fromDocSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"NotionHtmlAdapter.fromDocSnapshot is not implemented")}fromSliceSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"NotionHtmlAdapter.fromSliceSnapshot is not implemented")}toBlockSnapshot(e){let t=this._htmlToAst(e.file),i={type:"block",id:(0,f.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:e$.ko.DocAndEdgeless},children:[]};return this._traverseNotionHtml(t,i,e.assets,e.pageMap)}async toDoc(e){let t=await this.toDocSnapshot(e);return this.job.snapshotToDoc(t)}async toDocSnapshot(e){let t=this._htmlToAst(e.file),i=ej(t,"title"),s={type:"block",id:(0,f.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:e$.ko.DocAndEdgeless},children:[]};return{type:"page",meta:{id:e.pageId??(0,f.Ak)(),title:eO(i,"Untitled"),createDate:Date.now(),tags:[]},blocks:{type:"block",id:(0,f.Ak)(),flavour:"affine:page",props:{title:{"$blocksuite:internal:text$":!0,delta:this._hastToDelta(i??{type:"text",value:"Untitled"})}},children:[{type:"block",id:(0,f.Ak)(),flavour:"affine:surface",props:{elements:{}},children:[]},await this._traverseNotionHtml(t,s,e.assets,e.pageMap)]}}}async toSliceSnapshot(e){let t=this._htmlToAst(e.file),i={type:"block",id:(0,f.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:e$.ko.DocAndEdgeless},children:[]},s=await this._traverseNotionHtml(t,i,e.assets);return 0===s.children.length?null:{type:"slice",content:[s],pageVersion:e.pageVersion,workspaceVersion:e.workspaceVersion,workspaceId:e.workspaceId,pageId:e.pageId}}}class eY extends f.Dy{async _traverseSnapshot(e){let t="",i=new f.PV;return i.setONodeTypeGuard(e=>f.T1.safeParse(e).success),i.setEnter(e=>{let i=e.node.props.text??{delta:[]};switch(e.node.flavour){case"affine:code":t+=i.delta.map(e=>e.insert).join("")+"\n";break;case"affine:paragraph":t+=i.delta.map(e=>e.insert).join("")+"\n";break;case"affine:list":t+=i.delta.map(e=>e.insert).join("")+"\n";break;case"affine:divider":t+="---\n"}}),await i.walkONode(e),{plaintext:t}}async fromBlockSnapshot({snapshot:e}){let{plaintext:t}=await this._traverseSnapshot(e);return{file:t,assetsIds:[]}}async fromDocSnapshot({snapshot:e,assets:t}){let i="";e.meta.title&&(i+=`${e.meta.title} `);let{file:s,assetsIds:o}=await this.fromBlockSnapshot({snapshot:e.blocks,assets:t});return{file:i+=s,assetsIds:o}}async fromSliceSnapshot({snapshot:e}){let t="";for(let i of e.content){let{plaintext:e}=await this._traverseSnapshot(i);t+=e}return{file:t.match(/\n/g)?.length===1?t.trimEnd():t,assetsIds:[]}}toBlockSnapshot(e){return e.file=e.file.replaceAll("\r",""),{type:"block",id:(0,f.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:e$.ko.DocAndEdgeless},children:e.file.split("\n").map(e=>({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:"text",text:{"$blocksuite:internal:text$":!0,delta:[{insert:e}]}},children:[]}))}}toDocSnapshot(e){return e.file=e.file.replaceAll("\r",""),{type:"page",meta:{id:(0,f.Ak)(),title:"Untitled",createDate:Date.now(),tags:[]},blocks:{type:"block",id:(0,f.Ak)(),flavour:"affine:page",props:{title:{"$blocksuite:internal:text$":!0,delta:[{insert:"Untitled"}]}},children:[{type:"block",id:(0,f.Ak)(),flavour:"affine:surface",props:{elements:{}},children:[]},{type:"block",id:(0,f.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:e$.ko.DocAndEdgeless},children:e.file.split("\n").map(e=>({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:"text",text:{"$blocksuite:internal:text$":!0,delta:[{insert:e}]}},children:[]}))}]}}}toSliceSnapshot(e){return 0===e.file.trim().length?null:(e.file=e.file.replaceAll("\r",""),{type:"slice",content:[{type:"block",id:(0,f.Ak)(),flavour:"affine:note",props:{xywh:"[0,0,800,95]",background:"--affine-background-secondary-color",index:"a0",hidden:!1,displayMode:e$.ko.DocAndEdgeless},children:e.file.split("\n").map(e=>({type:"block",id:(0,f.Ak)(),flavour:"affine:paragraph",props:{type:"text",text:{"$blocksuite:internal:text$":!0,delta:[{insert:e}]}},children:[]}))}],pageVersion:e.pageVersion,workspaceVersion:e.workspaceVersion,workspaceId:e.workspaceId,pageId:e.pageId})}}let eK=({slots:e,collection:t})=>{let i=new Map;e.afterImport.on(e=>{if("block"===e.type&&"affine:database"===e.snapshot.flavour){let t=e.model;Object.keys(t.cells).forEach(e=>{i.has(e)&&(t.cells[i.get(e)]=t.cells[e],delete t.cells[e])})}if("block"===e.type&&["affine:list","affine:paragraph"].includes(e.snapshot.flavour)){let t=e.model,s=0,o=[];for(let e of t.text.toDelta())if(e.attributes?.reference?.pageId){let t=i.get(e.attributes.reference.pageId);if(!t){s+=e.insert?.length??0;continue}s>0&&o.push({retain:s}),o.push({retain:e.insert?.length??0,attributes:{reference:{...e.attributes.reference,pageId:t}}}),s=0}else s+=e.insert?.length??0;o.length>0&&t.text.applyDelta(o)}if("block"===e.type&&"affine:surface-ref"===e.snapshot.flavour){let t=e.model,s=t.reference;i.has(s)&&(t.reference=i.get(s))}if("block"===e.type&&"affine:embed-linked-doc"===e.snapshot.flavour){let s=e.model,o=s.pageId;if(i.has(o))s.pageId=i.get(o);else{let e=t.idGenerator();i.set(o,e),s.pageId=e}}if("block"===e.type&&"affine:embed-synced-doc"===e.snapshot.flavour){let s=e.model,o=s.pageId;if(i.has(o))s.pageId=i.get(o);else{let e=t.idGenerator();i.set(o,e),s.pageId=e}}}),e.beforeImport.on(e=>{if("page"===e.type){if(i.has(e.snapshot.meta.id)){e.snapshot.meta.id=i.get(e.snapshot.meta.id);return}let s=t.idGenerator();i.set(e.snapshot.meta.id,s),e.snapshot.meta.id=s;return}if("block"===e.type){let s;let{snapshot:o}=e;if("affine:page"===o.flavour){let e=o.children.findIndex(e=>"affine:surface"===e.flavour);if(-1!==e){let[t]=o.children.splice(e,1);o.children.push(t)}}let r=o.id;i.has(r)?s=i.get(r):(s=t.idGenerator(),i.set(r,s)),o.id=s,"affine:surface"===o.flavour&&(o.children.forEach(e=>{let o=e.id;i.has(o)?s=i.get(o):(s=t.idGenerator(),i.set(o,s))}),Object.entries(o.props.elements).forEach(([e,t])=>{switch(t.type){case"connector":{let e=t.source;if(i.has(e.id)){let t=i.get(e.id);(0,H.Z1)(t,"reference id must exist"),e.id=t}if(e=t.target,i.has(e.id)){let t=i.get(e.id);(0,H.Z1)(t,"reference id must exist"),e.id=t}break}case"group":{let e=t.children.json;Object.entries(e).forEach(([t,s])=>{if(i.has(t)){delete e[t];let o=i.get(t);(0,H.Z1)(o,"reference id must exist"),e[o]=s}})}}}))}})},eX=e=>({adapterConfigs:t})=>{t.set("imageProxy",e)},eQ=({slots:e,collection:t,adapterConfigs:i})=>{e.beforeExport.on(()=>{for(let e of t.meta.docMetas)i.set("title:"+e.id,e.title)})},eJ=(()=>{let e=eX(eh.$R);return{get:()=>e,set:t=>{e=eX(t)}}})(),e1=eJ.set,e0=eJ.get(),e2=e=>({adapterConfigs:t})=>{t.set("embedSyncedDocExportType",e)};var e5=i(97878);let e7="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e3="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e{let t=new Uint8Array(e),i=t.length,s,o="";for(s=0;s>2]+e7[(3&t[s])<<4|t[s+1]>>4]+e7[(15&t[s+1])<<2|t[s+2]>>6]+e7[63&t[s+2]];return i%3==2?o=o.substring(0,o.length-1)+"=":i%3==1&&(o=o.substring(0,o.length-2)+"=="),o},e6=e=>{let t=e.length,i=.75*e.length,s,o=0,r,a,n,l;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);let c=new ArrayBuffer(i),d=new Uint8Array(c);for(s=0;s>4,d[o++]=(15&a)<<4|n>>2,d[o++]=(3&n)<<6|63&l;return c};async function e8(e){let t={},i=0;return await Promise.all(Array.from(e.entries()).map(async([e,s])=>{if(s.size>4194304){let e=document.querySelector("editor-host");if(!e)return;(0,e5.o)(e,s.name??"File is too large to be copied");return}if((i+=s.size)>6291456){let e=document.querySelector("editor-host");if(!e)return;(0,e5.o)(e,s.name??"File cannot be copied due to the clipboard size limit");return}let o=e4(await s.arrayBuffer()),r={name:s.name,type:s.type,content:o};t[e]=r})),t}function e9(e,t){Object.entries(e).forEach(([e,i])=>{let s=new File([new Blob([e6(i.content)])],i.name,{type:i.type});(0,H.Z1)(t),t.set(e,s)})}class te extends f.Dy{static{this.MIME="BLOCKSUITE/SNAPSHOT"}fromBlockSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"ClipboardAdapter.fromBlockSnapshot is not implemented")}fromDocSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"ClipboardAdapter.fromDocSnapshot is not implemented")}async fromSliceSnapshot(e){let t=e.snapshot,i=e.assets;(0,H.Z1)(i);let s=i.getAssets();return{file:JSON.stringify({snapshot:t,blobs:await e8(s)}),assetsIds:[]}}toBlockSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"ClipboardAdapter.toBlockSnapshot is not implemented")}toDocSnapshot(e){throw new c.Ss(d.O.TransformerNotImplementedError,"ClipboardAdapter.toDocSnapshot is not implemented")}toSliceSnapshot(e){let{blobs:t,snapshot:i}=JSON.parse(e.file);return e9(t,e.assets?.getAssets()),Promise.resolve(i)}}let tt=(e,t,i)=>{let{index:s,length:o}=e;if((0,O.op)(i,["affine:page"])){if(0===o)return;t.props.title.delta=i.title.sliceToDelta(s,o+s);return}t.props.text&&0!==o&&(t.props.text.delta=i.text?.sliceToDelta(s,o+s))},ti=(e,t)=>{e.afterExport.on(e=>{if("block"===e.type){let i=e.snapshot,s=e.model,o=t.selection.find("text");if(o&&o.from.blockId===s.id){tt(o.from,i,s);return}if(o&&o.to&&o.to.blockId===s.id){tt(o.to,i,s);return}}})},ts=e=>({slots:t})=>{ti(t,e)},to=e=>(function(e,t){let i=null;return e.forEach(function e(s){if(t(s)&&(i=s),s.children)for(let t of s.children)e(t)}),i})(e.content,e=>!!e.props.text);class tr{constructor(e,t){this.std=e,this.point=t,this._blockFromPath=e=>{let t=this.std.view.getBlock(e);return(0,H.Z1)(t),t},this.block=this._blockFromPath(t.blockId),this.model=this.block.model;let i=this.model.text;(0,H.Z1)(i),this.text=i}}class ta{constructor(e,t,i){this.std=e,this.text=t,this.snapshot=i,this._getDeltas=()=>{let e=this._textFromSnapshot(this.firstSnapshot),t=this._textFromSnapshot(this.lastSnapshot),i=this.fromPointState.text.sliceToDelta(0,this.fromPointState.point.index),s=this.endPointState.text.sliceToDelta(this.endPointState.point.index+this.endPointState.point.length,this.endPointState.text.length),o=e.delta,r=t.delta;return{firstTextSnapshot:e,lastTextSnapshot:t,fromDelta:i,toDelta:s,firstDelta:o,lastDelta:r}},this._mergeCode=()=>{let{toDelta:e}=this._getDeltas(),t=[{retain:this.fromPointState.point.index},this.fromPointState.text.length-this.fromPointState.point.index?{delete:this.fromPointState.text.length-this.fromPointState.point.index}:{}],i=0;for(let e of this.snapshot.content)if(e.props.text){let s=this._textFromSnapshot(e);i>0&&t.push({insert:"\n"}),t.push(...s.delta),i++}else break;this.fromPointState.text.applyDelta(t.concat(e)),this.snapshot.content=[]},this._mergeMultiple=()=>{this.firstSnapshot.flavour=this.fromPointState.model.flavour,this.firstSnapshot.props.type&&(this.fromPointState.text.length>0||this.firstSnapshotIsPlainText)&&(this.firstSnapshot.props.type=this.fromPointState.model.type),this.lastSnapshot.props.type&&this.to&&(this.lastSnapshot.flavour=this.endPointState.model.flavour,this.lastSnapshot.props.type=this.endPointState.model.type);let{lastTextSnapshot:e,toDelta:t,firstDelta:i,lastDelta:s}=this._getDeltas();this.fromPointState.text.applyDelta([{retain:this.fromPointState.point.index},this.fromPointState.text.length-this.fromPointState.point.index?{delete:this.fromPointState.text.length-this.fromPointState.point.index}:{},...i]);let o=this.snapshot.content.shift();o?.children.map(e=>{this.snapshot.content.unshift(e)}),this.pasteStartModelChildrenCount=o?.children.length??0,this._updateSnapshot(),e.delta=[...s,...t]},this._mergeSingle=()=>{let{firstDelta:e}=this._getDeltas();this.fromPointState.text.applyDelta([{retain:this.fromPointState.point.index},this.fromPointState.point.length?{delete:this.fromPointState.point.length}:{},...e]),this.snapshot.content.splice(0,1),this._updateSnapshot()},this._textFromSnapshot=e=>e.props.text??{delta:[]},this._updateSnapshot=()=>{if(0===this.snapshot.content.length){this.firstSnapshot=this.lastSnapshot=void 0;return}this.firstSnapshot=this.snapshot.content[0],this.lastSnapshot=to(this.snapshot)??this.firstSnapshot},this.pasteStartModel=null,this.pasteStartModelChildrenCount=0,this.canMerge=()=>{if(0===this.snapshot.content.length||!this.firstSnapshot.props.text)return!1;let e=this._textFromSnapshot(this.firstSnapshot),t=this._textFromSnapshot(this.lastSnapshot);return e&&t&&(this.fromPointState.text.length>0&&this.endPointState.text.length>0||this.firstSnapshotIsPlainText)},this.convertToLinkedDoc=async()=>{let e=this.std.spec.getService("affine:page").quickSearchService;if(!e)return;let t=new Map;for(let i of this.snapshot.content)if(i.props.text){let[s,o]=await this._transformLinkDelta(this._textFromSnapshot(i).delta,t,e),r=this.std.doc.getBlockById(i.id);o&&r&&(this.std.doc.captureSync(),this.std.doc.transact(()=>{let e=r.text;e.clear(),e.applyDelta(s)}))}let i=this.fromPointState.model.text;if(!i)return;let[s,o]=await this._transformLinkDelta(i.toDelta(),t,e);o&&(this.std.doc.captureSync(),this.std.doc.transact(()=>{i.clear(),i.applyDelta(s)}))},this.focusPasted=()=>{let e=this.std.host,t="affine:code"!==this.fromPointState.model.flavour&&this.lastSnapshot?this.std.doc.getBlock(this.lastSnapshot.id):this.std.doc.getBlock(this.fromPointState.model.id);(0,H.Z1)(t);let{model:i}=t;e.updateComplete.then(()=>{let t=this.std.host.querySelector(`[${e.blockIdAttr}="${i.id}"]`);if(!t)return;if(!i.text){if((0,O.op)(i,["affine:image"])){let e=this.std.selection.create("image",{blockId:t.blockId});this.std.selection.setGroup("note",[e]);return}let e=this.std.selection.create("block",{blockId:t.blockId});this.std.selection.setGroup("note",[e]);return}let s=this.std.selection.create("text",{from:{blockId:t.blockId,index:i.text?this.lastIndex:0,length:0},to:null});this.std.selection.setGroup("note",[s])}).catch(console.error)},this.pasted=()=>{if(this.canMerge()||0===this.endPointState.text.length){if(this.to){for(let e of this.std.command.exec("getSelectedModels",{types:["text"]}).selectedModels??[])[this.endPointState.model.id,this.fromPointState.model.id].includes(e.id)||this.snapshot.content.map(e=>e.id).includes(e.id)||this.std.doc.deleteBlock(e);this.std.doc.deleteBlock(this.endPointState.model,this.pasteStartModel?{bringChildrenTo:this.pasteStartModel}:void 0)}if(this.lastSnapshot){let e=this.std.doc.getBlock(this.lastSnapshot.id);(0,H.Z1)(e);let{model:t}=e;this.std.doc.moveBlocks(this.fromPointState.model.children,t)}this.std.doc.moveBlocks(this.std.doc.getNexts(this.fromPointState.model.id).slice(0,this.pasteStartModelChildrenCount),this.fromPointState.model),this.firstSnapshotIsPlainText||0!=this.fromPointState.text.length||this.std.doc.deleteBlock(this.fromPointState.model)}};let{from:s,to:o}=t,r=o??s;if(this.to=o,this.fromPointState=new tr(e,s),this.endPointState=new tr(e,r),this.firstSnapshot=i.content[0],this.lastSnapshot=to(i)??this.firstSnapshot,this.firstSnapshot!==this.lastSnapshot&&this.lastSnapshot.props.text){let e=(0,f.rS)(this.lastSnapshot.props.text);new f.rl.Y.Doc().getMap("temp").set("text",e.yText),this.lastIndex=e.length}else this.lastIndex=this.fromPointState.point.index+this.snapshot.content.map(e=>this._textFromSnapshot(e).delta.map(e=>e.insert?e.insert.length:e.delete?-e.delete:0).reduce((e,t)=>e+t,0)).reduce((e,t)=>e+t+1,-1);this.firstSnapshotIsPlainText="affine:paragraph"===this.firstSnapshot.flavour&&"text"===this.firstSnapshot.props.type}async _transformLinkDelta(e,t,i){let s=!1,o=new Map;for(let s of e)if(s.attributes?.link){let e=t.get(s.attributes.link);if(void 0===e){let o=await i.searchDoc({userInput:s.attributes.link,skipSelection:!0,action:"insert"});if(o&&"docId"in o){let i=this.std.collection.getDoc(o.docId);i&&(e=i.id,t.set(s.attributes.link,i.id))}}e&&o.set(s,e)}return[e.map(e=>o.has(e)?(this.std.spec.getService("affine:page").telemetryService?.track("LinkedDocCreated",{page:"doc editor",category:"pasted link",type:"doc",other:"existing doc"}),s=!0,{...e,attributes:{reference:{pageId:o.get(e),type:"LinkedPage"}},insert:" "}):{...e}),s]}merge(){if("affine:code"===this.fromPointState.model.flavour&&!this.to){this._mergeCode();return}if(this.firstSnapshot===this.lastSnapshot){this._mergeSingle();return}this._mergeMultiple()}}let tn=e=>({slots:t})=>{let i;t.beforeImport.on(t=>{if("slice"===t.type){let{snapshot:s}=t;!function(e){e.content[0]?.flavour==="affine:note"&&(e.content=e.content[0].children)}(s);let o=e.selection.find("text");o&&(i=new ta(e,o,t.snapshot)).canMerge()&&i.merge()}}),t.afterImport.on(t=>{if(i&&"slice"===t.type){for(let t of e.command.exec("getSelectedModels",{types:["block"]}).selectedModels??[])e.doc.deleteBlock(t);i.pasted(),i.focusPasted(),i.convertToLinkedDoc().catch(console.error)}})};class tl{constructor(e){this._copySelected=e=>this._std.command.chain().with({onCopy:e}).getSelectedModels().draftSelectedModels().copySelectedModels(),this._disposables=new eg.K,this._init=()=>{this._std.clipboard.registerAdapter(te.MIME,te,100),this._std.clipboard.registerAdapter("text/html",eR,90),["image/apng","image/avif","image/gif","image/jpeg","image/png","image/svg+xml","image/webp"].map(e=>this._std.clipboard.registerAdapter(e,eF,80)),this._std.clipboard.registerAdapter("text/plain",eq,70),this._std.clipboard.registerAdapter("*/*",ev,60);let e=ts(this._std),t=tn(this._std);this._std.clipboard.use(e),this._std.clipboard.use(t),this._std.clipboard.use(eK),this._std.clipboard.use(eQ),this._std.clipboard.use(e0),this._disposables.add({dispose:()=>{this._std.clipboard.unregisterAdapter(te.MIME),this._std.clipboard.unregisterAdapter("text/plain"),["image/apng","image/avif","image/gif","image/jpeg","image/png","image/svg+xml","image/webp"].map(e=>this._std.clipboard.unregisterAdapter(e)),this._std.clipboard.unregisterAdapter("text/html"),this._std.clipboard.unregisterAdapter("*/*"),this._std.clipboard.unuse(e),this._std.clipboard.unuse(t),this._std.clipboard.unuse(eK),this._std.clipboard.unuse(eQ),this._std.clipboard.unuse(e0)}})},this.onBlockSnapshotPaste=async(e,t,i,s)=>{let o=await this._std.clipboard.pasteBlockSnapshot(e,t,i,s);return o?.id??null},this.onPageCopy=e=>{e.get("clipboardState").raw.preventDefault(),this._copySelected().run()},this.onPageCut=e=>{e.get("clipboardState").raw.preventDefault(),this._copySelected(()=>{this._std.command.chain().try(e=>[e.getTextSelection().deleteText(),e.getSelectedModels().deleteSelectedModels()]).run()}).run()},this.onPagePaste=e=>{let t=e.get("clipboardState").raw;t.preventDefault(),this._std.doc.captureSync(),this._std.command.chain().try(e=>[e.getTextSelection().inline((e,t)=>{let i=e.currentTextSelection;i&&t({currentSelectionPath:(i.to??i.from).blockId})}),e.getBlockSelections().inline((e,t)=>{let i=e.currentBlockSelections;if(!i)return;let s=i.at(-1);s&&t({currentSelectionPath:s.blockId})}),e.getImageSelections().inline((e,t)=>{let i=e.currentImageSelections;if(!i)return;let s=i.at(-1);s&&t({currentSelectionPath:s.blockId})})]).getBlockIndex().inline((e,i)=>((0,H.Z1)(e.parentBlock),this._std.clipboard.paste(t,this._std.doc,e.parentBlock.model.id,e.blockIndex?e.blockIndex+1:1).catch(console.error),i())).run()},this.host=e}get _std(){return this.host.std}hostConnected(){this._disposables.disposed&&(this._disposables=new eg.K),this.host.handleEvent("copy",this.onPageCopy),this.host.handleEvent("paste",this.onPagePaste),this.host.handleEvent("cut",this.onPageCut),this._init()}hostDisconnected(){this._disposables.dispose()}}var tc=i(96448),td=i(64816),th=i(3874),tu=i(19860),tp=i(23156),tf=i(92820);function tg(e,t,i,o){let r=e=>t=>{if(t.stopPropagation(),1===t.buttons||!i)return;let{clientX:s,clientY:o}=t;i(!0,{type:e,point:[s,o],target:t.target})},a=e=>{e.stopPropagation(),1!==e.buttons&&i&&i(!1)},n=e===s.Top||e===s.Bottom||e===s.Left||e===s.Right?L.s6:(0,L.qy)`
`;return(0,L.qy)`
{i.stopPropagation(),t&&t(i,e)}} > ${n}
`}!function(e){e.Bottom="bottom",e.BottomLeft="bottom-left",e.BottomRight="bottom-right",e.Left="left",e.Right="right",e.Top="top",e.TopLeft="top-left",e.TopRight="top-right"}(s||(s={}));var tm=i(31716),tv=i(82750),ty=i(31999),tb=i(68192),tw=i(992),tx=i(84549);function t_(e,t){let i=e.getParentNode(t.id);if(!i)return;let s=`#${i.id}-${t.id}`,o=e.connectors.get(s);if(o)return o.opacity=0,()=>{o.opacity=1}}var tC=i(18513),tk=i(11559);function tS(e){return 0===e.length?new p.z:e.reduce((e,t)=>t instanceof ty.$b?e:e.unite(t.elementBound),e[0].elementBound)}var tM=i(17742),tE=i(35739),tI=i(16019),tB=i(9441),t$=i(22805),tT=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tO=function(e,t,i){for(var s=arguments.length>2,o=0;o"dark"===j.Q.mode?tH[10]:tH[8],tD=()=>tH[5],tZ=tH[5],tj=tH[9];function tV(e){return e.toLowerCase().endsWith("transparent")}function tz(e){return["--affine-note-background-black","--affine-note-background-white","--affine-palette-line-black","--affine-palette-line-white","--affine-palette-shape-black","--affine-palette-shape-white"].includes(e.toLowerCase())}function tR(e,t){return tV(e)?function(e=!1){let t=e?(0,L.qy)`
`:L.s6;return(0,L.qy)`
${G.KaZ} ${t}
`}(t):t?function(e){let t=e.startsWith("--"),i=t&&tz(e)?1:0,s={fill:t?`var(${e})`:e,stroke:"var(--affine-border-color)"};return(0,L.qy)` `}(e):L.s6}function tF(e,{hollowCircle:t,letter:i}={}){let s=tR(e,!!t),o=t||tV(e)?{}:{background:`var(${e})`},r={width:"16px",height:"16px",borderRadius:"50%",boxSizing:"border-box",overflow:"hidden",...tz(e)&&!t?{border:"0.5px solid var(--affine-border-color)"}:{},...o};return(0,L.qy)`
${s}
`}(()=>{let e,t,i,s,o,r=[(0,D.EM)("edgeless-color-button")],a=[],n=L.WF,l=[],c=[],d=[],h=[],u=[],p=[];(class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],tT(this,null,i,{kind:"accessor",name:"color",static:!1,private:!1,access:{has:e=>"color"in e,get:e=>e.color,set:(e,t)=>{e.color=t}},metadata:f},l,c),tT(this,null,s,{kind:"accessor",name:"hollowCircle",static:!1,private:!1,access:{has:e=>"hollowCircle"in e,get:e=>e.hollowCircle,set:(e,t)=>{e.hollowCircle=t}},metadata:f},d,h),tT(this,null,o,{kind:"accessor",name:"letter",static:!1,private:!1,access:{has:e=>"letter"in e,get:e=>e.letter,set:(e,t)=>{e.letter=t}},metadata:f},u,p),tT(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` :host { display: flex; justify-content: center; align-items: center; width: 20px; height: 20px; } .color-unit { width: 16px; height: 16px; border-radius: 50%; box-sizing: border-box; overflow: hidden; } `}render(){let{color:e,hollowCircle:t,letter:i}=this,s=tR(e,!!t),o={};return!t&&(o.background=this.preprocessColor,tz(e)&&(o.border="0.5px solid var(--affine-border-color)")),(0,L.qy)`
${s}
`}get preprocessColor(){let e=this.color;return e.startsWith("--")?`var(${e})`:e}#ig=tO(this,l,void 0);get color(){return this.#ig}set color(e){this.#ig=e}#im=(tO(this,c),tO(this,d,void 0));get hollowCircle(){return this.#im}set hollowCircle(e){this.#im=e}#iv=(tO(this,h),tO(this,u,void 0));get letter(){return this.#iv}set letter(e){this.#iv=e}constructor(){super(...arguments),tO(this,p)}static{tO(t,a)}})})();let tN=(0,L.AH)` .color-container { position: relative; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; box-sizing: border-box; overflow: hidden; cursor: pointer; padding: 2px; } .color-unit::before { content: attr(data-letter); display: block; font-size: 12px; } .color-container[active]:after { position: absolute; width: 20px; height: 20px; border: 0.5px solid var(--affine-primary-color); border-radius: 50%; box-sizing: border-box; content: attr(data-letter); } `,tq=(()=>{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("edgeless-color-panel")],c=[],d=L.WF,h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];return class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)()],r=[(0,D.MZ)({type:Array})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],tT(this,null,i,{kind:"accessor",name:"hasTransparent",static:!1,private:!1,access:{has:e=>"hasTransparent"in e,get:e=>e.hasTransparent,set:(e,t)=>{e.hasTransparent=t}},metadata:C},h,u),tT(this,null,s,{kind:"accessor",name:"hollowCircle",static:!1,private:!1,access:{has:e=>"hollowCircle"in e,get:e=>e.hollowCircle,set:(e,t)=>{e.hollowCircle=t}},metadata:C},p,f),tT(this,null,o,{kind:"accessor",name:"openColorPicker",static:!1,private:!1,access:{has:e=>"openColorPicker"in e,get:e=>e.openColorPicker,set:(e,t)=>{e.openColorPicker=t}},metadata:C},g,m),tT(this,null,r,{kind:"accessor",name:"options",static:!1,private:!1,access:{has:e=>"options"in e,get:e=>e.options,set:(e,t)=>{e.options=t}},metadata:C},v,y),tT(this,null,a,{kind:"accessor",name:"showLetterMark",static:!1,private:!1,access:{has:e=>"showLetterMark"in e,get:e=>e.showLetterMark,set:(e,t)=>{e.showLetterMark=t}},metadata:C},b,w),tT(this,null,n,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:C},x,_),tT(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}static{this.styles=(0,L.AH)` :host { display: flex; flex-direction: row; flex-wrap: wrap; width: 184px; gap: 8px; } ${tN} `}onSelect(e){this.dispatchEvent(new tP("select",{detail:e,composed:!0,bubbles:!0})),this.value=e}render(){return(0,L.qy)` ${(0,t$.u)(this.palettes,e=>e,e=>{let t=tF(e,{hollowCircle:this.hollowCircle,letter:this.showLetterMark});return(0,L.qy)`
this.onSelect(e)} > ${t}
`})} `}get palettes(){return this.hasTransparent?["--affine-palette-transparent",...this.options]:this.options}#iy=tO(this,h,!0);get hasTransparent(){return this.#iy}set hasTransparent(e){this.#iy=e}#im=(tO(this,u),tO(this,p,!1));get hollowCircle(){return this.#im}set hollowCircle(e){this.#im=e}#ib=(tO(this,f),tO(this,g,void 0));get openColorPicker(){return this.#ib}set openColorPicker(e){this.#ib=e}#z=(tO(this,m),tO(this,v,tH));get options(){return this.#z}set options(e){this.#z=e}#iw=(tO(this,y),tO(this,b,!1));get showLetterMark(){return this.#iw}set showLetterMark(e){this.#iw=e}#eJ=(tO(this,w),tO(this,x,null));get value(){return this.#eJ}set value(e){this.#eJ=e}constructor(){super(...arguments),tO(this,_)}static{tO(t,c)}},t})();(()=>{let e,t,i=[(0,D.EM)("edgeless-text-color-icon")],s=[],o=L.WF,r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;tT(this,null,[(0,D.MZ)({attribute:!1})],{kind:"accessor",name:"color",static:!1,private:!1,access:{has:e=>"color"in e,get:e=>e.color,set:(e,t)=>{e.color=t}},metadata:n},r,a),tT(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` :host { display: flex; justify-content: center; align-items: center; width: 20px; height: 20px; } `}render(){return(0,L.qy)` `}get preprocessColor(){let e=this.color;return e.startsWith("--")?`var(${e})`:e}#ig=tO(this,r,void 0);get color(){return this.#ig}set color(e){this.#ig=e}constructor(){super(...arguments),tO(this,a)}static{tO(t,s)}})})(),i(36970);var tU=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tW=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("edgeless-connector-label-editor")],a=[],n=(0,P.Tm)(P.ao),l=[],c=[],d=[],h=[],u=[],m=[];return class extends n{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.P)("rich-text")],tU(this,null,i,{kind:"accessor",name:"connector",static:!1,private:!1,access:{has:e=>"connector"in e,get:e=>e.connector,set:(e,t)=>{e.connector=t}},metadata:p},l,c),tU(this,null,s,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:p},d,h),tU(this,null,o,{kind:"accessor",name:"richText",static:!1,private:!1,access:{has:e=>"richText"in e,get:e=>e.richText,set:(e,t)=>{e.richText=t}},metadata:p},u,m),tU(null,e={value:t},r,{kind:"class",name:t.name,metadata:p},null,a),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=(0,L.AH)` .edgeless-connector-label-editor { position: absolute; left: 0; top: 0; transform-origin: center; z-index: 10; padding: ${2}px ${2}px; border: ${1}px solid var(--affine-primary-color, #1e96eb); background: var(--affine-background-primary-color, #fff); border-radius: 2px; box-shadow: 0px 0px 0px 2px rgba(30, 150, 235, 0.3); box-sizing: border-box; overflow: visible; .inline-editor { white-space: pre-wrap !important; outline: none; } .inline-editor span { word-break: normal !important; overflow-wrap: anywhere !important; } .edgeless-connector-label-editor-placeholder { pointer-events: none; color: var(--affine-text-disable-color); white-space: nowrap; } } `}connectedCallback(){super.connectedCallback(),this.setAttribute(P.vz.rangeSyncExcludeAttr,"true")}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver?.disconnect(),this._resizeObserver=null}firstUpdated(){let{edgeless:e,connector:t}=this,{dispatcher:i}=e;(0,H.Z1)(i),this._resizeObserver=new ResizeObserver(()=>{this._updateLabelRect(),this.requestUpdate()}),this._resizeObserver.observe(this.richText),this.updateComplete.then(()=>{this.inlineEditor.selectAll(),this.inlineEditor.slots.renderComplete.on(()=>{this.requestUpdate()}),this.disposables.add(i.add("keyDown",i=>{let{key:s,ctrlKey:o,metaKey:r,altKey:a,shiftKey:n,isComposing:l}=i.get("keyboardState").raw;return!l&&((!!o||!!r)&&!a&&!n&&"Enter"===s||"Escape"===s)&&(this.inlineEditorContainer.blur(),e.service.selection.set({elements:[t.id],editing:!1}),!0)})),this.disposables.add(e.service.surface.elementUpdated.on(({id:e})=>{e===t.id&&this.requestUpdate()})),this.disposables.add(e.service.viewport.viewportUpdated.on(()=>{this.requestUpdate()})),this.disposables.add(i.add("click",()=>!0)),this.disposables.add(i.add("doubleClick",()=>!0)),this.disposables.add(()=>{if(t.text){let i=t.text.toString(),s=i.trim(),o=s.length;0===o?e.service.updateElement(t.id,{text:void 0,labelXYWH:void 0,labelStyle:void 0,labelOffset:void 0}):o{this._keeping||this.remove()}),this.disposables.addFromEvent(this.inlineEditorContainer,"compositionstart",()=>{this._isComposition=!0,this.requestUpdate()}),this.disposables.addFromEvent(this.inlineEditorContainer,"compositionend",()=>{this._isComposition=!1,this.requestUpdate()}),t.lableEditing=!0}).catch(console.error)}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.richText?.updateComplete,e}render(){let{connector:e}=this,{labelOffset:{distance:t},labelStyle:{fontFamily:i,fontSize:s,fontStyle:o,fontWeight:r,textAlign:a,color:n},labelConstraints:{hasMaxWidth:l,maxWidth:c}}=e,d=(0,g.ks)(i,s,r),{translateX:h,translateY:u,zoom:p}=this.edgeless.service.viewport,[f,m]=tm.l.mul(e.getPointByOffsetDistance(t),p),v=["translate(-50%, -50%)",`translate(${h}px, ${u}px)`,`translate(${f}px, ${m}px)`,`scale(${p})`],y=!e.text.length&&!this._isComposition,b=j.Q.generateColorProperty(n,"#000000");return(0,L.qy)`
${y?(0,L.qy)` Add text `:L.s6}
`}setKeeping(e){this._keeping=e}get inlineEditor(){return(0,H.Z1)(this.richText.inlineEditor),this.richText.inlineEditor}get inlineEditorContainer(){return this.inlineEditor.rootElement}#ix;get connector(){return this.#ix}set connector(e){this.#ix=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#eH;get richText(){return this.#eH}set richText(e){this.#eH=e}constructor(){super(...arguments),this._isComposition=!1,this._keeping=!1,this._resizeObserver=null,this._updateLabelRect=()=>{let{connector:e,edgeless:t}=this;if(!e||!t)return;let i=this.inlineEditorContainer.scrollWidth,s=this.inlineEditorContainer.scrollHeight,o=e.getPointByOffsetDistance(e.labelOffset.distance),r=p.z.fromCenter(o,i,s).toXYWH();(!e.labelXYWH||r.some((t,i)=>!(0,tv.f3)(t,e.labelXYWH[i])))&&t.service.updateElement(e.id,{labelXYWH:r})},this.#ix=tW(this,l,void 0),this.#i_=(tW(this,c),tW(this,d,void 0)),this.#eH=(tW(this,h),tW(this,u,void 0)),tW(this,m)}static{tW(t,a)}},t})();var tY=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tK=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("edgeless-frame-title-editor")],a=[],n=(0,P.Tm)(P.ao),l=[],c=[],d=[],h=[],u=[],f=[];return class extends n{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.P)("rich-text")],tY(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:p},l,c),tY(this,null,s,{kind:"accessor",name:"frameModel",static:!1,private:!1,access:{has:e=>"frameModel"in e,get:e=>e.frameModel,set:(e,t)=>{e.frameModel=t}},metadata:p},d,h),tY(this,null,o,{kind:"accessor",name:"richText",static:!1,private:!1,access:{has:e=>"richText"in e,get:e=>e.richText,set:(e,t)=>{e.richText=t}},metadata:p},u,f),tY(null,e={value:t},r,{kind:"class",name:t.name,metadata:p},null,a),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p}),tK(t,a)}_unmount(){this.disposables.dispose(),this.edgeless.service.selection.set({elements:[],editing:!1}),this.remove()}connectedCallback(){super.connectedCallback(),this.setAttribute(P.vz.rangeSyncExcludeAttr,"true")}firstUpdated(){let e=this.edgeless.dispatcher;(0,H.Z1)(e),this.updateComplete.then(()=>{this.inlineEditor.selectAll(),this.inlineEditor.slots.renderComplete.on(()=>{this.requestUpdate()}),this.disposables.add(e.add("keyDown",e=>{let t=e.get("keyboardState");return"Enter"!==t.raw.key||t.raw.isComposing?(requestAnimationFrame(()=>{this.requestUpdate()}),!1):(this._unmount(),!0)})),this.disposables.add(this.edgeless.service.viewport.viewportUpdated.on(()=>{this.requestUpdate()})),this.disposables.add(e.add("click",()=>!0)),this.disposables.add(e.add("doubleClick",()=>!0)),this.disposables.addFromEvent(this.inlineEditorContainer,"blur",()=>{this._unmount()})}).catch(console.error)}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.richText?.updateComplete,e}render(){let e=this.edgeless.service.viewport,t=p.z.deserialize(this.frameModel.xywh),[i,s]=e.toViewCoord(t.x,t.y),o=this.edgeless.service.layer.framesGrid.has(this.frameModel.elementBound,!0,!0,new Set([this.frameModel])),r=(0,Z.W)({transformOrigin:"top left",borderRadius:"4px",width:"fit-content",maxHeight:"30px",lineHeight:"20px",padding:"4px 10px",fontSize:"14px",position:"absolute",left:(o?i+8:i)+"px",top:(o?s+8:s-38)+"px",minWidth:"8px",fontFamily:"var(--affine-font-family)",background:o?"var(--affine-white)":"var(--affine-text-primary-color)",color:o?"var(--affine-text-secondary-color)":"var(--affine-white)",outline:"none",zIndex:"1",border:`1px solid var(--affine-primary-color)`,boxShadow:"0px 0px 0px 2px rgba(30, 150, 235, 0.3)"});return(0,L.qy)``}get editorHost(){return this.edgeless.host}get frameBlock(){(0,H.Z1)(this.frameModel.page.root);let e=this.editorHost.view.viewFromPath("block",[this.frameModel.page.root.id,this.frameModel.id]);return(0,H.Z1)(e),e}get inlineEditor(){return(0,H.Z1)(this.richText.inlineEditor),this.richText.inlineEditor}get inlineEditorContainer(){return this.inlineEditor.rootElement}#i_=tK(this,l,void 0);get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#iC=(tK(this,c),tK(this,d,void 0));get frameModel(){return this.#iC}set frameModel(e){this.#iC=e}#eH=(tK(this,h),tK(this,u,void 0));get richText(){return this.#eH}set richText(e){this.#eH=e}constructor(){super(...arguments),tK(this,f)}},t})();var tQ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tJ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("edgeless-group-title-editor")],a=[],n=(0,P.Tm)(P.ao),l=[],c=[],d=[],h=[],u=[],f=[];return class extends n{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.P)("rich-text")],tQ(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:p},l,c),tQ(this,null,s,{kind:"accessor",name:"group",static:!1,private:!1,access:{has:e=>"group"in e,get:e=>e.group,set:(e,t)=>{e.group=t}},metadata:p},d,h),tQ(this,null,o,{kind:"accessor",name:"richText",static:!1,private:!1,access:{has:e=>"richText"in e,get:e=>e.richText,set:(e,t)=>{e.richText=t}},metadata:p},u,f),tQ(null,e={value:t},r,{kind:"class",name:t.name,metadata:p},null,a),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p}),tJ(t,a)}_unmount(){this.disposables.dispose(),this.group.showTitle=!0,this.edgeless.service.selection.set({elements:[this.group.id],editing:!1}),this.remove()}connectedCallback(){super.connectedCallback(),this.setAttribute(P.vz.rangeSyncExcludeAttr,"true")}firstUpdated(){let e=this.edgeless.dispatcher;(0,H.Z1)(e),this.updateComplete.then(()=>{this.inlineEditor.selectAll(),this.group.showTitle=!1,this.inlineEditor.slots.renderComplete.on(()=>{this.requestUpdate()}),this.disposables.add(e.add("keyDown",e=>{let t=e.get("keyboardState");return"Enter"!==t.raw.key||t.raw.isComposing?(requestAnimationFrame(()=>{this.requestUpdate()}),!1):(this._unmount(),!0)})),this.disposables.add(this.edgeless.service.viewport.viewportUpdated.on(()=>{this.requestUpdate()})),this.disposables.add(e.add("click",()=>!0)),this.disposables.add(e.add("doubleClick",()=>!0)),this.disposables.addFromEvent(this.inlineEditorContainer,"blur",()=>{this._unmount()})}).catch(console.error)}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.richText?.updateComplete,e}render(){let e=this.edgeless.service.viewport,t=p.z.deserialize(this.group.xywh),[i,s]=e.toViewCoord(t.x,t.y),o=(0,Z.W)({transformOrigin:"top left",borderRadius:"35px",width:"fit-content",maxHeight:"30px",lineHeight:"20px",padding:"4px 10px",fontSize:"14px",position:"absolute",left:i+"px",top:s-36+"px",minWidth:"8px",fontFamily:"var(--affine-font-family)",color:"var(--affine-text-primary-color)",background:"var(--affine-white-10)",outline:"none",zIndex:"1",border:`1px solid var(--affine-primary-color)`,boxShadow:"var(--affine-active-shadow)"});return(0,L.qy)``}get inlineEditor(){return(0,H.Z1)(this.richText.inlineEditor),this.richText.inlineEditor}get inlineEditorContainer(){return this.inlineEditor.rootElement}#i_=tJ(this,l,void 0);get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#tC=(tJ(this,c),tJ(this,d,void 0));get group(){return this.#tC}set group(e){this.#tC=e}#eH=(tJ(this,h),tJ(this,u,void 0));get richText(){return this.#eH}set richText(e){this.#eH=e}constructor(){super(...arguments),tJ(this,f)}},t})();function t0(e){return 1===e.length&&e[0].group instanceof v.AR}function t2(e,t,i=[0,0]){let s=t.elementBound;return i[0]/=e.zoom,i[1]/=e.zoom,s.x-=i[1],s.w+=i[1],s.y-=i[0],s.h+=i[0],!e.viewportBounds.contains(s)}function t5(e,t,i=[0,0]){let s=e.viewportBounds,o=t.elementBound,r=0,a=0;return o.x-i[1]s.x+s.w&&(r=s.x+s.w-(o.x+o.w+i[1])),o.y-i[0]s.y+s.h&&(a=o.y+o.h+i[0]-(s.y+s.h)),[r,a]}var t7=i(21320),t3=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},t4=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("edgeless-shape-text-editor")],n=[],l=(0,P.Tm)(P.ao),c=[],d=[],h=[],u=[],g=[],m=[],y=[],b=[];return class extends l{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.P)("rich-text")],t3(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:p},c,d),t3(this,null,s,{kind:"accessor",name:"element",static:!1,private:!1,access:{has:e=>"element"in e,get:e=>e.element,set:(e,t)=>{e.element=t}},metadata:p},h,u),t3(this,null,o,{kind:"accessor",name:"mountEditor",static:!1,private:!1,access:{has:e=>"mountEditor"in e,get:e=>e.mountEditor,set:(e,t)=>{e.mountEditor=t}},metadata:p},g,m),t3(this,null,r,{kind:"accessor",name:"richText",static:!1,private:!1,access:{has:e=>"richText"in e,get:e=>e.richText,set:(e,t)=>{e.richText=t}},metadata:p},y,b),t3(null,e={value:t},a,{kind:"class",name:t.name,metadata:p},null,n),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p}),t4(t,n)}_initMindmapKeyBindings(){if(!this.element.surface.isInMindmap(this.element.id))return;let e=this.edgeless.service;this._disposables.addFromEvent(this,"keydown",t=>{switch(t.key){case"Enter":{if(t.shiftKey||t.isComposing)return;t.preventDefault();let i=this.edgeless,s=this.element,o=this.element.group,r=o.getParentNode(s.id)??s,a=o.addNode(r.id);requestAnimationFrame(()=>{this.element=i.service.getElementById(a);let t=this.element;if(this.mountEditor?.(t,i),t2(e.viewport,t,[90,20])){let[s,o]=t5(i.service.viewport,t,[100,20]);i.service.viewport.smoothTranslate(e.viewport.centerX-s,e.viewport.centerY+o)}}),this.ownerDocument.activeElement.blur();break}case"Tab":{t.preventDefault();let i=this.edgeless,s=this.element,o=this.element.group.addNode(s.id);requestAnimationFrame(()=>{this.element=i.service.getElementById(o);let t=this.element;if(this.mountEditor?.(t,i),t2(e.viewport,t,[90,20])){let[s,o]=t5(i.service.viewport,t,[100,20]);i.service.viewport.smoothTranslate(e.viewport.centerX-s,e.viewport.centerY+o)}}),this.ownerDocument.activeElement.blur()}}})}_unmount(){if(this._resizeObserver?.disconnect(),this._resizeObserver=null,this.element.text){let e=this.element.text.toString(),t=e.trim(),i=t.length;0===i?this.element.text=void 0:i{this.requestUpdate(),this.updateComplete.then(()=>{this._updateElementWH()}).catch(console.error)})),this.disposables.add(e.add("click",()=>!0)),this.disposables.add(e.add("doubleClick",()=>!0)),this.updateComplete.then(()=>{this.element.group instanceof tw.AR?this.inlineEditor.selectAll():this.inlineEditor.focusEnd(),this.disposables.add(this.inlineEditor.slots.renderComplete.on(()=>{this._updateElementWH()})),this.disposables.addFromEvent(this.inlineEditorContainer,"blur",()=>{this._keeping||this._unmount()})}).catch(console.error),this.disposables.addFromEvent(this,"keydown",e=>{"Escape"===e.key&&(requestAnimationFrame(()=>{this.edgeless.service.selection.set({elements:[this.element.id],editing:!1})}),this.ownerDocument.activeElement.blur())}),this._initMindmapKeyBindings()}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.richText?.updateComplete,e}render(){if(!this.element.text)return console.error("Failed to mount shape editor because of no text."),L.s6;let[e,t]=this.element.padding,i=this.element.textResizing,s=this.edgeless.service.viewport.zoom,o=(0,tE.Ql)([this.element]),r=this.element.rotate,[a,n]=tm.l.rotWith([o.left,o.top],[o.left+o.width/2,o.top+o.height/2],(0,v.DF)(r)),[l,c]=this.edgeless.service.viewport.toViewCoord(a,n),d=i===tI.bn.AUTO_WIDTH,h=j.Q.generateColorProperty(this.element.color,"#000000"),u=(0,Z.W)({position:"absolute",left:l+"px",top:c+"px",width:i>tI.bn.AUTO_WIDTH?o.width+"px":"fit-content",height:"initial",minHeight:i===tI.bn.AUTO_WIDTH?"1em":`${o.height}px`,maxWidth:i===tI.bn.AUTO_WIDTH&&this.element.maxWidth?`${this.element.maxWidth}px`:void 0,boxSizing:"border-box",fontSize:this.element.fontSize+"px",fontFamily:(0,t7.s9)(this.element.fontFamily),fontWeight:this.element.fontWeight,lineHeight:"normal",outline:"none",transform:`scale(${s}, ${s}) rotate(${r}deg)`,transformOrigin:"top left",color:h,padding:`${e}px ${t}px`,textAlign:this.element.textAlign,display:"grid",gridTemplateColumns:"100%",alignItems:"center"===this.element.textVerticalAlign?"center":"bottom"===this.element.textVerticalAlign?"end":"start",alignContent:"center",gap:"0",zIndex:"1"});return this._lastXYWH=this.element.xywh,(0,L.qy)` `}setKeeping(e){this._keeping=e}get inlineEditor(){return(0,H.Z1)(this.richText.inlineEditor),this.richText.inlineEditor}get inlineEditorContainer(){return this.inlineEditor.rootElement}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#ik;get element(){return this.#ik}set element(e){this.#ik=e}#iS;get mountEditor(){return this.#iS}set mountEditor(e){this.#iS=e}#eH;get richText(){return this.#eH}set richText(e){this.#eH=e}constructor(){super(...arguments),this._keeping=!1,this._lastXYWH="",this._resizeObserver=null,this.#i_=t4(this,c,void 0),this.#ik=(t4(this,d),t4(this,h,void 0)),this.#iS=(t4(this,u),t4(this,g,void 0)),this.#eH=(t4(this,m),t4(this,y,void 0)),t4(this,b)}},t})();function t8(e,t){let i=new Set(t),s=e.edgeless.service;t.forEach(e=>{(0,tE.JC)(e)&&s.getConnectors(e).forEach(e=>i.add(e))}),i.forEach(t=>{(0,tE._h)(t)?(e.doc.root?.children??[]).length>1&&e.doc.deleteBlock(t):s.removeElement(t.id)})}var t9=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ie=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("edgeless-text-editor")],a=[],n=(0,P.Tm)(P.ao),l=[],c=[],d=[],h=[],u=[],f=[];var m=class extends n{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.P)("rich-text")],t9(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:p},l,c),t9(this,null,s,{kind:"accessor",name:"element",static:!1,private:!1,access:{has:e=>"element"in e,get:e=>e.element,set:(e,t)=>{e.element=t}},metadata:p},d,h),t9(this,null,o,{kind:"accessor",name:"richText",static:!1,private:!1,access:{has:e=>"richText"in e,get:e=>e.richText,set:(e,t)=>{e.richText=t}},metadata:p},u,f),t9(null,e={value:t},r,{kind:"class",name:t.name,metadata:p},null,a),m=t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.BORDER_WIDTH=1}static{this.HORIZONTAL_PADDING=10}static{this.PLACEHOLDER_TEXT="Type from here"}static{this.VERTICAL_PADDING=6}static{this.styles=(0,L.AH)` .edgeless-text-editor { position: absolute; left: 0; top: 0; z-index: 10; transform-origin: left top; font-kerning: none; border: ${m.BORDER_WIDTH}px solid var(--affine-primary-color, #1e96eb); border-radius: 4px; box-shadow: 0px 0px 0px 2px rgba(30, 150, 235, 0.3); padding: ${m.VERTICAL_PADDING}px ${m.HORIZONTAL_PADDING}px; overflow: visible; } .edgeless-text-editor .inline-editor { white-space: pre-wrap !important; outline: none; } .edgeless-text-editor .inline-editor span { word-break: normal !important; overflow-wrap: anywhere !important; } .edgeless-text-editor-placeholder { pointer-events: none; color: var(--affine-text-disable-color); white-space: nowrap; } `}connectedCallback(){if(super.connectedCallback(),!this.edgeless){console.error("edgeless is not set.");return}if(!this.element){console.error("text element is not set.");return}this.setAttribute(P.vz.rangeSyncExcludeAttr,"true")}firstUpdated(){let e=this.edgeless,t=this.element,{dispatcher:i}=this.edgeless;(0,H.Z1)(i),this.updateComplete.then(()=>{this.inlineEditor.slots.renderComplete.on(()=>{this._updateRect(),this.requestUpdate()}),this.disposables.add(e.service.surface.elementUpdated.on(({id:e})=>{e===t.id&&this.requestUpdate()})),this.disposables.add(e.service.viewport.viewportUpdated.on(()=>{this.requestUpdate()})),this.disposables.add(i.add("click",()=>!0)),this.disposables.add(i.add("doubleClick",()=>!0)),this.disposables.add(()=>{t.display=!0,0===t.text.length&&t8(e.surface,[t]),e.service.selection.set({elements:[],editing:!1})}),this.disposables.addFromEvent(this.inlineEditorContainer,"blur",()=>!this._keeping&&this.remove()),this.disposables.addFromEvent(this.inlineEditorContainer,"compositionstart",()=>{this._isComposition=!0,this.requestUpdate()}),this.disposables.addFromEvent(this.inlineEditorContainer,"compositionend",()=>{this._isComposition=!1,this.requestUpdate()}),t.display=!1}).catch(console.error)}getContainerOffset(){let{VERTICAL_PADDING:e,HORIZONTAL_PADDING:t,BORDER_WIDTH:i}=m;return`-${t+i}px, -${e+i}px`}getCoordsOnCenterAlign(e,t,i){let s=e.x+e.w/2,o=e.y+e.h/2,r=0,a=-e.h/2*Math.cos(e.r);return{x:s+r-(r=0)-t/2,y:o+a-(a=-i/2*Math.cos(e.r))-i/2}}getCoordsOnLeftAlign(e,t,i){let s=e.x+e.w/2,o=e.y+e.h/2,r=-e.w/2*Math.cos(e.r)+e.h/2*Math.sin(e.r),a=-e.w/2*Math.sin(e.r)-e.h/2*Math.cos(e.r),n=s+r,l=o+a;return r=-t/2*Math.cos(e.r)+i/2*Math.sin(e.r),a=-t/2*Math.sin(e.r)-i/2*Math.cos(e.r),{x:n-r-t/2,y:l-a-i/2}}getCoordsOnRightAlign(e,t,i){let s=e.x+e.w/2,o=e.y+e.h/2,r=e.w/2*Math.cos(e.r)- -e.h/2*Math.sin(e.r),a=e.w/2*Math.sin(e.r)+-e.h/2*Math.cos(e.r),n=s+r,l=o+a;return r=t/2*Math.cos(e.r)- -i/2*Math.sin(e.r),a=t/2*Math.sin(e.r)+-i/2*Math.cos(e.r),{x:n-r-t/2,y:l-a-i/2}}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.richText?.updateComplete,e}getVisualPosition(e){let{x:t,y:i,w:s,h:o,rotate:r}=e;return tm.l.rotWith([t,i],[t+s/2,i+o/2],(0,v.DF)(r))}render(){let{text:e,fontFamily:t,fontSize:i,fontWeight:s,fontStyle:o,textAlign:r,rotate:a,hasMaxWidth:n,w:l}=this.element,c=(0,g.ks)(t,i,s),d=(0,tE.Ql)([this.element]),{translateX:h,translateY:u,zoom:p}=this.edgeless.service.viewport,[f,v]=this.getVisualPosition(this.element),y=this.getContainerOffset(),b=[`translate(${h}px, ${u}px)`,`translate(${f*p}px, ${v*p}px)`,`scale(${p})`,`rotate(${a}deg)`,`translate(${y})`],w=!e.length&&!this._isComposition,x=j.Q.generateColorProperty(this.element.color,"#000000");return(0,L.qy)`
${w?(0,L.qy)` Type from here `:L.s6}
`}setKeeping(e){this._keeping=e}get inlineEditor(){return(0,H.Z1)(this.richText.inlineEditor),this.richText.inlineEditor}get inlineEditorContainer(){return this.inlineEditor.rootElement}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#ik;get element(){return this.#ik}set element(e){this.#ik=e}#eH;get richText(){return this.#eH}set richText(e){this.#eH=e}constructor(){super(...arguments),this._isComposition=!1,this._keeping=!1,this._updateRect=()=>{let e=this.edgeless,t=this.element;if(!e||!t)return;let i=this.inlineEditorContainer.scrollWidth,s=this.inlineEditorContainer.scrollHeight,o=new p.z(t.x,t.y,i,s),{x:r,y:a,w:n,h:l,rotate:c}=t;switch(t.textAlign){case"left":{let e=this.getCoordsOnLeftAlign({x:r,y:a,w:n,h:l,r:(0,v.DF)(c)},i,s);o.x=e.x,o.y=e.y}break;case"center":{let e=this.getCoordsOnCenterAlign({x:r,y:a,w:n,h:l,r:(0,v.DF)(c)},i,s);o.x=e.x,o.y=e.y}break;case"right":{let e=this.getCoordsOnRightAlign({x:r,y:a,w:n,h:l,r:(0,v.DF)(c)},i,s);o.x=e.x,o.y=e.y}}e.service.updateElement(t.id,{xywh:o.serialize()})},this.#i_=ie(this,l,void 0),this.#ik=(ie(this,c),ie(this,d,void 0)),this.#eH=(ie(this,h),ie(this,u,void 0)),ie(this,f)}static{ie(t,a)}};return m=t})(),ii={seed:666,roughness:tI.js,strokeStyle:tI.u1.Solid,strokeLineDash:[],stroke:"black",strokeWidth:e$.D9.Two,fill:"transparent"},is="affine:paragraph",io="text",ir="Text",ia=["affine-note-mask","edgeless-block-portal-note","affine-block-children-container"],il="--affine-palette-line-white",ic="--affine-palette-line-black",id="--affine-palette-shape-black";function ih(e,t,i){if(!t.mountElm)throw new c.Ss(d.O.ValueNotExists,"edgeless block's mount point does not exist");let s=e.text.length;i&&(s=Math.min((0,g.tI)(e,i),s));let o=new it;o.edgeless=t,o.element=e,t.append(o),o.updateComplete.then(()=>{o.inlineEditor?.focusIndex(s)}).catch(console.error),t.tools.switchToDefaultMode({elements:[e.id],editing:!0})}function iu(e,t){if(!t.mountElm)throw new c.Ss(d.O.ValueNotExists,"edgeless block's mount point does not exist");if(!e.text){let i=new f.rl.Y.Text,s=j.Q.getColorValue(e.fillColor,tL());s=tV(s)?tL():s===id?il:ic,t.service.updateElement(e.id,{text:i,color:s,fontFamily:"General"===e.shapeStyle?tI.ay.Inter:tI.ay.Kalam})}let i=t.service.getElementById(e.id);(0,H.nn)(i,m.B5,"Cannot mount text editor on a non-shape element");let s=new t6;s.element=i,s.edgeless=t,s.mountEditor=iu,t.mountElm.append(s),t.tools.switchToDefaultMode({elements:[e.id],editing:!0})}function ip(e,t){if(!t.mountElm)throw new c.Ss(d.O.ValueNotExists,"edgeless block's mount point does not exist");let i=new tX;i.frameModel=e,i.edgeless=t,t.mountElm.append(i),t.tools.switchToDefaultMode({elements:[e.id],editing:!0})}function ig(e,t){if(!t.mountElm)throw new c.Ss(d.O.ValueNotExists,"edgeless block's mount point does not exist");let i=new t1;i.group=e,i.edgeless=t,t.mountElm.append(i),t.tools.switchToDefaultMode({elements:[e.id],editing:!0})}function im(e,t){let[i,s]=e.service.viewport.toModelCoord(t.x,t.y);if(!e.service.pickElement(i,s)){let[i,s]=e.service.viewport.toModelCoord(t.x,t.y),o=e.service.addElement(v.J9.TEXT,{xywh:new p.z(i,s,32,32).serialize(),text:new f.rl.Y.Text});e.doc.captureSync();let r=e.service.getElementById(o);(0,H.Z1)(r),r instanceof tB.n&&ih(r,e)}}function iv(e,t,i){if(!t.mountElm)throw new c.Ss(d.O.ValueNotExists,"edgeless block's mount point does not exist");let s=e.text;if(!s&&(s=new f.rl.Y.Text,e.text=s,e.labelStyle.color=tL(),i)){let t=e.getNearestPoint(i),s=e.getOffsetDistanceByPoint(t),o=p.z.fromXYWH(e.labelXYWH||[0,0,16,16]);o.center=t,e.labelOffset.distance=s,e.labelXYWH=o.toXYWH()}let o=new tG;o.connector=e,o.edgeless=t,t.mountElm.append(o),o.updateComplete.then(()=>{o.inlineEditor?.focusEnd()}).catch(console.error),t.tools.switchToDefaultMode({elements:[e.id],editing:!0})}class iy{constructor(e){this._draggingArea=null,this.enableHover=!1,this._service=e}get _blocks(){return this._edgeless.service.blocks}get _doc(){return this._edgeless.doc}get _surface(){return this._edgeless.surface}mount(e){this._edgeless=e}get draggingArea(){return this._draggingArea}}!function(e){e.AltCloning="alt-cloning",e.ConnectorLabelMoving="connector-label-moving",e.ContentMoving="content-moving",e.NativeEditing="native-editing",e.None="none",e.PreviewDragging="preview-dragging",e.Selecting="selecting"}(o||(o={}));class ib extends iy{constructor(){super(...arguments),this._alignBound=new p.z,this._autoPanTimer=null,this._clearDisposable=()=>{this._disposables&&(this._disposables.dispose(),this._disposables=null)},this._clearLastSelection=()=>{this.edgelessSelectionManager.empty&&this.edgelessSelectionManager.clearLast()},this._clearMindMapHoverState=[],this._clearSelectingState=()=>{this._stopAutoPanning(),this._clearDisposable(),this._dragging=!1,this._wheeling=!1,this._dragStartPos=[0,0],this._dragLastPos=[0,0],this._dragStartModelCoord=[0,0],this._dragLastModelCoord=[0,0],this._edgeless.slots.draggingAreaUpdated.emit(),this._moveSelectionDragStartTemp=[0,0],this._moveSelectionStartPos=[0,0]},this._disposables=null,this._dragLastModelCoord=[0,0],this._dragLastPos=[0,0],this._dragStartModelCoord=[0,0],this._dragStartPos=[0,0],this._dragging=!1,this._draggingSingleMindmap=null,this._hoveredMindMap=null,this._isDoubleClickedOnMask=!1,this._lock=!1,this._moveSelectionDragStartTemp=[0,0],this._moveSelectionStartPos=[0,0],this._panViewport=e=>{let{viewport:t}=this._service;t.applyDeltaCenter(e[0],e[1])},this._selectedBounds=[],this._selectedConnector=null,this._selectedConnectorLabelBounds=null,this._startAutoPanning=e=>{this._panViewport(e),this._stopAutoPanning(),this._autoPanTimer=window.setInterval(()=>{this._panViewport(e),this._updateSelectingState()},30)},this._stopAutoPanning=()=>{this._autoPanTimer&&(clearTimeout(this._autoPanTimer),this._autoPanTimer=null)},this._toBeMoved=[],this._updateSelectingState=()=>{let{tools:e,service:t}=this._edgeless,{selection:i}=t;if(e.spaceBar){let[e,i]=this._dragLastPos,s=t.viewport.zoom,o=(e-this._moveSelectionStartPos[0])/s,r=(i-this._moveSelectionStartPos[1])/s,[a,n]=t.viewport.toModelCoord(this._moveSelectionDragStartTemp[0],this._moveSelectionDragStartTemp[1]);this._dragStartModelCoord[0]=a+o,this._dragStartModelCoord[1]=n+r}let s=this._dragStartModelCoord[0],o=this._dragStartModelCoord[1],[r,a]=t.viewport.toModelCoord(this._dragLastPos[0],this._dragLastPos[1]),n=Math.min(s,r),l=Math.min(o,a),c=Math.abs(s-r),d=Math.abs(o-a),h=new p.z(n,l,c,d),u=t.pickElementsByBound(h),f=new Set(e.shiftKey?[...u,...i.selectedElements]:u);this.edgelessSelectionManager.set({elements:Array.from(f).map(e=>e.id),editing:!1}),this._dragLastModelCoord=[r,a],this._edgeless.slots.draggingAreaUpdated.emit()},this._wheeling=!1,this.dragType=o.None,this.enableHover=!0,this.tool={type:"default"}}_addEmptyParagraphBlock(e){let t=this._doc.addBlock("affine:paragraph",{type:"text"},e.id);t&&O.Km(this._edgeless.host,t)?.catch(console.error)}async _cloneContent(){this._lock=!0;let{_edgeless:e}=this,{clipboardController:t}=e,i=await (0,tM.xc)(this._toBeMoved,e.std),s=tS(this._toBeMoved),{canvasElements:o,blockModels:r}=await t.createElementsFromClipboardData(i,s.center);this._toBeMoved=[...o,...r],this.edgelessSelectionManager.set({elements:this._toBeMoved.map(e=>e.id),editing:!1})}_determineDragType(e){let{x:t,y:i}=e;if(this.edgelessSelectionManager.isInSelectedRect(t,i)){if(1===this.edgelessSelectionManager.selectedElements.length){let e=this.edgelessSelectionManager.selectedElements[0],s=this._pick(t,i);if((0,tE.X8)(e)||e instanceof tw.$f||!s||s===e||(e=s,this.edgelessSelectionManager.set({elements:[e.id],editing:!1})),(0,tE.r0)(e)&&(0,tb.yp)(e)&&e.labelIncludesPoint(this._service.viewport.toModelCoord(t,i)))return this._selectedConnector=e,this._selectedConnectorLabelBounds=p.z.fromXYWH(this._selectedConnector.labelXYWH),o.ConnectorLabelMoving}return this.edgelessSelectionManager.editing?o.NativeEditing:o.ContentMoving}{let e=this._pick(t,i);return e?(this.edgelessSelectionManager.set({elements:[e.id],editing:!1}),(0,tE.r0)(e)&&(0,tb.yp)(e)&&e.labelIncludesPoint(this._service.viewport.toModelCoord(t,i)))?(this._selectedConnector=e,this._selectedConnectorLabelBounds=p.z.fromXYWH(this._selectedConnector.labelXYWH),o.ConnectorLabelMoving):o.ContentMoving:o.Selecting}}_filterConnectedConnector(){this._toBeMoved=this._toBeMoved.filter(e=>!(e instanceof tw.lw&&e.source?.id&&e.target?.id&&this._toBeMoved.some(t=>t.id===e.source.id)&&this._toBeMoved.some(t=>t.id===e.target.id)))}_isDraggable(e){return!(e instanceof tw.lw&&!(0,tC.BP)(e,this._toBeMoved))}_moveContent([e,t],i,s,o){i.x+=e,i.y+=t;let r=this._edgeless.service.snap.align(i),a=[e+r.dx,t+r.dy];if(s){let e=Math.abs(Math.atan2(a[1],a[0]));a["x"==(eMath.PI/4*3?"x":"y")?1:0]=0}if(this._toBeMoved.forEach((e,t)=>{let i=(0,tE.r0)(e);if(i&&!this._isDraggable(e))return;let s=this._selectedBounds[t];o&&(s=s.clone()),s.x+=a[0],s.y+=a[1],i&&(this._lock||(this._lock=!0,this._doc.captureSync()),e instanceof tw.lw&&e.moveTo(s)),this._service.updateElement(e.id,{xywh:s.serialize()})}),this._draggingSingleMindmap){let{node:e,mindmap:t,startElementBound:i}=this._draggingSingleMindmap,s=e.element,o=t.getNode(s.id),[r,a]=this._service.viewport.toModelCoord(this._dragLastPos[0],this._dragLastPos[1]);this._clearMindMapHoverState.forEach(e=>e()),this._clearMindMapHoverState=[];let n=this._edgeless.service.pickElement(r,a,{all:!0,expand:40}).filter(e=>e.group?.type==="mindmap"&&e!==s).map(e=>({element:e,node:e.group.getNode(e.id),mindmap:e.group}))[0];if(n){let{node:e,element:i,mindmap:s}=n;i.opacity=.8;let{clear:l,mergeInfo:c}=function(e,t,i,s){if(!(t=e.getNode("string"==typeof t?t:t.id)))return;(0,H.j)(t);let o=e=>!!t&&!!e&&t!==e&&(!e.children.length||e.children.every(e=>o(e)));if(!o(i))return;let r=(()=>{let i=e.getLayoutDir(t),o=function(e,t,i){let{x:s,y:o,w:r,h:a}=e,n=i===tx.p5.BALANCE?[s+r/2,o+a/2]:i===tx.p5.LEFT?[s+r/3*1,o+a/2]:[s+r/3*2,o+a/2];return`${t[1]-n[1]>0?"bottom":"top"}-${t[0]-n[0]>0?"right":"left"}`}(t.element,s,i),r=t.id!==e.tree.id&&(i===tx.p5.RIGHT&&o.includes("left")||i===tx.p5.LEFT&&o.includes("right"));return(()=>{if(!r)return{target:t,index:o.includes("top")?0:t.children.length,layoutType:i===tx.p5.BALANCE?o.includes("right")?tx.p5.RIGHT:tx.p5.LEFT:i};let s=e.getParentNode(t.id);return{target:s,index:s.children.indexOf(t)+(o.includes("bottom")?1:0),layoutType:i}})()})(),a=e.getPath(r.target);a.push(r.index);let n=e.styleGetter.getNodeStyle(i,a),l=e.addConnector(r.target,i,r.layoutType,n.connector,!0);return i.overriddenDir=r.layoutType,{clear:()=>{e.extraConnectors.delete(l.id),delete i.overriddenDir},mergeInfo:r}}(s,e,o,[r,a])??{};l&&this._clearMindMapHoverState.push(l);let d=t_(t,o);d&&this._clearMindMapHoverState.push(d);let h=c?.layoutType;this._clearMindMapHoverState.push(()=>{i.opacity=1}),t.layout(o,!1,h??void 0),this._hoveredMindMap={node:e,mindmap:s,mergeInfo:c}}else{let s=new p.z(r,a,40,40);if((0,tk.HY)(i,s)||i.contains(s)||t.tree.id===e.id)this._draggingSingleMindmap.detach=!1;else{let e=t_(t,o);e&&this._clearMindMapHoverState.push(e),this._draggingSingleMindmap.detach=!0}t.layout(o,!1),this._hoveredMindMap=null}}let n=this._edgeless.service.frame.selectFrame(this._toBeMoved);n?this._surface.overlays.frame.highlight(n):this._surface.overlays.frame.clear()}_moveLabel(e){let t=this._selectedConnector,i=this._selectedConnectorLabelBounds;if(!t||!i)return;i=i.clone();let s=t.getNearestPoint(tm.l.add(i.center,e)),o=t.getOffsetDistanceByPoint(s);i.center=s,this._service.updateElement(t.id,{labelXYWH:i.toXYWH(),labelOffset:{distance:o}})}_pick(e,t,i){let s=this._service,o=s.viewport.toModelCoord(e,t),r=s.pickElementInGroup(o[0],o[1],i);if(r instanceof tw.AR){let e=s.pickElement(o[0],o[1],{...i??{},all:!0}),t=e.length-1;for(;t>=0;){if(e[t]===r){t-=1;continue}break}return e[t]??null}return r}initializeDragState(e,t){let{x:i,y:s}=e;this.dragType=t,this._dragging=!0,this._dragStartPos=[i,s],this._dragLastPos=[i,s];let[r,a]=this._service.viewport.toModelCoord(i,s);if(this._dragStartModelCoord=[r,a],this._dragLastModelCoord=[r,a],this._selectedBounds=this._toBeMoved.map(e=>p.z.deserialize(e.xywh)),this._toBeMoved.every(e=>!(e.group instanceof tw.AR))&&(this._alignBound=this._edgeless.service.snap.setupAlignables(this._toBeMoved)),this._clearDisposable(),this._disposables=new eg.K,this.dragType===o.Selecting){this._disposables.add(this._edgeless.service.viewport.viewportUpdated.on(()=>{this.dragType===o.Selecting&&this._dragging&&!this._autoPanTimer&&this._updateSelectingState()}));return}if(this.dragType===o.ContentMoving){this._disposables.add(this._edgeless.service.viewport.viewportMoved.on(e=>{this.dragType!==o.ContentMoving||!this._dragging||this._autoPanTimer||this._toBeMoved.every(e=>!this._isDraggable(e))||(this._wheeling||(this._wheeling=!0,this._selectedBounds=this._toBeMoved.map(e=>p.z.deserialize(e.xywh))),this._alignBound=this._edgeless.service.snap.setupAlignables(this._toBeMoved),this._moveContent(e,this._alignBound))}));return}}afterModeSwitch(){(0,td.lQ)()}beforeModeSwitch(e){e?.type==="pan"&&this._clearLastSelection(),this._stopAutoPanning(),this._clearDisposable(),(0,td.lQ)()}onContainerClick(e){if(this.readonly)return;let t=this._pick(e.x,e.y,{ignoreTransparent:!0});if(t){let{selectedIds:i,surfaceSelections:s}=this.edgelessSelectionManager,o=s[0]?.editing??!1;if(1===i.length&&i[0]===t.id&&o){((0,tE._h)(t)||(0,tE.dT)(t))&&0===t.children.length&&this._addEmptyParagraphBlock(t);return}if(!e.keys.shift&&1===i.length&&((0,tE._h)(t)||(0,tE.dT)(t))&&(i[0]===t.id&&!o||o&&i[0]!==t.id)){this.edgelessSelectionManager.set({elements:[t.id],editing:!0}),this._edgeless.updateComplete.then(()=>{if(0===t.children.length)this._addEmptyParagraphBlock(t);else{let i=this._edgeless.host.view.viewFromPath("block",(0,O.UL)(t));if(i){let t=i.querySelector(".affine-block-children-container").getBoundingClientRect(),s=8*this.zoom,o=2*this.zoom,r=(0,tv.qE)(e.raw.clientX,t.left+o,t.right-o),a=(0,tv.qE)(e.raw.clientY,t.top+s,t.bottom-s);(0,O.kW)(r,a)}else(0,O.kW)(e.raw.clientX,e.raw.clientY)}}).catch(console.error);return}this.edgelessSelectionManager.set({elements:e.keys.shift?this.edgelessSelectionManager.has(t.id)?i.filter(e=>e!==t.id):[...i,t.id]:[t.id],editing:!1})}else e.keys.shift||(this.edgelessSelectionManager.clear(),(0,O.xb)(null));this._isDoubleClickedOnMask=!1}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(e){if(this._doc.readonly){let t=this._service.viewport;if(1===t.zoom){let{centerX:e,centerY:i,zoom:s}=this._edgeless.service.getFitToScreenData();t.setViewport(s,[e,i],!0)}else{let[i,s]=t.toModelCoord(e.x,e.y);t.setViewport(1,[i,s],!0)}return}let t=this._pick(e.x,e.y,{expand:10});if(t){let[i,s]=this._service.viewport.toModelCoord(e.x,e.y);if(t instanceof tw.n6){ih(t,this._edgeless,{x:i,y:s});return}if(t instanceof tw.B5){iu(t,this._edgeless);return}if(t instanceof tw.lw){iv(t,this._edgeless,[i,s]);return}if((0,tE.X8)(t)){ip(t,this._edgeless);return}if(t instanceof tw.$f){ig(t,this._edgeless);return}}else{if(this._edgeless.doc.awarenessStore.getFlag("enable_edgeless_text")){let[t,i]=this._service.viewport.toModelCoord(e.x,e.y);this._edgeless.host.spec.getService("affine:edgeless-text").initEdgelessTextBlock({edgeless:this._edgeless,x:t,y:i})}else im(this._edgeless,e);this._edgeless.service.telemetryService?.track("CanvasElementAdded",{control:"canvas:dbclick",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"text"});return}if(e.raw.target&&e.raw.target instanceof HTMLElement&&e.raw.target.classList.contains("affine-note-mask")){this.onContainerClick(e),this._isDoubleClickedOnMask=!0;return}}onContainerDragEnd(){if(this._draggingSingleMindmap){if(this._hoveredMindMap&&this._hoveredMindMap.mergeInfo){let{mergeInfo:e,mindmap:t}=this._hoveredMindMap,{node:i,mindmap:s}=this._draggingSingleMindmap;!function(e,t,i,s,o,r){if(e===i)return e.moveTree(t,s,o,r);e.detach(t)&&i.addTree(s,t,o,r)}(s,i,t,e.target,e.index,e.layoutType)}else if(this._draggingSingleMindmap.detach){let{mindmap:e}=this._draggingSingleMindmap,t=e.detach(this._draggingSingleMindmap.node);t&&tw.AR.createFromTree(t,e.style,e.layoutType,this._surface.model)}else this._draggingSingleMindmap.mindmap.layout(),this._toBeMoved.forEach(e=>e.pop("xywh"));this._draggingSingleMindmap.clear?.()}else this._toBeMoved.forEach(e=>{this._doc.transact(()=>{e.pop("xywh")}),e instanceof tw.lw&&e.pop("labelXYWH"),e instanceof tw.AR&&e.requestLayout()});if(this._lock&&(this._doc.captureSync(),this._lock=!1),this.edgelessSelectionManager.editing)return;let{surface:e}=this._edgeless;this._dragStartPos=[0,0],this._dragLastPos=[0,0],this._selectedBounds=[],this._edgeless.service.snap.cleanupAlignables(),e.overlays.frame.clear(),this._toBeMoved=[],this._selectedConnector=null,this._selectedConnectorLabelBounds=null,this._clearSelectingState(),this._clearMindMapHoverState.forEach(e=>e()),this._draggingSingleMindmap=null,this.dragType=o.None}onContainerDragMove(e){let{viewport:t}=this._service,i=t.zoom;switch(this.dragType){case o.Selecting:{this._dragLastPos=[e.x,e.y],this._updateSelectingState();let i=function(e,t,i=20){let{left:s,top:o,cumulativeParentScale:r}=e,{width:a,height:n}=e;a/=r,n/=r;let{x:l,y:c}=t,{containerOffset:d}=t;l+=d.x,c+=d.y;let h=ls+a-i,p=co+n-i;if(!(h||u||p||f))return null;let g=0,m=0;return h?g=Math.max(-30,l-(s+i)):u&&(g=Math.min(30,l-(s+a-i))),p?m=Math.max(-30,c-(o+i)):f&&(m=Math.min(30,c-(o+n-i))),[g,m]}(t,e);i?this._startAutoPanning(i):this._stopAutoPanning();break}case o.AltCloning:case o.ContentMoving:{if(this._toBeMoved.every(e=>!this._isDraggable(e)))return;this._wheeling?(this._wheeling=!1,this._dragStartPos=[...this._dragLastPos]):this._dragLastPos=[e.x,e.y];let t=(e.x-this._dragStartPos[0])/i,s=(e.y-this._dragStartPos[1])/i,o=this._alignBound.clone(),r=e.keys.shift||this._edgeless.tools.shiftKey;this._moveContent([t,s],o,r,!0);break}case o.ConnectorLabelMoving:{let t=(e.x-this._dragStartPos[0])/i,s=(e.y-this._dragStartPos[1])/i;this._moveLabel([t,s])}case o.NativeEditing:}}async onContainerDragStart(e){if(this.edgelessSelectionManager.editing)return;let t=this._determineDragType(e),i=this.edgelessSelectionManager.selectedElements,s=new Set(i);if(i.forEach(e=>{(0,tE.X8)(e)?this._edgeless.service.frame.getElementsInFrame(e).forEach(e=>s.add(e)):e.group instanceof tw.AR&&i.length>1?e.group.descendants().forEach(e=>s.add(e)):e instanceof ty.$b&&e.descendants().forEach(e=>s.add(e))}),this._toBeMoved=Array.from(s),e.keys.alt&&t===o.ContentMoving&&(t=o.AltCloning,await this._cloneContent()),this._filterConnectedConnector(),this._toBeMoved.sort((e,t)=>e instanceof tw.lw?-1:1),this.initializeDragState(e,t),1===this._toBeMoved.length&&this._toBeMoved[0].group instanceof tw.AR){let e=this._toBeMoved[0].group;this._draggingSingleMindmap={mindmap:e,node:e.getNode(this._toBeMoved[0].id),clear:e.stashTree(this._toBeMoved[0].id),startElementBound:e.elementBound}}else this._toBeMoved.forEach(e=>{e.stash("xywh"),e instanceof tw.lw&&e.stash("labelXYWH")})}onContainerMouseMove(){(0,td.lQ)()}onContainerMouseOut(e){(0,td.lQ)()}onContainerPointerDown(){(0,td.lQ)()}onContainerTripleClick(){if(this._isDoubleClickedOnMask)return}onPressShiftKey(e){(0,td.lQ)()}onPressSpaceBar(e){let{service:t}=this._edgeless;if(this._dragging){if(e){let[e,t]=this._dragLastPos;this._moveSelectionStartPos=[e,t];let[i,s]=this._dragStartPos;this._moveSelectionDragStartTemp=[i,s]}else{let[e,i]=this._dragStartModelCoord;this._dragStartPos=t.viewport.toViewCoord(e,i),this._moveSelectionDragStartTemp=[...this._dragStartPos]}}}get draggingArea(){if(this.dragType===o.Selecting){let[e,t]=this._service.viewport.toViewCoord(this._dragStartModelCoord[0],this._dragStartModelCoord[1]),[i,s]=this._service.viewport.toViewCoord(this._dragLastModelCoord[0],this._dragLastModelCoord[1]);return{start:new DOMPoint(e,t),end:new DOMPoint(i,s)}}return null}get edgelessSelectionManager(){return this._edgeless.service.selection}get readonly(){return this._edgeless.doc.readonly}get zoom(){return this._edgeless.service.viewport.zoom}}var iw=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ix=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n=[(0,D.EM)("affine-edgeless-text")],l=[],c=P.Yx,d=[],h=[],u=[],f=[],g=[],m=[];return class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],r=[(0,D.P)(".edgeless-text-block-container")],a=[(0,D.P)(".affine-block-children-container")],iw(this,null,i,{kind:"accessor",name:"_editing",static:!1,private:!1,access:{has:e=>"_editing"in e,get:e=>e._editing,set:(e,t)=>{e._editing=t}},metadata:s},d,h),iw(this,null,r,{kind:"accessor",name:"_textContainer",static:!1,private:!1,access:{has:e=>"_textContainer"in e,get:e=>e._textContainer,set:(e,t)=>{e._textContainer=t}},metadata:s},u,f),iw(this,null,a,{kind:"accessor",name:"childrenContainer",static:!1,private:!1,access:{has:e=>"childrenContainer"in e,get:e=>e.childrenContainer,set:(e,t)=>{e.childrenContainer=t}},metadata:s},g,m),iw(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,L.AH)` .edgeless-text-block-container[data-max-width='false'] .inline-editor span { word-break: normal !important; overflow-wrap: normal !important; } `}_initDragEffect(){let e=this.rootService.selection,t=this.parentBlock.selectedRect,i=this.disposables;e&&t&&(i.add(t.slots.dragStart.filter(()=>e.selectedElements.includes(this.model)).on(()=>{(t.dragDirection===s.Left||t.dragDirection===s.Right)&&(this._horizontalResizing=!0)})),i.add(t.slots.dragEnd.filter(()=>e.selectedElements.includes(this.model)).on(()=>{(t.dragDirection===s.Left||t.dragDirection===s.Right)&&(this._horizontalResizing=!1)})))}_updateH(){let e=p.z.deserialize(this.model.xywh),t=this._textContainer.getBoundingClientRect();e.h=Math.max(t.height/this.rootService.zoom,iC*this.rootService.zoom),this.doc.updateBlock(this.model,{xywh:e.serialize()})}_updateW(){let e=p.z.deserialize(this.model.xywh),t=this._textContainer.getBoundingClientRect();e.w=Math.max(t.width/this.rootService.zoom,i_*this.rootService.zoom),this.doc.updateBlock(this.model,{xywh:e.serialize()})}checkWidthOverflow(e){let t=!0,i=this._textContainer.style.width;return this._textContainer.style.width=`${e}px`,this.childrenContainer.scrollWidth>this.childrenContainer.offsetWidth&&(t=!1),this._textContainer.style.width=i,t}connectedCallback(){super.connectedCallback(),this.disposables.add(this.model.propsUpdated.on(({key:e})=>{this.updateComplete.then(()=>{let t=this.host.command,i=this.model.children.map(e=>this.host.selection.create("block",{blockId:e.id}));"fontStyle"===e?t.exec("formatBlock",{blockSelections:i,styles:{italic:null}}):"color"===e?t.exec("formatBlock",{blockSelections:i,styles:{color:null}}):"fontWeight"===e&&t.exec("formatBlock",{blockSelections:i,styles:{bold:null}})}).catch(console.error)})),this.style.transformOrigin="0 0"}firstUpdated(e){super.firstUpdated(e);let{disposables:t,rootService:i}=this,s=i.selection;this._initDragEffect(),t.add(s.slots.updated.on(()=>{s.has(this.model.id)&&s.editing?this._editing=!0:this._editing=!1})),this._resizeObserver.observe(this._textContainer),t.add(()=>{this._resizeObserver.disconnect()}),t.addFromEvent(this._textContainer,"click",e=>{if(!this._editing)return;let t=this._textContainer.getBoundingClientRect(),i=e.clientY{this._editing&&this.rootService.selectionManager.clear()})}getRenderingRect(){let{xywh:e,scale:t,rotate:i,hasMaxWidth:s}=this.model,o=p.z.deserialize(e),r=s||this._horizontalResizing||this.dragMoving?o.w/t:void 0;return{x:o.x,y:o.y,w:r,h:o.h,rotate:i,zIndex:this.toZIndex()}}renderGfxBlock(){let{model:e}=this,{scale:t,rotate:i,hasMaxWidth:s}=e,o={transform:`rotate(${i}deg)`,transformOrigin:"center",padding:"5px 10px",border:`1px solid ${this._editing?"var(--affine—primary—color, #1e96eb)":"transparent"}`,borderRadius:"4px",boxSizing:"border-box",boxShadow:this._editing?"0px 0px 0px 2px rgba(30, 150, 235, 0.3)":"none",fontWeight:"400",lineHeight:"var(--affine-line-height)"};return this.style.transform=`scale(${t})`,(0,L.qy)`
${this.renderPageContent()}
`}renderPageContent(){let{fontFamily:e,fontStyle:t,fontWeight:i,textAlign:s}=this.model,o=j.Q.generateColorProperty(this.model.color,"#000000"),r=(0,Z.W)({color:o,fontFamily:(0,t7.s9)(e),fontStyle:t,fontWeight:i,textAlign:s});return(0,L.qy)`
${this.renderChildren(this.model)}
`}toZIndex(){return`${this.rootService.layer.getZIndex(this.model)}`}tryFocusEnd(){let e=Array.from(this.querySelectorAll("affine-paragraph, affine-list")).at(-1);e&&this.host.selection.setGroup("note",[this.host.selection.create("text",{from:{blockId:e.blockId,index:e.model.text?.length??0,length:0},to:null})])}get dragMoving(){let e=this.rootService.tool.currentController;return e instanceof ib&&e.dragType===o.ContentMoving}get parentBlock(){return super.parentBlock}#iM;get _editing(){return this.#iM}set _editing(e){this.#iM=e}#iE;get _textContainer(){return this.#iE}set _textContainer(e){this.#iE=e}#iI;get childrenContainer(){return this.#iI}set childrenContainer(e){this.#iI=e}constructor(){super(...arguments),this._horizontalResizing=!1,this._resizeObserver=new ResizeObserver(()=>{if(!this.doc.readonly){if(!this.rootService){console.error("rootService is not ready in edgeless-text-block");return}this._editing&&!this.model.hasMaxWidth&&this._updateW(),this._updateH()}}),this.rootServiceFlavour="affine:page",this.#iM=ix(this,d,!1),this.#iE=(ix(this,h),ix(this,u,void 0)),this.#iI=(ix(this,f),ix(this,g,void 0)),ix(this,m)}static{ix(t,l)}},t})();class iS extends P.ps{initEdgelessTextBlock({edgeless:e,x:t,y:i}){let s=e.service.zoom,o=e.service.addBlock("affine:edgeless-text",{xywh:new p.z(t-i_*s/2,i-iC*s/2,i_*s,iC*s).serialize()},e.surface.blockId),r=e.doc.addBlock("affine:paragraph",{type:"text"},o);return e.updateComplete.then(()=>{e.service.selection.set({elements:[o],editing:!0}),tp.Km(e.host,r)?.then(()=>{let t=e.host.view.getBlock(o),i=e.host.view.getBlock(r);if(!t||!i)return;let s=new AbortController;t.addEventListener("focusout",s=>{i.model.text&&(0!==i.model.text.length||null===s.relatedTarget)||e.doc.deleteBlock(t.model)},{once:!0,signal:s.signal}),i.model.deleted.once(()=>{s.abort()})}).catch(console.error)}).catch(console.error),o}}let iM={schema:tu.C,view:{component:(0,th.eu)`affine-edgeless-text`},service:iS};var iE=i(33096);let iI={schema:iE.o,view:{component:(0,th.eu)`affine-frame`}};var iB=i(7770);let i$=new class{constructor(e){this._originalArray=[...e],this._copyArray=[...e]}randomIndex(e){return Math.floor(Math.random()*e)}pick(){0===this._copyArray.length&&(this._copyArray=[...this._originalArray]);let e=this.randomIndex(this._copyArray.length),t=this._copyArray[e];return this._copyArray.splice(e,1),t}}(["var(--affine-multi-players-purple)","var(--affine-multi-players-magenta)","var(--affine-multi-players-red)","var(--affine-multi-players-orange)","var(--affine-multi-players-green)","var(--affine-multi-players-blue)","var(--affine-multi-players-brown)","var(--affine-multi-players-grey)"]);class iT{constructor(e){this.host=e;let t=this.rootService.editPropsStore.getStorage("remoteColor");if(t){this.awareness.awareness.setLocalStateField("color",t);return}let i=i$.pick();this.awareness.awareness.setLocalStateField("color",i),this.rootService.editPropsStore.setStorage("remoteColor",i)}get awareness(){return this.host.doc.collection.awarenessStore}get rootService(){return this.host.spec.getService("affine:page")}get(e){let t=this.awareness.getStates().get(e)?.color;if(t)return t;if(e!==this.awareness.awareness.clientID)return null;let i=this.rootService.editPropsStore.getStorage("remoteColor");if(i)return this.awareness.awareness.setLocalStateField("color",i),i;let s=i$.pick();return this.awareness.awareness.setLocalStateField("color",s),this.rootService.editPropsStore.setStorage("remoteColor",s),s}}function iO(e){return"AFFINE-PAGE-ROOT"===e.tagName||"AFFINE-EDGELESS-ROOT"===e.tagName}function iP(e,t){return e.left<=t.left+t.width&&e.left+e.width>=t.left&&e.top<=t.top+t.height&&e.top+e.height>=t.top}function iH(e,t){let i=Math.min(e.left,t.left),s=Math.min(e.top,t.top);return{left:i,top:s,width:Math.max(e.left+e.width,t.left+t.width)-i,height:Math.max(e.top+e.height,t.top+t.height)-s}}var iA=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},iL=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)(iD)],s=[],o=P.W;(class extends o{static{t=this}constructor(){super(...arguments),this._abortController=new AbortController,this._remoteColorManager=null,this._remoteSelections=(0,q.EW)(()=>{let e=this.doc.awarenessStore.getStates();return[...this.std.selection.remoteSelections.entries()].map(([t,i])=>({id:t,selections:i,user:e.get(t)?.user}))}),this._resizeObserver=new ResizeObserver(()=>{this.requestUpdate()})}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;iA(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` :host { pointer-events: none; } `}get _config(){return{blockSelectionBackgroundTransparent:e=>(0,tf.o)(e,["affine:code","affine:database","affine:image"])||!/affine:embed-*/.test(e.flavour),...this.std.spec.getConfig("affine:page")?.docRemoteSelectionWidget??{}}}get _container(){return this.offsetParent}get _containerRect(){return this.offsetParent?.getBoundingClientRect()}_getCursorRect(e){if(!iO(this.block))return console.error("remote selection widget must be used in page component"),null;let t=e.find(e=>e instanceof P.U3),i=e.filter(e=>e instanceof P.as),s=this._container,o=this._containerRect;if(t){let e=this.std.range.textSelectionToRange(this._selectionManager.create("text",{from:{blockId:t.to?t.to.blockId:t.from.blockId,index:t.to?t.to.index+t.to.length:t.from.index+t.from.length,length:0},to:null}));if(!e)return null;let i=this._container,s=this._containerRect,o=Array.from(e.getClientRects());if(1===o.length){let e=o[0];return{width:2,height:e.height,top:e.top-(s?.top??0)+(i?.scrollTop??0),left:e.left-(s?.left??0)+(i?.scrollLeft??0)}}}else if(i.length>0){let e=i[i.length-1],t=this.host.view.getBlock(e.blockId);if(t){let e=t.getBoundingClientRect();return{width:2,height:e.height,top:e.top-(o?.top??0)+(s?.scrollTop??0),left:e.left+e.width-(o?.left??0)+(s?.scrollLeft??0)}}}return null}_getSelectionRect(e){if(!iO(this.block))return console.error("remote selection widget must be used in page component"),[];let t=e.find(e=>e instanceof P.U3),i=e.filter(e=>e instanceof P.as),s=this._container,o=this._containerRect;if(t){let e=this.std.range.textSelectionToRange(t);if(e)return function(e){let t,i=[];do{t=!1;let o=[...i];for(let i of e){let e=!1;for(let r=0;r=i.left+i.width&&s.top+s.height>=i.top+i.height){e=!0;break}if(iP(o[r],i)){o[r]=iH(o[r],i),e=!0,t=!0;break}}e||o.push(i)}if(!t){for(let e=0;e({width:e.right-e.left,height:e.bottom-e.top,top:e.top-(o?.top??0)+(s?.scrollTop??0),left:e.left-(o?.left??0)+(s?.scrollLeft??0)})).filter(e=>e.width>0&&e.height>0))}else if(i.length>0)return i.flatMap(e=>{let t=this.host.view.getBlock(e.blockId);if(t){let e=t.getBoundingClientRect(),i=this._config.blockSelectionBackgroundTransparent(t.model);return{width:e.width,height:e.height,top:e.top-(o?.top??0)+(s?.scrollTop??0),left:e.left-(o?.left??0)+(s?.scrollLeft??0),transparent:i}}return[]});return[]}get _selectionManager(){return this.host.selection}connectedCallback(){super.connectedCallback(),this.handleEvent("wheel",()=>{this.requestUpdate()}),this.disposables.addFromEvent(window,"resize",()=>{this.requestUpdate()}),this._remoteColorManager=new iT(this.host)}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver.disconnect(),this._abortController.abort()}render(){if(0===this._remoteSelections.value.length)return L.s6;let e=new Set,t=this._remoteSelections.value.flatMap(({selections:t,id:i,user:s})=>e.has(i)?[]:(e.add(i),{id:i,selections:t,rects:this._getSelectionRect(t),user:s})),i=this._remoteColorManager;return(0,H.Z1)(i),(0,L.qy)`
${t.flatMap(e=>{let t=i.get(e.id);if(!t)return;let s=this._getCursorRect(e.selections);return e.rects.map(e=>(0,L.qy)`
`).concat([(0,L.qy)`
${e.user?.name}
`])})}
`}static{iL(t,s)}})})();var iZ=i(28103),ij=i(63820),iV=i(74351);class iz{constructor(e){this.rootComponent=e,this._handleDelete=()=>{let e=this._currentSelection.filter(e=>e.is("block"));0!==e.length&&this._doc.transact(()=>{let t=this._replaceBlocksBySelection(e,"affine:paragraph",{});t&&this._selection.setGroup("note",[this._selection.create("text",{from:{index:0,length:0,blockId:t.blockId},to:null})])})},this.rootComponent.bindHotKey({"Mod-z":e=>{e.get("defaultState").event.preventDefault(),this._doc.canUndo&&this._doc.undo()},"Shift-Mod-z":e=>{e.get("defaultState").event.preventDefault(),this._doc.canRedo&&this._doc.redo()},"Control-y":e=>{ij.H8&&(e.get("defaultState").event.preventDefault(),this._doc.canRedo&&this._doc.redo())},"Mod-Backspace":()=>!0,Backspace:this._handleDelete,Delete:this._handleDelete,"Control-d":()=>{ij.vL&&this._handleDelete()},"Mod-Shift-l":()=>{this._createEmbedBlock()}},{global:!0})}_createEmbedBlock(){let e=this.rootComponent,[t,i]=this.rootComponent.std.command.chain().getSelectedModels({types:["block"],mode:"highest"}).run(),s=i.selectedModels?.filter(e=>!e.flavour.startsWith("affine:embed-")&&tf.o(o.getParent(e),["affine:note"]));if(!s?.length)return;let o=e.host.doc,r=(0,iV.G6)(s);(0,iV.fG)(e.host,r).then(t=>{if(null===t)return;let i=(0,iV.B$)(o,s,t);e.host.spec.getService("affine:embed-linked-doc").slots.linkedDocCreated.emit({docId:i.id}),(0,iV.eD)(e.host,o)})}get _currentSelection(){return this._selection.value}_deleteBlocksBySelection(e){e.forEach(e=>{let t=this._doc.getBlockById(e.blockId);t&&this._doc.deleteBlock(t)})}get _doc(){return this.rootComponent.doc}_replaceBlocksBySelection(e,t,i){let s=e[0],o=this._doc.getBlockById(s.blockId),r=this.rootComponent.host.view.getBlock(s.blockId);(0,H.Z1)(o,`Cannot find block ${s.blockId}`),(0,H.Z1)(r,`Cannot find block view ${s.blockId}`);let a=this._doc.getParent(o),n=a?.children.indexOf(o);this._deleteBlocksBySelection(e);try{this._doc.schema.validate(t,a?.flavour)}catch{return null}let l=this._doc.addBlock(t,i,a,n);return{blockId:l,path:l}}get _selection(){return this.rootComponent.host.selection}}var iR=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},iF=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-page-root")],s=[],o=P.p_,r=[],a=[];return class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;iR(this,null,[(0,D.P)(".affine-page-root-block-container")],{kind:"accessor",name:"rootElementContainer",static:!1,private:!1,access:{has:e=>"rootElementContainer"in e,get:e=>e.rootElementContainer,set:(e,t)=>{e.rootElementContainer=t}},metadata:n},r,a),iR(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` editor-host:has(> affine-page-root, * > affine-page-root) { display: block; height: 100%; } affine-page-root { display: block; height: 100%; } .affine-page-root-block-container { display: flex; flex-direction: column; width: 100%; height: 100%; font-family: var(--affine-font-family); font-size: var(--affine-font-base); line-height: var(--affine-line-height); color: var(--affine-text-primary-color); font-weight: 400; max-width: var(--affine-editor-width); margin: 0 auto; /* cursor: crosshair; */ cursor: default; /* Leave a place for drag-handle */ /* Do not use prettier format this style, or it will be broken */ /* prettier-ignore */ padding-left: var(--affine-editor-side-padding, ${24}px); /* prettier-ignore */ padding-right: var(--affine-editor-side-padding, ${24}px); /* prettier-ignore */ padding-bottom: var(--affine-editor-bottom-padding, ${32}px); } /* Extra small devices (phones, 640px and down) */ @container viewport (width <= 640px) { .affine-page-root-block-container { padding-left: ${24}px; padding-right: ${24}px; } } .affine-block-element { display: block; } @media print { .selected { background-color: transparent !important; } } `}_createDefaultNoteBlock(){let{doc:e}=this,t=e.addBlock("affine:note",{},e.root?.id);return e.getBlockById(t)}_getDefaultNoteBlock(){return this.doc.root?.children.find(e=>"affine:note"===e.flavour)??this._createDefaultNoteBlock()}_initViewportResizeEffect(){let e=this.viewport,t=this.viewportElement;if(!e||!t)return;let i=new ResizeObserver(i=>{for(let{target:s}of i)if(s===t){this.slots.viewportUpdated.emit(e);break}});i.observe(t),this.disposables.add(()=>{i.unobserve(t),i.disconnect()})}connectedCallback(){super.connectedCallback(),this.clipboardController.hostConnected(),this.keyboardManager=new iz(this),this.bindHotKey({"Mod-a":()=>{let e=this.model.children.filter(e=>!!(0,O.op)(e,["affine:note"])&&e.displayMode!==O.ko.EdgelessOnly).flatMap(e=>e.children.map(e=>this.std.selection.create("block",{blockId:e.id})));return this.std.selection.setGroup("note",e),!0},ArrowUp:()=>{let e=this.host.selection.value.find(e=>e.is("text")||e.is("block"));if(!e)return;let t=null,i=(0,O.UL)(this.doc.getBlockById(e.blockId));for(;i.length>0&&!t;){let e=this.doc.getBlockById(i[i.length-1]);e&&"affine:note"===e.flavour&&(t=e),i=i.slice(0,-1)}if(!t)return;let s=this.doc.getPrev(t);if(!s||"affine:note"!==s.flavour){let t=e.is("text")&&0===e.start.index;(e.is("block")||t)&&(0,O.Zr)(this.host);return}if(0!==this.doc.getBlockByFlavour("affine:note").indexOf(s))return;let o=this.std.range.value;requestAnimationFrame(()=>{let e=this.std.range.value;if(o&&e&&o.startContainer===e.startContainer&&o.startOffset===e.startOffset&&o.endContainer===e.endContainer&&o.endOffset===e.endOffset){let e=(0,O.RX)(this.host);e&&e.focusEnd()}})}}),this.handleEvent("click",e=>{var t,i,s,o,r;let a=e.get("pointerState");if(a.raw.target!==this&&a.raw.target!==this.viewportElement&&a.raw.target!==this.rootElementContainer)return;let{paddingLeft:n,paddingRight:l}=window.getComputedStyle(this.rootElementContainer);if(!this.viewport)return;if(t=this.viewport.left,i=this.viewport.clientWidth,s=this.rootElementContainer.clientWidth,o=parseFloat(n),r=parseFloat(l),a.raw.clientXt+(i-s)/2+s-r){this.host.selection.clear(["block"]);return}let c=null,d=this.doc.readonly,h=this.model.children.slice().reverse().find(e=>!!(0,O.op)(e,["affine:note"])&&!!e.displayMode&&e.displayMode!==O.ko.EdgelessOnly);if(h){let e=h.children.at(-1);if(!e||!e.text||(0,O.op)(e,["affine:code","affine:divider","affine:image","affine:database","affine:bookmark","affine:attachment","affine:surface-ref"])||/affine:embed-*/.test(e.flavour)){if(d)return;c=this.doc.addBlock("affine:paragraph",{},h.id)}}else{if(d)return;let e=this.doc.addBlock("affine:note",{},this.model.id);c=this.doc.addBlock("affine:paragraph",{},e)}this.updateComplete.then(()=>{c&&this.host.selection.setGroup("note",[this.host.selection.create("text",{from:{blockId:c,index:0,length:0},to:null})])}).catch(console.error)})}disconnectedCallback(){super.disconnectedCallback(),this.clipboardController.hostDisconnected(),this._disposables.dispose(),this.keyboardManager=null}firstUpdated(){this._initViewportResizeEffect(),this.model.children.filter(e=>(0,O.op)(e,["affine:note"])).forEach(e=>{this.disposables.add(e.propsUpdated.on(({key:e})=>{"displayMode"===e&&this.requestUpdate()}))})}renderBlock(){let e=(0,L.qy)`${(0,t$.u)(this.model.children.filter(e=>{let t=(0,O.op)(e,["affine:note"]),i=!!e.displayMode&&e.displayMode===O.ko.EdgelessOnly;return!(t&&i)}),e=>e.id,e=>this.host.renderModel(e))}`,t=(0,L.qy)`${(0,t$.u)(Object.entries(this.widgets),([e])=>e,([e,t])=>t)}`;return(0,L.qy)`
${e} ${t}
`}get rootScrollContainer(){return(0,iZ.B)(this)}get slots(){return this.service.slots}get viewport(){if(!this.viewportElement)return null;let{scrollLeft:e,scrollTop:t,scrollWidth:i,scrollHeight:s,clientWidth:o,clientHeight:r}=this.viewportElement,{top:a,left:n}=this.viewportElement.getBoundingClientRect();return{top:a,left:n,scrollLeft:e,scrollTop:t,scrollWidth:i,scrollHeight:s,clientWidth:o,clientHeight:r}}get viewportElement(){return this._viewportElement||(this._viewportElement=this.host.closest(".affine-page-viewport")),this._viewportElement}#iB;get rootElementContainer(){return this.#iB}set rootElementContainer(e){this.#iB=e}constructor(){super(...arguments),this._viewportElement=null,this.clipboardController=new tl(this),this.focusFirstParagraph=()=>{let e=this._getDefaultNoteBlock(),t=e?.children.find(e=>O.op(e,["affine:paragraph","affine:list","affine:code"]));if(t)O.Km(this.host,t.id)?.catch(console.error);else{let t=this.doc.addBlock("affine:paragraph",{},e,0);O.Km(this.host,t)?.catch(console.error)}},this.keyboardManager=null,this.prependParagraphWithText=e=>{let t=this.doc.addBlock("affine:paragraph",{text:e},this._getDefaultNoteBlock(),0);O.Km(this.host,t)?.catch(console.error)},this.#iB=iF(this,r,void 0),iF(this,a)}static{iF(t,s)}},t})();function iq(e,t,i=50){let{scrollHeight:s,clientHeight:o,scrollTop:r}=e,a=r,n=s-o,l=0,c=!1;return Math.ceil(r)0&&t0),a+=.25*l,!!c&&r!==a&&(e.scrollTop=a,!0)}var iU=i(59242),iW=i(99971),iG=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},iY=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("affine-drag-preview")],r=[],a=P.ao,n=[],l=[],c=[],d=[];return class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],iG(this,null,i,{kind:"accessor",name:"onRemove",static:!1,private:!1,access:{has:e=>"onRemove"in e,get:e=>e.onRemove,set:(e,t)=>{e.onRemove=t}},metadata:h},n,l),iG(this,null,s,{kind:"accessor",name:"template",static:!1,private:!1,access:{has:e=>"template"in e,get:e=>e.template,set:(e,t)=>{e.template=t}},metadata:h},c,d),iG(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h}),iY(t,r)}constructor(e){super(),iY(this,d),this.offset=e??new u.b(0,0)}disconnectedCallback(){this.onRemove&&this.onRemove(),super.disconnectedCallback()}render(){return(0,L.qy)`${this.template}`}#i$=iY(this,n,null);get onRemove(){return this.#i$}set onRemove(e){this.#i$=e}#F=(iY(this,l),iY(this,c,null));get template(){return this.#F}set template(e){this.#F=e}},t})();var iX=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},iQ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-drop-indicator")],s=[],o=L.WF,r=[],a=[];return class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;iX(this,null,[(0,D.MZ)({attribute:!1})],{kind:"accessor",name:"rect",static:!1,private:!1,access:{has:e=>"rect"in e,get:e=>e.rect,set:(e,t)=>{e.rect=t}},metadata:n},r,a),iX(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` .affine-drop-indicator { position: absolute; top: 0; left: 0; background: var(--affine-primary-color); transition-property: height, transform; transition-duration: 100ms; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-delay: 0s; transform-origin: 0 0; pointer-events: none; z-index: 2; } `}render(){if(!this.rect)return null;let{left:e,top:t,width:i,height:s}=this.rect,o=(0,Z.W)({width:`${i}px`,height:`${s}px`,top:`${t}px`,left:`${e}px`});return(0,L.qy)`
`}#L=iQ(this,r,null);get rect(){return this.#L}set rect(e){this.#L=e}constructor(){super(...arguments),iQ(this,a)}static{iQ(t,s)}},t})();class i1{constructor(){this.optionMap=new Map}_decreaseOptionCount(e){let t=this.optionMap.get(e)||0;t>1?this.optionMap.set(e,t-1):this.optionMap.delete(e)}_getExistingOptionWithSameFlavour(e){return Array.from(this.optionMap.keys()).find(t=>t.flavour===e.flavour)}getOption(e){return this.options.find(t=>"string"==typeof t.flavour?t.flavour===e:t.flavour.test(e))}register(e){let t=this._getExistingOptionWithSameFlavour(e)||e,i=this.optionMap.get(t)||0;return this.optionMap.set(t,i+1),{dispose:()=>{this._decreaseOptionCount(t)}}}get options(){return Array.from(this.optionMap.keys())}}let i0=(0,L.AH)` .affine-drag-handle-widget { display: flex; position: absolute; left: 0; top: 0; contain: size layout; } .affine-drag-handle-container { top: 0; left: 0; position: absolute; display: flex; justify-content: center; width: ${16}px; min-height: 12px; pointer-events: auto; user-select: none; box-sizing: border-box; } .affine-drag-handle-container:hover { cursor: grab; } .affine-drag-handle-grabber { width: 4px; height: 100%; border-radius: 1px; background: var(--affine-placeholder-color); transition: width 0.25s ease; } @media print { .affine-drag-handle-widget { display: none; } } .affine-drag-hover-rect { position: absolute; top: 0; left: 0; border-radius: 6px; background: var(--affine-hover-color); pointer-events: none; z-index: 2; animation: expand 0.25s forwards; } @keyframes expand { 0% { width: 0; height: 0; } } `;var i2=i(13428);let i5={text:23,h1:40,h2:36,h3:32,h4:32,h5:28,h6:26,quote:46,list:24,database:28,image:28,divider:36},i7=e=>{let t=e.flavour,i=t.indexOf(":"),s=t.slice(i+1);return"paragraph"===s&&e.type&&(s=e.type),i5[s]??24},i3=(e,t)=>e.some(e=>{let i=e.path;return P.yX.includes(t,i)}),i4=(e,t)=>e.some(e=>e===t),i6=e=>!!e.closest(".affine-database-block-table"),i8=e=>e instanceof Element||e instanceof Node?e instanceof Element?e:e.parentElement:null,i9=e=>{let t=e;for(;t&&"affine:note"!==t.flavour;)t=t.parentBlock;return t.model.id},se=e=>e.some(e=>"text"===e.type),st=(e,t)=>!!e&&!!t&&e===t,si=(e,t,i,s)=>{let o=t.getBoundingClientRect(),r=(0,O.zU)(e),a=(24+(r?0:20))*s;return!o||(r?i.yo.bottom||i.x>o.right+a:i.yo.bottom||i.xo.right+a)},ss=(e,t,i)=>(0,O.zU)(e)?(0,O.H1)(t,i,"affine-note"):O.jl(i)?.closest("affine-edgeless-note"),so=(e,t,i)=>{let s=ss(e,t,i);if(!s||s.closest(".affine-surface-ref"))return null;let o=O.rw.fromDOM(s),r=(0,O.hF)(i,{container:s,rect:o}),a=r&&P.yX.includes(r.path,s.path)?r:(0,O.H1)(s,i.clone(),".affine-note-block-container > .affine-block-children-container > [data-block-id]");return!a||a.closest(".surface-ref-note-portal")?null:a};function sr(e,t,i,s,o,r=!0){let a="none",n=3*o,{rect:l}=(0,O.$$)(e,t,i),c=Math.abs(l.top-e.y),d=Math.abs(l.bottom-e.y),h=4;if("before"==(a=cl.x+eh.s6&&(a="in"),(o=i.nextElementSibling)?"after"===a&&s.length&&o===s[0]&&(a="none",o=null):o=O.N8(i.parentElement)?.nextElementSibling,o&&(h=((0,O.wH)(o).top-l.bottom)/2)}if("none"===a)return null;let u=l.top;return"before"===a?u-=h:u+=l.height+h,"in"===a&&(l.x+=eh.s6,l.width-=eh.s6),{rect:O.rw.fromLWTH(l.left,l.width,u-n/2,n),dropBlockId:t.id,dropType:a}}let sa=(e,t=1)=>{let i=null,s=new u.b(e.x,e.y),o=(0,O.hF)(s);if(!o)return i;let r=o.model;if((0,O.op)(r,["affine:database"]))return i;let a=sr(s,r,o,[],t);return a&&(i=a),i},sn=[];function sl(e=[]){let t="with-drag-handle";sn.forEach(e=>e.classList.remove(t)),sn=e,e.forEach(e=>e.classList.add(t))}function sc(e){return e.map(e=>({flavour:e.flavour,blockProps:(0,i2.i)(e)}))}function sd({blockComponent:e,dragPreview:t,cssSelector:i,width:s,height:o,noteScale:r,state:a}){let n=e.closest("affine-edgeless-root");if(!n)return!1;let l=t.querySelector(i);if(!l)return!1;let c=l.getBoundingClientRect(),{left:d,top:h}=n.viewport,u=new p.z(c.x-d,c.y-h,c.width+2/r,c.height+2/r),f=n.service.viewport.toModelBound(u),g=(0,tE.v8)(e.model)?new p.z(f.x,f.y,(f.w??s)*r,(f.h??o)*r):new p.z(f.x,f.y,(s??f.w)*r,(o??f.h)*r),m=e.model,v=(0,i2.i)(m),y=n.service.addBlock(e.flavour,{...v,xywh:g.serialize()},n.surfaceBlockModel),b=n.service.getElementById(y);(0,tE.v8)(b)&&n.service.updateElement(b.id,{scale:r});let w=e.doc,x=e.host;return a.raw.altKey||(w.deleteBlock(m),x.selection.setGroup("note",[])),n.service.selection.set({elements:[y],editing:!1}),!0}function sh({blockComponent:e,dropBlockId:t,dropType:i,state:s,style:o}){let r=e.doc,a=e.host,n=r.getBlockById(t);if(!n)return!1;let l="in"===i,c=l?n:r.getParent(n);(0,H.Z1)(c);let d=l?0:c.children.indexOf(n)+("after"===i?1:0),h=e.model,{width:u,height:p,xywh:f,rotate:g,zIndex:m,...v}=(0,i2.i)(h);return o&&(v.style=o),r.addBlock(h.flavour,v,c,d),s.raw.altKey||(r.deleteBlock(h),a.selection.setGroup("gfx",[])),!0}var su=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sp=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)(sf)],a=[],n=P.W,l=[],c=[],d=[],h=[],g=[],m=[];var v=class extends n{static{t=this}static{let u="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.P)(".affine-drag-handle-container")],s=[(0,D.P)(".affine-drag-handle-grabber")],o=[(0,D.wk)()],su(this,null,i,{kind:"accessor",name:"_dragHandleContainer",static:!1,private:!1,access:{has:e=>"_dragHandleContainer"in e,get:e=>e._dragHandleContainer,set:(e,t)=>{e._dragHandleContainer=t}},metadata:u},l,c),su(this,null,s,{kind:"accessor",name:"_dragHandleGrabber",static:!1,private:!1,access:{has:e=>"_dragHandleGrabber"in e,get:e=>e._dragHandleGrabber,set:(e,t)=>{e._dragHandleGrabber=t}},metadata:u},d,h),su(this,null,o,{kind:"accessor",name:"_dragHoverRect",static:!1,private:!1,access:{has:e=>"_dragHoverRect"in e,get:e=>e._dragHoverRect,set:(e,t)=>{e._dragHoverRect=t}},metadata:u},g,m),su(null,e={value:t},r,{kind:"class",name:t.name,metadata:u},null,a),v=t=e.value,u&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:u})}static{this.staticOptionRunner=new i1}static{this.styles=i0}static registerOption(e){return v.staticOptionRunner.register(e)}_clearRaf(){this.rafID&&(cancelAnimationFrame(this.rafID),this.rafID=0)}_getHoverAreaRectTopLevelBlock(e){if((0,O.zU)(this.host))return null;let t=this.rootComponent,i=(0,tE.Ql)([e]),[s,o]=t.service.viewport.toViewCoord(i.left,i.top),[r,a]=[s+i.width*this.scale,o+i.height*this.scale],n=5*this.scale,l=6*this.scale;return s-=8*this.scale+n,o-=l,r+=l,a+=l,new O.rw(s,o,r,a)}get _rangeManager(){return this.std.range}get dragHandleContainerOffsetParent(){return this._dragHandleContainer.parentElement}get scrollContainer(){return(0,iZ.B)(this.rootComponent)}connectedCallback(){super.connectedCallback(),this.disposables.addFromEvent(this,"pointerdown",e=>{e.preventDefault()}),this.handleEvent("pointerMove",this._throttledPointerMoveHandler),this.handleEvent("click",this._clickHandler),this.handleEvent("dragStart",this._dragStartHandler),this.handleEvent("dragMove",this._dragMoveHandler),this.handleEvent("dragEnd",this._dragEndHandler,{global:!0}),this.handleEvent("pointerOut",this._pointerOutHandler),this.handleEvent("beforeInput",()=>this._hide()),this.handleEvent("keyDown",this._keyboardHandler,{global:!0}),this.handleEvent("keyUp",this._keyboardHandler,{global:!0})}disconnectedCallback(){this._hide(!0),this._disposables.dispose(),this._anchorModelDisposables?.dispose(),super.disconnectedCallback()}firstUpdated(){if(this._hide(!0),this._disposables.addFromEvent(this._dragHandleContainer,"pointerenter",this._onDragHandlePointerEnter),this._disposables.addFromEvent(this._dragHandleContainer,"pointerdown",this._onDragHandlePointerDown),this._disposables.addFromEvent(this._dragHandleContainer,"pointerup",this._onDragHandlePointerUp),this._disposables.addFromEvent(this._dragHandleContainer,"pointerleave",this._onDragHandlePointerLeave),this._disposables.addFromEvent(this.host,"pointerleave",()=>{this._hide()}),(0,O.zU)(this.host)){this._disposables.add(this.doc.slots.blockUpdated.on(()=>this._hide()));let e=this.rootComponent;this._disposables.add(e.slots.viewportUpdated.on(()=>{this._hide(),this.dropIndicator&&(this.dropIndicator.rect=null)})),this._disposables.addFromEvent(this.scrollContainer,"scrollend",this._updateDropIndicatorOnScroll)}else if((0,O.Ar)(this.host)){let e=this.rootComponent;this._disposables.add(e.slots.edgelessToolUpdated.on(this._handleEdgelessToolUpdated)),this._disposables.add(e.service.viewport.viewportUpdated.on(this._handleEdgelessViewPortUpdated)),this._disposables.add(e.service.selection.slots.updated.on(()=>{this._checkTopLevelBlockSelection()})),this._disposables.add(e.slots.readonlyUpdated.on(()=>{this._checkTopLevelBlockSelection()})),this._disposables.add(e.slots.draggingAreaUpdated.on(()=>{this._checkTopLevelBlockSelection()})),this._disposables.add(e.slots.elementResizeStart.on(()=>{this._hide()})),this._disposables.add(e.slots.elementResizeEnd.on(()=>{this._checkTopLevelBlockSelection()}))}}render(){let e=(0,Z.W)(this._dragHoverRect?{width:`${this._dragHoverRect.width}px`,height:`${this._dragHoverRect.height}px`,top:`${this._dragHoverRect.top}px`,left:`${this._dragHoverRect.left}px`}:{display:"none"});return(0,L.qy)`
`}get anchorBlockComponent(){return this._anchorBlockPath?this._getBlockComponentFromViewStore(this._anchorBlockPath):null}get anchorEdgelessElement(){if((0,O.zU)(this.host)||!this._anchorBlockId)return null;let{service:e}=this.rootComponent,t=e.getElementById(this._anchorBlockId);return(0,tE.Te)(t)?t:null}get optionRunner(){return v.staticOptionRunner}get rootComponent(){return this.block}get selectedBlocks(){return this.host.selection.find("text")?this.host.selection.filter("text"):this.host.selection.filter("block")}#iT;get _dragHandleContainer(){return this.#iT}set _dragHandleContainer(e){this.#iT=e}#iO;get _dragHandleGrabber(){return this.#iO}set _dragHandleGrabber(e){this.#iO=e}#iP;get _dragHoverRect(){return this.#iP}set _dragHoverRect(e){this.#iP=e}constructor(){super(...arguments),this._anchorBlockId="",this._anchorBlockPath=null,this._anchorModelDisposables=null,this._calculatePreviewOffset=(e,t)=>{let{top:i,left:s}=e[0].getBoundingClientRect();return new u.b(t.raw.x-s,t.raw.y-i)},this._calculateQuery=e=>{let t=e.map(e=>({id:e,viewType:f.lv.Display}));e.map(i=>{let s=i;do e.includes(s)||t.push({viewType:f.lv.Bypass,id:s}),s=this.doc.blockCollection.crud.getParent(s);while(s&&!t.map(({id:e})=>e).includes(s))});let i=e=>{(this.doc.getBlock(e)?.model.children??[]).forEach(e=>{t.push({viewType:f.lv.Display,id:e.id}),i(e.id)})};return e.forEach(i),{match:t,mode:"strict"}},this._canEditing=e=>{if(e.doc.id!==this.doc.id)return!1;if((0,O.zU)(this.host))return!0;let t=this.rootComponent,i=e.path[e.path.length-1];return t.service.selection.editing&&t.service.selection.selectedIds[0]===i},this._changeCursorToGrabbing=()=>{document.documentElement.classList.add("affine-drag-preview-grabbing")},this._checkTopLevelBlockSelection=()=>{if(!this.isConnected)return;if(this.doc.readonly||(0,O.zU)(this.host)){this._hide();return}let e=this.rootComponent,t=e.service.selection.editing,i=e.service.selection.selectedElements;if(t||1!==i.length){this._hide();return}let s=i[0];if(!(0,tE.Te)(s)){this._hide();return}let o=s.flavour,r=this.optionRunner.getOption(o);if(!r||!r.edgeless){this._hide();return}let a=e.service.selection.surfaceSelections;this._anchorBlockId=s.id,this._anchorBlockPath=a[0].blockId,this._showDragHandleOnTopLevelBlocks().catch(console.error)},this._clickHandler=e=>{if(!this._isHoverDragHandleVisible)return;let{target:t}=e.get("pointerState").raw,i=i8(t);if(!i?.closest(sf)||!this._anchorBlockId||!this._anchorBlockPath)return;let{selection:s}=this.host,o=this.selectedBlocks;if(o.length>0&&!se(o)&&o[0].blockId===this._anchorBlockId){s.clear(["block"]),this._dragHoverRect=null,this._showDragHandleOnHoverBlock(this._anchorBlockPath);return}let r=this.anchorBlockComponent;r&&(o.length>1&&this._showDragHandleOnHoverBlock(this._anchorBlockPath),this._setSelectedBlocks([r]))},this._createDragPreview=(e,t,i,s)=>{let o;if(i)(o=new iK(s)).append(i);else{let i=0;e.forEach(e=>{i=Math.max(i,e.getBoundingClientRect().width)});let s=e.map(e=>e.model.id),r=this._calculateQuery(s),a=this.doc.blockCollection.getDoc({query:r}),n=iU.f.getInstance().getSpec("page:preview"),l=this.host.renderSpecPortal(a,n.value),c=this._calculatePreviewOffset(e,t),d=t.raw.x-c.x,h=t.raw.y-c.y,u=t.raw.altKey;(o=new iK(c)).template=l,o.onRemove=()=>{this.doc.blockCollection.clearQuery(r)},o.style.width=`${i/this.scale/this.noteScale/this.cumulativeParentScale}px`,o.style.transform=`translate(${d}px, ${h}px) scale(${this.scale*this.noteScale})`,o.style.opacity=u?"1":"0.5"}return this.rootComponent.append(o),o},this._createDropIndicator=()=>{this.dropIndicator||(this.dropIndicator=new iJ,this.rootComponent.append(this.dropIndicator))},this._dragEndHandler=e=>{if(this._clearRaf(),!this.dragging||!this.dragPreview)return!1;if(0===this.draggingElements.length||this.doc.readonly)return this._hide(!0),!1;let t=e.get("pointerState"),{target:i}=t.raw;if(!this.host.contains(i))return this._hide(!0),!0;for(let e of this.optionRunner.options)if(e.onDragEnd?.({state:t,draggingElements:this.draggingElements,dropBlockId:this.dropBlockId,dropType:this.dropType,dragPreview:this.dragPreview,noteScale:this.noteScale,editorHost:this.host}))return this._hide(!0),(0,O.Ar)(this.host)&&this._checkTopLevelBlockSelection(),!0;return this._onDragEnd(t),(0,O.Ar)(this.host)&&this._checkTopLevelBlockSelection(),!0},this._dragMoveHandler=e=>{if((this._isHoverDragHandleVisible||this._isTopLevelDragHandleVisible)&&this._hide(),!this.dragging||0===this.draggingElements.length)return!1;e.get("defaultState").event.preventDefault();let t=e.get("pointerState");for(let e of this.optionRunner.options)if(e.onDragMove?.(t,this.draggingElements))return!0;return this._onDragMove(t)},this._dragStartHandler=e=>{let t=e.get("pointerState"),{button:i}=t.raw;if(0!==i)return!1;for(let e of this.optionRunner.options)if(e.onDragStart?.({state:t,startDragging:this._startDragging,anchorBlockId:this._anchorBlockId,anchorBlockPath:this._anchorBlockPath,editorHost:this.host}))return!0;return this._onDragStart(t)},this._getBlockComponentFromViewStore=e=>this.host.view.getBlock(e),this._getDraggingAreaRect=e=>{let{left:t,top:i,right:s,bottom:o}=e.getBoundingClientRect(),r=this._getHoveredBlocks();r.forEach(e=>{t=Math.min(t,e.getBoundingClientRect().left),i=Math.min(i,e.getBoundingClientRect().top),s=Math.max(s,e.getBoundingClientRect().right),o=Math.max(o,e.getBoundingClientRect().bottom)});let a=r.some(e=>(0,O.op)(e.model,["affine:list"])&&e.model.children.length>0)?18:2,n=this.dragHandleContainerOffsetParent.getBoundingClientRect();return n?(t-=n.left,s-=n.left,i-=n.top,o-=n.top,t/=this.cumulativeParentScale,s/=this.cumulativeParentScale,i/=this.cumulativeParentScale,o/=this.cumulativeParentScale,t-=(16+a)*this.scale*this.noteScale,i-=4*this.scale,s+=4*this.scale,o+=4*this.scale,new O.rw(t,i,s,o)):new O.rw(0,0,0,0)},this._getDropResult=e=>{let t=new u.b(e.raw.x,e.raw.y),i=so(this.host,this.rootComponent,t);if(!i)return null;let s=i.model.id,o=i.path,r=i.model;if((0,O.op)(r,["affine:database"]))return null;let a=1===this.draggingElements.length&&(0,O.op)(this.draggingElements[0].model,["affine:note"]);if(a){let e=this.std.doc.getParent(i.model);if(!e)return null;let t=this._getBlockComponentFromViewStore(e.id);if(!t||!(0,O.op)(t.model,["affine:note"]))return null}if(i4(this.draggingElements.map(e=>e.model.id),s)||i3(this.draggingElements,o))return null;let n=null,l="before",c=sr(t,r,i,this.draggingElements,this.scale*this.cumulativeParentScale,!1===a);return(c&&(n=c.rect,l=c.dropType),a&&"in"===l)?null:{rect:n,dropBlockId:s,dropType:l}},this._getHoveredBlocks=()=>{if(!this._isHoverDragHandleVisible||!this._anchorBlockPath)return[];let e=this.anchorBlockComponent;if(!e)return[];let t=this.selectedBlocks,i=[];if(t.length>0&&se(t)){let e=(0,O.oV)();if(!e||!this._rangeManager)return[];i=this._rangeManager.getSelectedBlockComponentsByRange(e,{match:e=>"content"===e.model.role,mode:"highest"})}else i=this.selectedBlocks.map(e=>this._getBlockComponentFromViewStore(e.blockId)).filter(e=>!!e);return i4(i.map(e=>P.yX.id(e.path)),this._anchorBlockPath)?i:[e]},this._getTopWithBlockComponent=e=>{let t=getComputedStyle(e),{top:i}=e.getBoundingClientRect();return(i+parseInt(t.paddingTop)*this.scale-this.dragHandleContainerOffsetParent.getBoundingClientRect().top)/this.cumulativeParentScale},this._handleAnchorModelDisposables=e=>{this._anchorModelDisposables&&(this._anchorModelDisposables.dispose(),this._anchorModelDisposables=null),this._anchorModelDisposables=new eg.K,this._anchorModelDisposables.add(e.propsUpdated.on(()=>this._hide())),this._anchorModelDisposables.add(e.deleted.on(()=>this._hide()))},this._handleEdgelessToolUpdated=e=>{"default"===e.type?this._checkTopLevelBlockSelection():this._hide()},this._handleEdgelessViewPortUpdated=({zoom:e,center:t})=>{this.scale!==e&&(this.scale=e,this._updateDragPreviewOnViewportUpdate()),this.center[0]!==t[0]&&this.center[1]!==t[1]&&(this.center=[...t],this._updateDropIndicatorOnScroll()),this._isTopLevelDragHandleVisible?(this._showDragHandleOnTopLevelBlocks().catch(console.error),this._updateDragHoverRectTopLevelBlock()):this._hide()},this._hide=(e=!1)=>{sl(),this._isHoverDragHandleVisible=!1,this._isTopLevelDragHandleVisible=!1,this._isDragHandleHovered=!1,this._anchorBlockId="",this._anchorBlockPath=null,this._dragHandleContainer&&(this._dragHandleContainer.style.display="none"),e&&this._reset()},this._isBlockSelected=e=>!!e&&this.selectedBlocks.some(t=>t.blockId===e.model.id),this._isDragHandleHovered=!1,this._isHoverDragHandleVisible=!1,this._isTopLevelDragHandleVisible=!1,this._keyboardHandler=e=>{if(!this.dragging||!this.dragPreview)return;let t=e.get("defaultState").event;t.preventDefault(),t.stopPropagation();let i="Alt"===t.key&&t.altKey;this.dragPreview.style.opacity=i?"1":"0.5"},this._lastHoveredBlockPath=null,this._lastShowedBlock=null,this._onDragEnd=e=>{let t=this.dropBlockId,i=this.dropType,s=this.draggingElements;if(this._hide(!0),!t){let t=i8(e.raw.target);if(!t||!t.classList.contains("edgeless-container"))return!1;let i=(0,O.bL)(s).map(e=>(0,O.BE)(e)).filter(e=>!!e);if(0===i.length)return!1;if(i.some(e=>{let t=this.doc.getParent(e.id);return(0,O.op)(t,["affine:surface"])}))return!0;let o=this.rootComponent,{left:r,top:a}=o.viewport,n=o.addNoteWithPoint(new u.b(e.raw.x-r,e.raw.y-a),{scale:this.noteScale}),l=this.doc.getBlockById(n);if(!l)return;let c=p.z.deserialize(l.xywh);if(c.h*=this.noteScale,c.w*=this.noteScale,this.doc.updateBlock(l,{xywh:c.serialize(),edgeless:{...l.edgeless,scale:this.noteScale}}),e.raw.altKey){let e=sc(i);this.doc.addBlocks(e,l)}else this.doc.moveBlocks(i,l);return o.service.selection.set({elements:[l.id],editing:!0}),!0}if(i4(this.selectedBlocks.map(e=>e.blockId),t))return!1;let o=(0,O.bL)(s).map(e=>(0,O.BE)(e)).filter(e=>!!e);if(!o.length)return!1;let r=this.doc.getBlockById(t);if(!r)return;let a="in"===i,n=a?r:this.doc.getParent(t);if(!n)return;let l=e.raw.altKey;if(a){if(l){let e=sc(o);this.doc.addBlocks(e,r)}else this.doc.moveBlocks(o,r)}else if(l){let e=sc(o),t=n.children.indexOf(r)+("after"===i?1:0);this.doc.addBlocks(e,n,t)}else this.doc.moveBlocks(o,n,r,"before"===i);return setTimeout(()=>{if(!n)return;let e=this._getBlockComponentFromViewStore(n.id);if(e){let t=o.map(e=>this.std.view.getBlock(e.id));if(!t)return;let i=i9(e);this._setSelectedBlocks(t,i)}},0),!0},this._onDragHandlePointerDown=()=>{if(!this._isHoverDragHandleVisible||!this._anchorBlockPath)return;let e=this.anchorBlockComponent;e&&(this._dragHoverRect=this._getDraggingAreaRect(e)??null)},this._onDragHandlePointerEnter=()=>{let e=this._dragHandleContainer,t=this._dragHandleGrabber;if(e&&t){if(this._isHoverDragHandleVisible&&this._anchorBlockPath){if(!this.anchorBlockComponent)return;let i=8*this.scale;e.style.paddingTop=`${i}px`,e.style.paddingBottom=`${i}px`,e.style.transition="padding 0.25s ease",t.style.width=`${2*this.scale*this.noteScale}px`,t.style.borderRadius=`${4*this.scale*this.noteScale}px`,this._isDragHandleHovered=!0}else if(this._isTopLevelDragHandleVisible){let e=this.anchorEdgelessElement;if(!e)return;this._dragHoverRect=this._getHoverAreaRectTopLevelBlock(e),this._isDragHandleHovered=!0}}},this._onDragHandlePointerLeave=()=>{this._isDragHandleHovered=!1,this._dragHoverRect=null,this._isTopLevelDragHandleVisible||this.dragging||!this._anchorBlockPath||this._showDragHandleOnHoverBlock(this._anchorBlockPath)},this._onDragHandlePointerUp=()=>{this._isHoverDragHandleVisible&&(this._dragHoverRect=null)},this._onDragMove=e=>(this._clearRaf(),this.rafID=requestAnimationFrame(()=>{this._updateDragPreviewPosition(e),this._updateDropIndicator(e,!0)}),!0),this._onDragStart=e=>{let{target:t}=e.raw,i=i8(t);if(!i?.closest(sf))return this._hide(),!1;if(!this._isHoverDragHandleVisible||!this._anchorBlockId||!this._anchorBlockPath)return;if(!this.anchorBlockComponent)return!1;let s=this.selectedBlocks;if(s.length>0&&se(s)){let e=document.getSelection();if(e&&e.rangeCount>0&&this._rangeManager){let t=e.getRangeAt(0),i=this._rangeManager.getSelectedBlockComponentsByRange(t,{match:e=>"content"===e.model.role,mode:"highest"});this._setSelectedBlocks(i),s=this.selectedBlocks}}if(0===s.length||!i4(s.map(e=>e.blockId),this._anchorBlockId)){let e=this.anchorBlockComponent;e&&this._setSelectedBlocks([e])}let o=this.selectedBlocks.map(e=>this._getBlockComponentFromViewStore(e.blockId)).filter(e=>!!e),r=(0,O.bL)(o);return 0!==r.length&&(this._startDragging(r,e),this._hide(),!0)},this._pointerMoveOnBlock=e=>{if(this._isTopLevelDragHandleVisible)return;let t=new u.b(e.raw.x,e.raw.y),i=so(this.host,this.rootComponent,t);if(!i){this._anchorBlockId="",this._anchorBlockPath=null;return}let s=i.getAttribute(this.host.blockIdAttr);if(s){if(this._anchorBlockId=s,this._anchorBlockPath=i.blockId,i6(i)||this.doc.readonly){this._hide();return}this._lastHoveredBlockPath&&st(this._anchorBlockPath,this._lastHoveredBlockPath)&&this._isHoverDragHandleVisible||this._isDragHandleHovered||(this._showDragHandleOnHoverBlock(this._anchorBlockPath),this._lastHoveredBlockPath=this._anchorBlockPath)}},this._pointerOutHandler=e=>{let t=e.get("pointerState");t.raw.preventDefault();let{target:i}=t.raw,s=i8(i);if(!s)return;let{relatedTarget:o}=t.raw,r=i8(o),a=s.classList.contains("affine-page-viewport"),n=!!r?.closest(".affine-page-viewport"),l=!!r?.closest(sf);!a||l||n||this._hide()},this._removeDragPreview=()=>{this.dragPreview&&(this.dragPreview.remove(),this.dragPreview=null)},this._removeDropIndicator=()=>{this.dropIndicator&&(this.dropIndicator.remove(),this.dropIndicator=null)},this._reset=()=>{this.draggingElements=[],this.dropBlockId="",this.dropType=null,this.lastDragPointerState=null,this.rafID=0,this.dragging=!1,this._dragHoverRect=null,this._lastHoveredBlockPath=null,this._lastShowedBlock=null,this._anchorBlockId="",this._anchorBlockPath=null,this._isHoverDragHandleVisible=!1,this._isDragHandleHovered=!1,this._isTopLevelDragHandleVisible=!1,this._removeDragPreview(),this._removeDropIndicator(),this._resetCursor()},this._resetCursor=()=>{document.documentElement.classList.remove("affine-drag-preview-grabbing")},this._resetDropResult=()=>{this.dropBlockId="",this.dropType=null,this.dropIndicator&&(this.dropIndicator.rect=null)},this._setSelectedBlocks=(e,t)=>{let{selection:i}=this.host,s=e.map(e=>i.create("block",{blockId:e.blockId}));if((0,O.Ar)(this.host)){let o=t||i9(e[0]),r=i.create("surface",e[0].blockId,[o],!0);s.push(r)}i.set(s)},this._showDragHandleOnHoverBlock=e=>{let t=this._getBlockComponentFromViewStore(e);if(!t)return;let i=this._dragHandleContainer,s=this._dragHandleGrabber;if(!i||!s)return;this._isHoverDragHandleVisible=!0;let o=this._getDraggingAreaRect(t),r=i7(t.model);sl([t]);let a=this._getTopWithBlockComponent(t),n=(r-12)/2*this.scale*this.noteScale+a-o.top,l=o.height-n-12*this.scale*this.noteScale;(e=>{i.style.transition=e?"padding 0.25s ease":"none",i.style.paddingTop=`${n}px`,i.style.paddingBottom=`${l}px`,i.style.width=`${16*this.scale*this.noteScale}px`,i.style.left=`${o.left}px`,i.style.top=`${o.top}px`,i.style.display="flex",i.style.height=`${o.height}px`})(!!st(t.blockId,this._lastShowedBlock?.path)||!!this.selectedBlocks.length&&!!this._isBlockSelected(t)&&this._isDragHandleHovered&&this._isBlockSelected(this._lastShowedBlock?.el)),s.style.width=`${4*this.scale*this.noteScale}px`,s.style.borderRadius=`${4*this.scale*this.noteScale}px`,this._handleAnchorModelDisposables(t.model),st(t.blockId,this._lastShowedBlock?.path)||(this._lastShowedBlock={path:t.blockId,el:t})},this._showDragHandleOnTopLevelBlocks=async()=>{if((0,O.zU)(this.host))return;let e=this.rootComponent;if(await e.surface.updateComplete,!this._anchorBlockPath)return;let t=this.anchorBlockComponent;if(!t)return;let i=e.service.getElementById(t.model.id);if(!i)return;let s=this._dragHandleContainer,o=this._dragHandleGrabber;if(!s||!o)return;let r=(0,tE.Ql)([i]),[a,n]=e.service.viewport.toViewCoord(r.left,r.top),l=r.height*this.scale,c=a-13*this.scale;s.style.transition="none",s.style.paddingTop="0px",s.style.paddingBottom="0px",s.style.width=`${8*this.scale}px`,s.style.left=`${c}px`,s.style.top=`${n}px`,s.style.display="flex",s.style.height=`${l}px`,o.style.width=`${2*this.scale}px`,o.style.borderRadius=`${4*this.scale}px`,this._handleAnchorModelDisposables(t.model),this._isTopLevelDragHandleVisible=!0},this._startDragging=(e,t,i,s)=>{e.length&&(this.draggingElements=e,this.dragPreview&&this._removeDragPreview(),this.dragPreview=this._createDragPreview(e,t,i,s),this.dragging=!0,this._changeCursorToGrabbing(),this._createDropIndicator(),this._hide())},this._throttledPointerMoveHandler=(0,td.nF)(e=>{if(this.doc.readonly||this.dragging||!this.isConnected){this._hide();return}if(this._isTopLevelDragHandleVisible)return;let t=e.get("pointerState"),{target:i}=t.raw,s=i8(i);if(!s||s.closest(".affine-drag-handle-container"))return;let o=new u.b(t.raw.x,t.raw.y),r=ss(this.host,this.rootComponent,o);return(this.noteScale=(0,O.zU)(this.host)?1:r?.model.edgeless.scale??1,r&&this._canEditing(r)&&!si(this.host,r,o,this.scale*this.noteScale))?(this._pointerMoveOnBlock(t),!0):(this._hide(),!1)},1e3/60),this._updateDragHoverRectTopLevelBlock=()=>{if(!this._dragHoverRect)return;let e=this.anchorEdgelessElement;e&&(this._dragHoverRect=this._getHoverAreaRectTopLevelBlock(e))},this._updateDragPreviewOnViewportUpdate=()=>{this.dragPreview&&this.lastDragPointerState&&this._updateDragPreviewPosition(this.lastDragPointerState)},this._updateDragPreviewPosition=e=>{if(!this.dragPreview)return;let t=this.dragHandleContainerOffsetParent.getBoundingClientRect(),i=this.dragPreview.offset,s=e.raw.x-i.x-t.left;s/=this.cumulativeParentScale;let o=e.raw.y-i.y-t.top;o/=this.cumulativeParentScale,this.dragPreview.style.transform=`translate(${s}px, ${o}px) scale(${this.scale*this.noteScale})`;let r=e.raw.altKey;this.dragPreview.style.opacity=r?"1":"0.5"},this._updateDropIndicator=(e,t=!1)=>{let i=new u.b(e.raw.x,e.raw.y),s=ss(this.host,this.rootComponent,i);if(!s||si(this.host,s,i,this.scale))this._resetDropResult();else{let t=this._getDropResult(e);this._updateDropResult(t)}if(this.lastDragPointerState=e,this.rootComponent instanceof iN){if(!t)return;if(!iq(this.scrollContainer,e.raw.y)){this._clearRaf();return}this.rafID=requestAnimationFrame(()=>this._updateDropIndicator(e,!0))}else this._clearRaf()},this._updateDropIndicatorOnScroll=()=>{if(!this.dragging||0===this.draggingElements.length||!this.lastDragPointerState)return;let e=this.lastDragPointerState;this.rafID=requestAnimationFrame(()=>this._updateDropIndicator(e,!1))},this._updateDropResult=e=>{if(this.dropIndicator){if(this.dropBlockId=e?.dropBlockId??"",this.dropType=e?.dropType??null,e?.rect){let t=this.dragHandleContainerOffsetParent.getBoundingClientRect(),{left:i,top:s}=e.rect;i-=t.left,s-=t.top,i/=this.cumulativeParentScale,s/=this.cumulativeParentScale;let{width:o,height:r}=e.rect;o/=this.cumulativeParentScale,r/=this.cumulativeParentScale;let a=O.rw.fromLWTH(i,o,s,r);this.dropIndicator.rect=a}else this.dropIndicator.rect=e?.rect??null}},this.center=[0,0],this.cumulativeParentScale=1,this.dragPreview=null,this.dragging=!1,this.draggingElements=[],this.dropBlockId="",this.dropIndicator=null,this.dropType=null,this.lastDragPointerState=null,this.noteScale=1,this.rafID=0,this.scale=1,this.#iT=sp(this,l,void 0),this.#iO=(sp(this,c),sp(this,d,void 0)),this.#iP=(sp(this,h),sp(this,g,null)),sp(this,m)}static{sp(t,a)}};return v=t})();var sm=i(69849),sv=i(67066),sy=i(8834),sb=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sw=function(e,t,i){for(var s=arguments.length>2,o=0;o0?1:-1}for(let l=0;lMath.abs(l-o)&&r?10+a*n(l):10+((Math.ceil(Math.abs(l-o))-1)*(e+24)+a)*n(l):10+Math.ceil(Math.abs(l-o))*(e+i)*n(l),s.push([0,t])}return s}function s_(e,t){let i=(0,L.AH)` .index-label-tooltip { display: flex; align-items: center; flex-wrap: nowrap; gap: 10px; } .index-label-tooltip-icon { display: flex; align-items: center; justify-content: center; } .index-label-tooltip-content { font-size: var(--affine-font-sm); display: flex; height: 16px; line-height: 16px; } `;return(0,L.qy)`
${e} ${t}
`}let sC="affine-edgeless-auto-connect-widget";(()=>{let e,t,i,s,o,r,a=[(0,D.EM)(sC)],n=[],l=P.W,c=[],d=[],h=[],u=[],f=[],g=[],m=[],v=[];(class extends l{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.wk)()],sb(this,null,i,{kind:"accessor",name:"_edgelessOnlyNotesSet",static:!1,private:!1,access:{has:e=>"_edgelessOnlyNotesSet"in e,get:e=>e._edgelessOnlyNotesSet,set:(e,t)=>{e._edgelessOnlyNotesSet=t}},metadata:p},c,d),sb(this,null,s,{kind:"accessor",name:"_index",static:!1,private:!1,access:{has:e=>"_index"in e,get:e=>e._index,set:(e,t)=>{e._index=t}},metadata:p},h,u),sb(this,null,o,{kind:"accessor",name:"_pageVisibleElementsMap",static:!1,private:!1,access:{has:e=>"_pageVisibleElementsMap"in e,get:e=>e._pageVisibleElementsMap,set:(e,t)=>{e._pageVisibleElementsMap=t}},metadata:p},f,g),sb(this,null,r,{kind:"accessor",name:"_show",static:!1,private:!1,access:{has:e=>"_show"in e,get:e=>e._show,set:(e,t)=>{e._show=t}},metadata:p},m,v),sb(null,e={value:t},a,{kind:"class",name:t.name,metadata:p},null,n),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=(0,L.AH)` .edgeless-index-label { box-sizing: border-box; padding: 0px 6px; border: 1px solid #0000001a; width: fit-content; height: 24px; min-width: 24px; color: var(--affine-white); font-size: 15px; line-height: 22px; text-align: center; cursor: pointer; user-select: none; border-radius: 25px; background: var(--affine-primary-color); } .navigator { width: 48px; padding: 4px; border-radius: 58px; border: 1px solid rgba(227, 226, 228, 1); transition: opacity 0.5s ease-in-out; background: rgba(251, 251, 252, 1); display: flex; align-items: center; justify-content: space-between; opacity: 0; } .navigator div { display: flex; align-items: center; cursor: pointer; } .navigator span { display: inline-block; height: 8px; border: 1px solid rgba(227, 226, 228, 1); } .navigator div:hover { background: var(--affine-hover-color); } .navigator.show { opacity: 1; } `}_EdgelessOnlyLabels(){let{_edgelessOnlyNotesSet:e}=this;return e.size?(0,L.qy)`${(0,t$.u)(e,e=>e.id,e=>{let{viewport:t}=this.service,{zoom:i}=t,s=p.z.deserialize(e.xywh),[o,r]=t.toViewCoord(s.x,s.y),[a,n]=[s.w*i,s.h*i],l=(0,Z.W)({width:"24px",height:"24px",borderRadius:"50%",backgroundColor:"var(--affine-text-secondary-color)",border:"1px solid var(--affine-border-color)",color:"var(--affine-white)",position:"absolute",transform:`translate(${o+a/2-12}px, ${r+n+16}px)`,display:"flex",justifyContent:"center",alignItems:"center"});return(0,L.qy)`
${sm.Mz} ${s_(sv.ve,"Hidden on page")}
`})}`:L.s6}_NavigatorComponent(e){let{viewport:t}=this.service,{zoom:i}=t,s=`navigator ${this._index>=0?"show":"hidden"}`,o=e[this._index],r=p.z.deserialize(o.xywh),[a,n]=t.toViewCoord(r.x,r.y),[l,c]=[r.w*i,r.h*i],d=(0,Z.W)({position:"absolute",transform:`translate(${a+l/2-26}px, ${n+c+16}px)`});return(0,L.qy)`
{(0,sy.dG)(e),this._navigateToPrev()}} > ${sm.KQ}
{(0,sy.dG)(e),this._navigateToNext()}} > ${sm.zu}
`}_PageVisibleIndexLabels(e,t){let{viewport:i}=this.service,{zoom:s}=i,o=0;return(0,L.qy)`${(0,t$.u)(e,e=>e.id,(e,r)=>{let a=p.z.deserialize(e.xywh),[n,l]=i.toViewCoord(a.x,a.y),[c,d]=[a.w*s,a.h*s],h=(0,Z.W)({width:"44px",maxWidth:"44px",height:"24px",position:"absolute",transform:`translate(${n+c/2-22}px, ${l+d+16}px)`,display:"flex",justifyContent:"center",alignItems:"center"}),u=[],f=t[r],g=24/f-24,m=sx(g,f,24);for(let e=0;e{(0,sy.dG)(e),this._index=this._index===r?-1:r}} > ${o} ${s_(sv.ve,"Page mode index")} `);function v(e,t){e.target&&Array.from(e.target.children).forEach((e,i)=>{e.style.top=t[i][0]+"px",e.style.left=t[i][1]+"px"})}return(0,L.qy)`
{v(e,sx(5,f,24))}} @mouseleave=${e=>{v(e,sx(g,f,24))}} > ${u}
`})}`}_getElementsAndCounts(){let e=[],t=[];for(let[i,s]of this._pageVisibleElementsMap.entries())e.push(i),t.push(s);return{elements:e,counts:t}}_initLabels(){let{service:e}=this.block,t=e.doc.getBlocksByFlavour("affine:surface-ref").map(e=>e.model),i=()=>{let{selectedElements:i}=e.selection;return 1===i.length&&!e.selection.editing&&((0,tE._h)(i[0])||t.some(e=>e.reference===i[0].id))?this._show=!0:this._show=!1,this._show},s=(0,sy.GR)(()=>{let t=new Map,i=e.doc.root?.children.filter(e=>tf.o(e,["affine:note"])),s=new Set;i.forEach(i=>{(0,tE._h)(i)&&(i.displayMode===e$.ko.EdgelessOnly?s.add(i):i.displayMode===e$.ko.DocAndEdgeless&&t.set(i,1)),i.children.forEach(i=>{if((0,tf.o)(i,["affine:surface-ref"])){let s=e.getElementById(i.reference);s&&(t.has(s)?t.set(s,t.get(s)+1):t.set(s,1))}})}),this._edgelessOnlyNotesSet=s,this._pageVisibleElementsMap=t},this.block);this._disposables.add(e.selection.slots.updated.on(()=>{i()})),this._disposables.add(this.doc.slots.blockUpdated.on(e=>{if("affine:note"===e.flavour)"props"in e&&"displayMode"!==e.props.key?"xywh"===e.props.key&&this.requestUpdate():s();else if("affine:surface-ref"===e.flavour){switch(e.type){case"add":t.push(e.model);break;case"delete":{let i=t.indexOf(e.model);i>=0&&t.splice(i,1)}break;case"update":if("reference"!==e.props.key)return}s()}})),this._disposables.add(e.surface.elementUpdated.on(e=>{e.props.xywh&&t.some(t=>t.reference===e.id)&&this.requestUpdate()})),s()}_navigateToNext(){let{elements:e}=this._getElementsAndCounts();if(this._index>=e.length-1)return;this._index=this._index+1;let t=e[this._index],i=p.z.deserialize(t.xywh);this.service.selection.set({elements:[t.id],editing:!1}),this.service.viewport.setViewportByBound(i,[80,80,80,80],!0)}_navigateToPrev(){let{elements:e}=this._getElementsAndCounts();if(this._index<=0)return;this._index=this._index-1;let t=e[this._index],i=p.z.deserialize(t.xywh);this.service.selection.set({elements:[t.id],editing:!1}),this.service.viewport.setViewportByBound(i,[80,80,80,80],!0)}_setHostStyle(){this.style.position="absolute",this.style.top="0",this.style.left="0",this.style.zIndex="1"}connectedCallback(){super.connectedCallback(),this._setHostStyle(),this._initLabels()}firstUpdated(){let{_disposables:e,service:t}=this;e.add(t.viewport.viewportUpdated.on(()=>{this.requestUpdate()})),e.add(t.selection.slots.updated.on(()=>{let{selectedElements:e}=t.selection;1===e.length&&(0,tE._h)(e[0])||(this._index=-1)}))}render(){if(!this._show)return L.s6;let{elements:e,counts:t}=this._getElementsAndCounts();return(0,L.qy)`${this._PageVisibleIndexLabels(e,t)} ${this._EdgelessOnlyLabels()} ${this._index>=0&&this._index=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sM=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)(sE)],r=[],a=P.W,n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],sS(this,null,i,{kind:"accessor",name:"_remoteCursors",static:!1,private:!1,access:{has:e=>"_remoteCursors"in e,get:e=>e._remoteCursors,set:(e,t)=>{e._remoteCursors=t}},metadata:h},n,l),sS(this,null,s,{kind:"accessor",name:"_remoteRects",static:!1,private:!1,access:{has:e=>"_remoteRects"in e,get:e=>e._remoteRects,set:(e,t)=>{e._remoteRects=t}},metadata:h},c,d),sS(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` :host { pointer-events: none; position: absolute; left: 0; top: 0; transform-origin: left top; contain: size layout; z-index: 1; } .remote-rect { position: absolute; top: 0; left: 0; border-radius: 4px; box-sizing: border-box; border-width: 3px; z-index: 1; transform-origin: center center; } .remote-cursor { position: absolute; top: 0; left: 0; border-radius: 50%; z-index: 1; } .remote-cursor > svg { display: block; } .remote-username { margin-left: 22px; margin-top: -2px; color: white; max-width: 160px; padding: 0px 3px; border: 1px solid var(--affine-pure-black-20); box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.16); border-radius: 4px; font-size: 12px; line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } `}connectedCallback(){super.connectedCallback();let{_disposables:e,doc:t,edgeless:i}=this;(0,sk.ME)(i.service.surface,["elementAdded","elementRemoved","elementUpdated"]).forEach(t=>{e.add(t.on(this._updateOnElementChange))}),e.add(t.slots.blockUpdated.on(this._updateOnElementChange)),e.add(this.selection.slots.remoteUpdated.on(this._updateRemoteRects)),e.add(this.selection.slots.remoteCursorUpdated.on(this._updateRemoteCursor)),e.add(i.service.viewport.viewportUpdated.on(()=>{this._updateTransform()})),this._updateTransform(),this._updateRemoteRects(),this._remoteColorManager=new iT(this.host)}render(){let{_remoteRects:e,_remoteCursors:t,_remoteColorManager:i}=this;(0,H.Z1)(i);let{zoom:s}=this.edgeless.service.viewport,o=(0,t$.u)(e.entries(),e=>e[0],([e,t])=>(0,L.qy)`
`),r=(0,t$.u)(t.entries(),e=>e[0],([e,t])=>(0,L.qy)`
${sm.FU}
${t.user?.name??"Unknown"}
`);return(0,L.qy)`
${o}${r}
`}get edgeless(){return this.block}get selection(){return this.edgeless.service.selection}get surface(){return this.edgeless.surface}#iZ;get _remoteCursors(){return this.#iZ}set _remoteCursors(e){this.#iZ=e}#ij;get _remoteRects(){return this.#ij}set _remoteRects(e){this.#ij=e}constructor(){super(...arguments),this._remoteColorManager=null,this._updateOnElementChange=e=>{let t="string"==typeof e?e:e.id;this.isConnected&&this.selection.hasRemote(t)&&this._updateRemoteRects()},this._updateRemoteCursor=()=>{let e=new Map,t=this.doc.awarenessStore.getStates();this.selection.remoteCursorSelectionMap.forEach((i,s)=>{e.set(s,{x:i.x,y:i.y,user:t.get(s)?.user})}),this._remoteCursors=e},this._updateRemoteRects=()=>{let{selection:e,block:t}=this,i=e.remoteSurfaceSelectionsMap,s=new Map;i.forEach((e,i)=>{e.forEach(e=>{if(0===e.elements.length)return;let o=e.elements.map(e=>t.service.getElementById(e)).filter(e=>e),r=(0,tE.Ql)(o);if(0===r.width||0===r.height)return;let{left:a,top:n}=r,[l,c]=[r.width,r.height],d=0;if(1===o.length){let e=o[0];(0,tE.Te)(e)||(d=e.rotate??0)}s.set(i,{width:l,height:c,borderStyle:"solid",left:a,top:n,rotate:d})})}),this._remoteRects=s},this._updateTransform=(0,sy.GR)(()=>{let{translateX:e,translateY:t}=this.edgeless.service.viewport;this.style.setProperty("transform",`translate(${e}px, ${t}px)`),this.requestUpdate()},this),this.#iZ=sM(this,n,new Map),this.#ij=(sM(this,l),sM(this,c,new Map)),sM(this,d)}static{sM(t,r)}})})();var sI=i(41507),sB=i(41295),s$=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sT=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("zoom-bar-toggle-button")],a=[],n=(0,P.Tm)(L.WF),l=[],c=[],d=[],h=[],u=[],p=[];(class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.P)(".toggle-button")],o=[(0,D.MZ)({attribute:!1})],s$(this,null,i,{kind:"accessor",name:"_showPopper",static:!1,private:!1,access:{has:e=>"_showPopper"in e,get:e=>e._showPopper,set:(e,t)=>{e._showPopper=t}},metadata:f},l,c),s$(this,null,s,{kind:"accessor",name:"_toggleButton",static:!1,private:!1,access:{has:e=>"_toggleButton"in e,get:e=>e._toggleButton,set:(e,t)=>{e._toggleButton=t}},metadata:f},d,h),s$(this,null,o,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:f},u,p),s$(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` :host { display: flex; } .toggle-button { display: flex; position: relative; } edgeless-zoom-toolbar { position: absolute; bottom: initial; } `}_closeZoomMenu(){this._abortController&&!this._abortController.signal.aborted&&(this._abortController.abort(),this._abortController=null,this._showPopper=!1)}_toggleZoomMenu(){if(this._abortController&&!this._abortController.signal.aborted){this._closeZoomMenu();return}this._abortController=new AbortController,this._abortController.signal.addEventListener("abort",()=>{this._showPopper=!1}),(0,sB.cl)({template:(0,L.qy)``,container:this._toggleButton,computePosition:{referenceElement:this._toggleButton,placement:"top",middleware:[(0,sI.cY)(4)],autoUpdate:!0},abortController:this._abortController,closeOnClickAway:!0}),this._showPopper=!0}disconnectedCallback(){super.disconnectedCallback(),this._closeZoomMenu()}firstUpdated(){let{disposables:e}=this;e.add(this.edgeless.slots.readonlyUpdated.on(()=>{this.requestUpdate()}))}render(){return this.edgeless.doc.readonly?L.s6:(0,L.qy)`
this._toggleZoomMenu()} > ${sm.Z4}
`}#iV;get _showPopper(){return this.#iV}set _showPopper(e){this.#iV=e}#iz;get _toggleButton(){return this.#iz}set _toggleButton(e){this.#iz=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}constructor(){super(...arguments),this._abortController=null,this.#iV=sT(this,l,!1),this.#iz=(sT(this,c),sT(this,d,void 0)),this.#i_=(sT(this,h),sT(this,u,void 0)),sT(this,p)}static{sT(t,a)}})})();var sO=i(99621),sP=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sH=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("edgeless-zoom-toolbar")],r=[],a=(0,P.Tm)(L.WF),n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],sP(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:h},n,l),sP(this,null,s,{kind:"accessor",name:"layout",static:!1,private:!1,access:{has:e=>"layout"in e,get:e=>e.layout,set:(e,t)=>{e.layout=t}},metadata:h},c,d),sP(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` :host { display: flex; } .edgeless-zoom-toolbar-container { display: flex; align-items: center; background: transparent; border-radius: 8px; fill: currentcolor; padding: 4px; } .edgeless-zoom-toolbar-container.horizantal { flex-direction: row; } .edgeless-zoom-toolbar-container.vertical { flex-direction: column; width: 40px; background-color: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-shadow-2); border: 1px solid var(--affine-border-color); border-radius: 8px; } .edgeless-zoom-toolbar-container[level='second'] { position: absolute; bottom: 8px; transform: translateY(-100%); } .edgeless-zoom-toolbar-container[hidden] { display: none; } .zoom-percent { display: flex; align-items: center; justify-content: center; width: 40px; height: 32px; border: none; box-sizing: border-box; padding: 4px; color: var(--affine-icon-color); background-color: transparent; border-radius: 4px; cursor: pointer; white-space: nowrap; font-size: 12px; font-weight: 500; text-align: center; font-family: ${(0,L.iz)(iW.$7.fontSansFamily)}; } .zoom-percent:hover { color: var(--affine-primary-color); background-color: var(--affine-hover-color); } .zoom-percent[disabled] { pointer-events: none; cursor: not-allowed; color: var(--affine-text-disable-color); } `}constructor(e){super(),this.setEdgelessTool=e=>{this.edgeless.tools.setEdgelessTool(e)},this.#i_=sH(this,n,void 0),this.#iR=(sH(this,l),sH(this,c,"horizontal")),sH(this,d),this.edgeless=e}_isVerticalBar(){return"vertical"===this.layout}firstUpdated(){let{disposables:e}=this;e.add(this.edgeless.service.viewport.viewportUpdated.on(()=>this.requestUpdate())),e.add(this.edgeless.slots.edgelessToolUpdated.on(()=>this.requestUpdate())),e.add(this.edgeless.slots.readonlyUpdated.on(()=>{this.requestUpdate()}))}render(){if(this.edgeless.doc.readonly)return L.s6;let e=`${Math.round(100*this.zoom)}%`,t=`edgeless-zoom-toolbar-container ${this.layout}`,i=this.locked;return(0,L.qy)`
this.edgelessService.zoomToFit()} .iconContainerPadding=${4} .disabled=${i} > ${sm.u2} this.edgelessService.setZoomByStep(-sO.bL)} .iconContainerPadding=${4} .disabled=${i} > ${sm.QG} this.edgelessService.setZoomByStep(sO.bL)} .iconContainerPadding=${4} .disabled=${i} > ${sm.c1}
`}get edgelessService(){return this.edgeless.service}get edgelessTool(){return this.edgeless.edgelessTool}get locked(){return this.edgelessService.locked}get viewport(){return this.edgelessService.viewport}get zoom(){return this.viewport?this.viewport.zoom:(console.error("Something went wrong, viewport is not available"),1)}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#iR;get layout(){return this.#iR}set layout(e){this.#iR=e}static{sH(t,r)}})})();var sA=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sL=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)(sD)],s=[],o=P.W,r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;sA(this,null,[(0,D.wk)()],{kind:"accessor",name:"_hide",static:!1,private:!1,access:{has:e=>"_hide"in e,get:e=>e._hide,set:(e,t)=>{e._hide=t}},metadata:n},r,a),sA(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` :host { position: absolute; bottom: 20px; left: 12px; z-index: var(--affine-z-index-popover); display: flex; justify-content: center; -webkit-user-select: none; user-select: none; } @container viewport (width <= 1200px) { edgeless-zoom-toolbar { display: none; } } @container viewport (width > 1200px) { zoom-bar-toggle-button { display: none; } } `}firstUpdated(){let{disposables:e,edgeless:{slots:t}}=this;e.add(t.edgelessToolUpdated.on(e=>{"frameNavigator"!==e.type&&(this._hide=!1),this.requestUpdate()})),e.add(t.navigatorSettingUpdated.on(({hideToolbar:e})=>{void 0!==e&&(this._hide=e)}))}render(){return this._hide||!this.edgeless?L.s6:(0,L.qy)` `}get edgeless(){return this.block}#iF=sL(this,r,!1);get _hide(){return this.#iF}set _hide(e){this.#iF=e}constructor(){super(...arguments),sL(this,a)}static{sL(t,s)}})})();var sZ=i(83951),sj=i(93143),sV=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sz=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d,h=[(0,D.EM)("icon-button")],u=[],p=L.WF,f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[];(class extends p{static{t=this}static{let O="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!0,type:Boolean})],s=[(0,D.MZ)({attribute:!0,type:Boolean})],o=[(0,D.MZ)()],r=[(0,D.MZ)({attribute:!0,type:String})],a=[(0,D.MZ)()],n=[(0,D.MZ)()],l=[(0,D.MZ)()],c=[(0,D.P)(".text-container .text")],d=[(0,D.MZ)()],sV(this,null,i,{kind:"accessor",name:"active",static:!1,private:!1,access:{has:e=>"active"in e,get:e=>e.active,set:(e,t)=>{e.active=t}},metadata:O},f,g),sV(this,null,s,{kind:"accessor",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:O},m,v),sV(this,null,o,{kind:"accessor",name:"height",static:!1,private:!1,access:{has:e=>"height"in e,get:e=>e.height,set:(e,t)=>{e.height=t}},metadata:O},y,b),sV(this,null,r,{kind:"accessor",name:"hover",static:!1,private:!1,access:{has:e=>"hover"in e,get:e=>e.hover,set:(e,t)=>{e.hover=t}},metadata:O},w,x),sV(this,null,a,{kind:"accessor",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:O},_,C),sV(this,null,n,{kind:"accessor",name:"subText",static:!1,private:!1,access:{has:e=>"subText"in e,get:e=>e.subText,set:(e,t)=>{e.subText=t}},metadata:O},k,S),sV(this,null,l,{kind:"accessor",name:"text",static:!1,private:!1,access:{has:e=>"text"in e,get:e=>e.text,set:(e,t)=>{e.text=t}},metadata:O},M,E),sV(this,null,c,{kind:"accessor",name:"textElement",static:!1,private:!1,access:{has:e=>"textElement"in e,get:e=>e.textElement,set:(e,t)=>{e.textElement=t}},metadata:O},I,B),sV(this,null,d,{kind:"accessor",name:"width",static:!1,private:!1,access:{has:e=>"width"in e,get:e=>e.width,set:(e,t)=>{e.width=t}},metadata:O},$,T),sV(null,e={value:t},h,{kind:"class",name:t.name,metadata:O},null,u),t=e.value,O&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:O})}static{this.styles=(0,L.AH)` :host { box-sizing: border-box; display: flex; justify-content: flex-start; align-items: center; border: none; width: var(--button-width); height: var(--button-height); border-radius: 4px; background: transparent; cursor: pointer; user-select: none; font-family: ${(0,L.iz)(iW.$7.fontSansFamily)}; color: var(--affine-text-primary-color); pointer-events: auto; padding: 4px; } :host(:hover) { background: var(--affine-hover-color); } :host(:active) { background: transparent; } :host([disabled]), :host(:disabled) { background: transparent; color: var(--affine-text-disable-color); cursor: not-allowed; } /* You can add a 'hover' attribute to the button to show the hover style */ :host([hover='true']) { background: var(--affine-hover-color); } :host([hover='false']) { background: transparent; } :host(:active[active]) { background: transparent; } /* not supported "until-found" yet */ :host([hidden]) { display: none; } :host > .text-container { display: flex; flex-direction: column; overflow: hidden; } :host .text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--affine-font-sm); line-height: var(--affine-line-height); } :host .sub-text { font-size: var(--affine-font-xs); color: var( --light-textColor-textSecondaryColor, var(--textColor-textSecondaryColor, #8e8d91) ); line-height: var(--affine-line-height); white-space: nowrap; text-overflow: ellipsis; overflow: hidden; margin-top: -2px; } ::slotted(svg) { flex-shrink: 0; color: var(--svg-icon-color); } ::slotted([slot='suffix']) { margin-left: auto; } `}constructor(){super(),sz(this,T),this.addEventListener("keypress",e=>{!this.disabled&&("Enter"!==e.key||e.isComposing||this.click())}),this.addEventListener("click",e=>{!0===this.disabled&&(e.preventDefault(),e.stopPropagation())},{capture:!0})}connectedCallback(){super.connectedCallback(),this.tabIndex=0,this.role="button";let e="28px";if(this.size&&(this.width||this.height))return;let t=this.width??e,i=this.height??e;this.size&&(t=this.size,i=this.size),this.style.setProperty("--button-width","string"==typeof t?t:`${t}px`),this.style.setProperty("--button-height","string"==typeof i?i:`${i}px`)}render(){if(this.hidden)return L.s6;if(this.disabled)this.style.setProperty("--svg-icon-color","var(--affine-text-disable-color)"),this.dataset.testDisabled="true";else{this.dataset.testDisabled="false";let e=this.active?"var(--affine-primary-color)":"var(--affine-icon-color)";this.style.setProperty("--svg-icon-color",e)}let e=this.text?(0,L.qy)`
${this.text}
`:L.s6,t=this.subText?(0,L.qy)`
${this.subText}
`:L.s6,i=this.text||this.subText?(0,L.qy)`
${e}${t}
`:L.s6;return(0,L.qy)` ${i} `}#iN=sz(this,f,!1);get active(){return this.#iN}set active(e){this.#iN=e}#iq=(sz(this,g),sz(this,m,void 0));get disabled(){return this.#iq}set disabled(e){this.#iq=e}#iU=(sz(this,v),sz(this,y,null));get height(){return this.#iU}set height(e){this.#iU=e}#iW=(sz(this,b),sz(this,w,void 0));get hover(){return this.#iW}set hover(e){this.#iW=e}#eQ=(sz(this,x),sz(this,_,null));get size(){return this.#eQ}set size(e){this.#eQ=e}#iG=(sz(this,C),sz(this,k,null));get subText(){return this.#iG}set subText(e){this.#iG=e}#ia=(sz(this,S),sz(this,M,null));get text(){return this.#ia}set text(e){this.#ia=e}#iY=(sz(this,E),sz(this,I,null));get textElement(){return this.#iY}set textElement(e){this.#iY=e}#tP=(sz(this,B),sz(this,$,null));get width(){return this.#tP}set width(e){this.#tP=e}static{sz(t,u)}})})();let sR=(0,L.iz)(` font-family: ${iW.$7.fontSansFamily}; font-feature-settings: 'clig' off, 'liga' off; font-style: normal; `),sF=(0,L.iz)(` ${sR}; font-size: var(--affine-font-sm); font-weight: 500; line-height: 22px; `),sN=(0,L.iz)(` ${sR}; font-size: var(--affine-font-xs); font-weight: 500; line-height: 20px; `),sq=(0,L.iz)(` color: var(--affine-icon-color); background: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-overlay-shadow); `),sU=(0,L.iz)(` display: flex; align-items: center; gap: 8px; width: max-content; padding: 0 6px; border-radius: 4px; border: 0.5px solid var(--affine-border-color); ${sq}; ${sF}; `),sW=(0,L.AH)` .embed-card-modal-mask { position: absolute; left: 0; right: 0; top: 0; bottom: 0; margin: auto; z-index: 1; } .embed-card-modal-wrapper { ${sU}; flex-direction: column; position: absolute; left: 0; right: 0; top: 0; bottom: 0; margin: auto; z-index: 2; width: 305px; height: max-content; padding: 12px; gap: 12px; border-radius: 8px; font-size: var(--affine-font-xs); line-height: 20px; } .embed-card-modal-row { display: flex; flex-direction: column; align-self: stretch; } .embed-card-modal-row label { padding: 0px 2px; color: var(--affine-text-secondary-color); font-weight: 600; } .embed-card-modal-input { display: flex; padding-left: 10px; padding-right: 10px; border-radius: 8px; border: 1px solid var(--affine-border-color); background: var(--affine-white-10); color: var(--affine-text-primary-color); ${sN}; } input.embed-card-modal-input { padding-top: 4px; padding-bottom: 4px; } textarea.embed-card-modal-input { padding-top: 6px; padding-bottom: 6px; min-width: 100%; max-width: 100%; } .embed-card-modal-input:focus { border-color: var(--affine-blue-700); box-shadow: var(--affine-active-shadow); outline: none; } .embed-card-modal-input::placeholder { color: var(--affine-placeholder-color); } .embed-card-modal-row:has(.embed-card-modal-button) { flex-direction: row; gap: 4px; align-self: flex-end; } .embed-card-modal-button { padding: 4px 18px; border-radius: 8px; align-self: self-end; box-sizing: border-box; } .embed-card-modal-button.save { border: 1px solid var(--affine-black-10); background: var(--affine-primary-color); color: var(--affine-pure-white); } .embed-card-modal-button[disabled] { pointer-events: none; cursor: not-allowed; color: var(--affine-text-disable-color); background: transparent; } .embed-card-modal-title { font-size: 18px; font-weight: 600; line-height: 26px; user-select: none; } .embed-card-modal-description { font-size: 15px; font-weight: 500; line-height: 24px; user-select: none; } `;var sG=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sY=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("embed-card-caption-edit-modal")],r=[],a=(0,P.Tm)(P.ao),n=[],l=[],c=[],d=[];return class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.P)(".embed-card-modal-input.caption")],sG(this,null,i,{kind:"accessor",name:"block",static:!1,private:!1,access:{has:e=>"block"in e,get:e=>e.block,set:(e,t)=>{e.block=t}},metadata:h},n,l),sG(this,null,s,{kind:"accessor",name:"captionInput",static:!1,private:!1,access:{has:e=>"captionInput"in e,get:e=>e.captionInput,set:(e,t)=>{e.captionInput=t}},metadata:h},c,d),sG(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=sW}get _doc(){return this.block.doc}get _model(){return this.block.model}_onKeydown(e){e.stopPropagation(),"Enter"!==e.key||e.isComposing||this._onSave(),"Escape"===e.key&&this.remove()}_onSave(){let e=this.captionInput.value;this._doc.updateBlock(this._model,{caption:e}),this.remove()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.captionInput.focus()}).catch(console.error),this.disposables.addFromEvent(this,"keydown",this._onKeydown)}render(){return(0,L.qy)`
this.remove()}>
`}#T=sY(this,n,void 0);get block(){return this.#T}set block(e){this.#T=e}#iK=(sY(this,l),sY(this,c,void 0));get captionInput(){return this.#iK}set captionInput(e){this.#iK=e}constructor(){super(...arguments),sY(this,d)}static{sY(t,r)}},t})();var sX=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},sQ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n=[(0,D.EM)("embed-card-edit-modal")],l=[],c=(0,P.Tm)(P.ao),d=[],h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[];return class extends c{static{t=this}static{let w="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.P)(".embed-card-modal-input.description")],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.P)(".embed-card-modal-input.title")],sX(this,null,i,{kind:"accessor",name:"_titleInputValue",static:!1,private:!1,access:{has:e=>"_titleInputValue"in e,get:e=>e._titleInputValue,set:(e,t)=>{e._titleInputValue=t}},metadata:w},d,h),sX(this,null,s,{kind:"accessor",name:"descInput",static:!1,private:!1,access:{has:e=>"descInput"in e,get:e=>e.descInput,set:(e,t)=>{e.descInput=t}},metadata:w},u,p),sX(this,null,o,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:w},f,g),sX(this,null,r,{kind:"accessor",name:"model",static:!1,private:!1,access:{has:e=>"model"in e,get:e=>e.model,set:(e,t)=>{e.model=t}},metadata:w},m,v),sX(this,null,a,{kind:"accessor",name:"titleInput",static:!1,private:!1,access:{has:e=>"titleInput"in e,get:e=>e.titleInput,set:(e,t)=>{e.titleInput=t}},metadata:w},y,b),sX(null,e={value:t},n,{kind:"class",name:t.name,metadata:w},null,l),t=e.value,w&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:w})}static{this.styles=sW}_handleInput(e){let t=e.target;this._titleInputValue=t.value}_onDocumentKeydown(e){e.stopPropagation(),"Enter"!==e.key||e.isComposing||this._onSave(),"Escape"===e.key&&this.remove()}_onSave(){let e=this.titleInput.value;if(0===e.length){(0,e5.o)(this.host,"Link title can not be empty");return}this.model.doc.updateBlock(this.model,{title:e,description:this.descInput.value}),this.remove()}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{this.titleInput.focus(),this.titleInput.setSelectionRange(0,this.titleInput.value.length)}).catch(console.error),this.disposables.addFromEvent(this,"keydown",this._onDocumentKeydown),this._titleInputValue=this.model.title??""}render(){return(0,L.qy)`
this.remove()}>
`}#iX=sQ(this,d,"");get _titleInputValue(){return this.#iX}set _titleInputValue(e){this.#iX=e}#iQ=(sQ(this,h),sQ(this,u,void 0));get descInput(){return this.#iQ}set descInput(e){this.#iQ=e}#n=(sQ(this,p),sQ(this,f,void 0));get host(){return this.#n}set host(e){this.#n=e}#iJ=(sQ(this,g),sQ(this,m,void 0));get model(){return this.#iJ}set model(e){this.#iJ=e}#i1=(sQ(this,v),sQ(this,y,void 0));get titleInput(){return this.#i1}set titleInput(e){this.#i1=e}constructor(){super(...arguments),sQ(this,b)}static{sQ(t,l)}},t})();function s1(e,t){e.selection.clear();let i=new sJ;i.model=t,i.host=e,document.body.append(i)}var s0=i(56752);let s2="Untitled";var s5=i(43462);function s7(e,t){let i=e.trim().toLowerCase().split("").filter(e=>" "!==e).join("");return RegExp(t.split("").filter(e=>" "!==e).map(e=>`${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}.*`).join(""),"i").test(i)}function s3(e,t){let i;if(0===t.length||0===e.length||t.length>e.length)return 0;if(t=t.toLowerCase(),(e=e.toLocaleLowerCase()).includes(t))i=1+t.length/e.length;else{let s=0;for(let i=0;i=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},s8=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("loader-element")],a=[],n=L.WF,l=[],c=[],d=[],h=[],u=[],p=[];(class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],s6(this,null,i,{kind:"accessor",name:"hostModel",static:!1,private:!1,access:{has:e=>"hostModel"in e,get:e=>e.hostModel,set:(e,t)=>{e.hostModel=t}},metadata:f},l,c),s6(this,null,s,{kind:"accessor",name:"radius",static:!1,private:!1,access:{has:e=>"radius"in e,get:e=>e.radius,set:(e,t)=>{e.radius=t}},metadata:f},d,h),s6(this,null,o,{kind:"accessor",name:"width",static:!1,private:!1,access:{has:e=>"width"in e,get:e=>e.width,set:(e,t)=>{e.width=t}},metadata:f},u,p),s6(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` .load-container { margin: 10px auto; width: var(--loader-width); text-align: center; } .load-container .load { width: 8px; height: 8px; background-color: var(--affine-text-primary-color); border-radius: 100%; display: inline-block; -webkit-animation: bouncedelay 1.4s infinite ease-in-out; animation: bouncedelay 1.4s infinite ease-in-out; /* Prevent first note from flickering when animation starts */ -webkit-animation-fill-mode: both; animation-fill-mode: both; } .load-container .load1 { -webkit-animation-delay: -0.32s; animation-delay: -0.32s; } .load-container .load2 { -webkit-animation-delay: -0.16s; animation-delay: -0.16s; } @-webkit-keyframes bouncedelay { 0%, 80%, 100% { -webkit-transform: scale(0.625); } 40% { -webkit-transform: scale(1); } } @keyframes bouncedelay { 0%, 80%, 100% { transform: scale(0); -webkit-transform: scale(0.625); } 40% { transform: scale(1); -webkit-transform: scale(1); } } `}constructor(){super(),s8(this,p)}connectedCallback(){super.connectedCallback(),this.hostModel&&(this.setAttribute(eh.u_,this.hostModel.id),this.dataset.serviceLoading="true");let e=this.width;this.style.setProperty("--loader-width","string"==typeof e?e:`${e}px`)}render(){return(0,L.qy)`
`}#i0=s8(this,l,null);get hostModel(){return this.#i0}set hostModel(e){this.#i0=e}#i2=(s8(this,c),s8(this,d,"8px"));get radius(){return this.#i2}set radius(e){this.#i2=e}#tP=(s8(this,h),s8(this,u,"150px"));get width(){return this.#tP}set width(e){this.#tP=e}static{s8(t,a)}})})();let s9=(0,L.AH)` .container { position: absolute; width: 480px; left: calc(50% - 480px / 2); top: calc(50% - 270px / 2); font-family: ${(0,L.iz)(iW.$7.fontSansFamily)}; font-size: var(--affine-font-base); line-height: var(--affine-line-height); padding: 12px 40px 36px; gap: 20px; display: flex; flex-direction: column; background: var(--affine-background-primary-color); box-shadow: var(--affine-shadow-2); border-radius: 16px; z-index: var(--affine-z-index-popover); } .container[hidden] { display: none; } header { cursor: move; user-select: none; font-size: var(--affine-font-h-6); font-weight: 600; } a { white-space: nowrap; word-break: break-word; color: var(--affine-link-color); fill: var(--affine-link-color); text-decoration: none; cursor: pointer; } header icon-button { margin-left: auto; position: relative; left: 24px; } .button-container { display: flex; justify-content: space-between; } .button-container icon-button { padding: 8px 12px; justify-content: flex-start; gap: 12px; width: 190px; height: 40px; box-shadow: var(--affine-shadow-1); border-radius: 10px; } .footer { display: flex; align-items: center; color: var(--affine-text-secondary-color); } .loading-header { display: flex; align-items: center; } .button-suffix { display: flex; margin-left: auto; } .overlay-mask { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: var(--affine-z-index-popover); } `;var oe=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ot=function(e,t,i){for(var s=arguments.length>2,o=0;o{e.beforeImport.on(e=>{"page"===e.type&&i&&(e.snapshot.meta.title=i,e.snapshot.blocks.props.title={"$blocksuite:internal:text$":!0,delta:[{insert:i}]})})}]}),o=new eN.F(s),r=await o.toDoc({file:t,assets:s.assetsManager});if(r)return r.id}async function os(e,t){let i=new f._O({collection:e,middlewares:[e0]}),s=new eG(i),o=await s.toDocSnapshot({file:t,assets:i.assetsManager}),r=await i.snapshotToDoc(o);if(r)return r.id}async function oo(e,t){let i=[],s=!1,o=!1,r=async t=>{let a=new s4,n=await a.loadAsync(t),l=new Map,c=Object.keys(n.files),d=[],h=new Map;for(let t=0;t{let s=new f._O({collection:e,middlewares:[e0]}),o=new eG(s),r=s.assetsManager.getAssets();for(let[e,t]of h.entries())r.has(e)||r.set(e,t);let a=await o.toDoc({file:await n.files[t].async("text"),pageId:l.get(t),pageMap:l,assets:s.assetsManager});a&&i.push(a.id)});return d.push(...u),d},a=await r(t);return await Promise.all(a.flat()),{pageIds:i,isWorkspaceFile:s,hasMarkdown:o}}let or=(()=>{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("import-doc")],c=[],d=(0,P.Tm)(L.WF),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];return class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.P)(".container")],a=[(0,D.wk)()],n=[(0,D.wk)()],oe(this,null,i,{kind:"accessor",name:"_loading",static:!1,private:!1,access:{has:e=>"_loading"in e,get:e=>e._loading,set:(e,t)=>{e._loading=t}},metadata:C},h,u),oe(this,null,s,{kind:"accessor",name:"_startX",static:!1,private:!1,access:{has:e=>"_startX"in e,get:e=>e._startX,set:(e,t)=>{e._startX=t}},metadata:C},p,f),oe(this,null,o,{kind:"accessor",name:"_startY",static:!1,private:!1,access:{has:e=>"_startY"in e,get:e=>e._startY,set:(e,t)=>{e._startY=t}},metadata:C},g,m),oe(this,null,r,{kind:"accessor",name:"containerEl",static:!1,private:!1,access:{has:e=>"containerEl"in e,get:e=>e.containerEl,set:(e,t)=>{e.containerEl=t}},metadata:C},v,y),oe(this,null,a,{kind:"accessor",name:"x",static:!1,private:!1,access:{has:e=>"x"in e,get:e=>e.x,set:(e,t)=>{e.x=t}},metadata:C},b,w),oe(this,null,n,{kind:"accessor",name:"y",static:!1,private:!1,access:{has:e=>"y"in e,get:e=>e.y,set:(e,t)=>{e.y=t}},metadata:C},x,_),oe(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}static{this.styles=s9}constructor(e,t,i,s=new AbortController){super(),ot(this,_),this.collection=e,this.onSuccess=t,this.onFail=i,this.abortController=s,this._loading=!1,this.x=0,this.y=0,this._startX=0,this._startY=0,this._onMouseMove=this._onMouseMove.bind(this)}async _importHtml(){let e=await (0,O.p6)({acceptType:"Html",multiple:!0});if(!e)return;let t=[];for(let i of e){let e=await i.text(),s=i.size>204800;s?(this.hidden=!1,this._loading=!0):this.abortController.abort();let o=await os(this.collection,e);s&&this.abortController.abort(),o&&t.push(o)}this._onImportSuccess(t)}async _importMarkDown(){let e=await (0,O.p6)({acceptType:"Markdown",multiple:!0});if(!e)return;let t=[];for(let i of e){let e=await i.text(),s=i.name.split(".").slice(0,-1).join("."),o=i.size>204800;o?(this.hidden=!1,this._loading=!0):this.abortController.abort();let r=await oi(this.collection,e,s);o&&this.abortController.abort(),r&&t.push(r)}this._onImportSuccess(t)}async _importNotion(){let e=await (0,O.p6)({acceptType:"Zip"});if(!e)return;let t=0,i=new s4;for(let s of Object.values((await i.loadAsync(e)).files))s.dir||(t+=(await s.async("uint8array")).length);let s=t>204800;s?(this.hidden=!1,this._loading=!0):this.abortController.abort();let{pageIds:o,isWorkspaceFile:r,hasMarkdown:a}=await oo(this.collection,e);if(s&&this.abortController.abort(),a){this._onFail("Importing markdown files from Notion is deprecated. Please export your Notion pages as HTML.");return}this._onImportSuccess([o[0]],{isWorkspaceFile:r,importedCount:o.length})}_onCloseClick(e){e.stopPropagation(),this.abortController.abort()}_onFail(e){this.onFail?.(e)}_onImportSuccess(e,t={}){let{isWorkspaceFile:i=!1,importedCount:s=e.length}=t;this.onSuccess?.(e,{isWorkspaceFile:i,importedCount:s})}_onMouseDown(e){this._startX=e.clientX-this.x,this._startY=e.clientY-this.y,window.addEventListener("mousemove",this._onMouseMove)}_onMouseMove(e){this.x=e.clientX-this._startX,this.y=e.clientY-this._startY}_onMouseUp(){window.removeEventListener("mousemove",this._onMouseMove)}_openLearnImportLink(e){e.stopPropagation(),window.open("https://affine.pro/blog/import-your-data-from-notion-into-affine","_blank")}render(){return this._loading?(0,L.qy)`
Import
Importing the file may take some time. It depends on document size and complexity.
`:(0,L.qy)`
${G.USm}
Import
AFFiNE will gradually support more file formats for import. Provide feedback.
${G.s6$} ${G.Myu}
${G.j5m}
${G.NTw} Learn how to Import your Notion pages into AFFiNE.
${G.i68}
`}updated(e){(e.has("x")||e.has("y"))&&(this.containerEl.style.transform=`translate(${this.x}px, ${this.y}px)`)}#i5=ot(this,h,!1);get _loading(){return this.#i5}set _loading(e){this.#i5=e}#i7=(ot(this,u),ot(this,p,0));get _startX(){return this.#i7}set _startX(e){this.#i7=e}#i3=(ot(this,f),ot(this,g,0));get _startY(){return this.#i3}set _startY(e){this.#i3=e}#i4=(ot(this,m),ot(this,v,void 0));get containerEl(){return this.#i4}set containerEl(e){this.#i4=e}#i6=(ot(this,y),ot(this,b,0));get x(){return this.#i6}set x(e){this.#i6=e}#i8=(ot(this,w),ot(this,x,0));get y(){return this.#i8}set y(e){this.#i8=e}static{ot(t,c)}},t})();function oa({collection:e,onSuccess:t,onFail:i,container:s=document.body,abortController:o=new AbortController}){let r=new or(e,t,i,o);return s.append(r),o.signal.addEventListener("abort",()=>r.remove()),r}let on="Untitled";function ol({inlineEditor:e,docId:t}){if(!e)return;let i=e.getInlineRange();i&&(e.insertText(i," ",{reference:{type:"LinkedPage",pageId:t}}),e.setInlineRange({index:i.index+1,length:0}))}function oc(e,t,i,s){let o=i.doc,{docModeService:r}=i.std.spec.getService("affine:page"),{docMetas:a}=o.collection.meta,n=a.filter(({id:e})=>e!==o.id).filter(({title:t})=>s7(t,e));return{name:"Link to Doc",items:n.map(e=>({key:e.id,name:e.title||on,icon:"edgeless"===r.getMode(e.id)?G.FYP:G.hhn,action:()=>{t(),ol({inlineEditor:s,docId:e.id}),i.spec.getService("affine:page").telemetryService?.track("LinkedDocCreated",{control:"linked doc",module:"inline @",type:"doc",other:"existing doc"})}})),maxDisplay:6,overflowText:`${n.length-6} more docs`}}function od(e,t,i,s){let o=i.doc,r=e||on,a=r.slice(0,8)+(r.length>8?"..":"");return{name:"New Doc",items:[{key:"create",name:`Create "${a}" doc`,icon:G.y_r,action:()=>{t(),ol({inlineEditor:s,docId:(0,s5.U)(o.collection,{title:e}).id});let r=i.spec.getService("affine:page").telemetryService;r?.track("LinkedDocCreated",{control:"new doc",module:"inline @",type:"doc",other:"new doc"}),r?.track("DocCreated",{control:"new doc",module:"inline @",type:"doc"})}},{key:"import",name:"Import",icon:G.z52,action:()=>{t(),oa({collection:o.collection,onSuccess:(e,t)=>{for(let o of((0,e5.o)(i,`Successfully imported ${t.importedCount} Doc${t.importedCount>1?"s":""}.`),e))ol({inlineEditor:s,docId:o})},onFail:e=>{(0,e5.o)(i,e)}})}}]}}function oh(e,t,i,s){return Promise.resolve([oc(e,t,i,s),od(e,t,i,s)])}let ou={createLinkedDocMenuGroup:oc,createNewDocMenuGroup:od,insertLinkedNode:ol},op=[{id:"bold",name:"Bold",icon:G.$oz,hotkey:"Mod-b",activeWhen:e=>{let[t]=e.std.command.chain().isTextStyleActive({key:"bold"}).run();return t},action:e=>{e.std.command.chain().toggleBold().run()}},{id:"italic",name:"Italic",icon:G.yOR,hotkey:"Mod-i",activeWhen:e=>{let[t]=e.std.command.chain().isTextStyleActive({key:"italic"}).run();return t},action:e=>{e.std.command.chain().toggleItalic().run()}},{id:"underline",name:"Underline",icon:G.qpS,hotkey:"Mod-u",activeWhen:e=>{let[t]=e.std.command.chain().isTextStyleActive({key:"underline"}).run();return t},action:e=>{e.std.command.chain().toggleUnderline().run()}},{id:"strike",name:"Strikethrough",icon:G.t64,hotkey:"Mod-shift-s",activeWhen:e=>{let[t]=e.std.command.chain().isTextStyleActive({key:"strike"}).run();return t},action:e=>{e.std.command.chain().toggleStrike().run()}},{id:"code",name:"Code",icon:G.loI,hotkey:"Mod-e",activeWhen:e=>{let[t]=e.std.command.chain().isTextStyleActive({key:"code"}).run();return t},action:e=>{e.std.command.chain().toggleCode().run()}},{id:"link",name:"Link",icon:G.qYV,hotkey:"Mod-k",activeWhen:e=>{let[t]=e.std.command.chain().isTextStyleActive({key:"link"}).run();return t},action:e=>{e.std.command.chain().toggleLink().run()}}];var of=i(72938);function og(e,t){e.model.text?.insert(" ",t);let i=e.selection.find("text");e.selection.setGroup("note",[e.selection.create("text",{from:{blockId:e.blockId,index:(i?.from.index??0)+1,length:0},to:null})])}function om(e,t,i,s){let{doc:o,model:r}=e;if((0,O.op)(r,["affine:list"]))return!1;if((0,O.op)(r,["affine:paragraph"])){let a=o.getParent(r);if(!a)return!1;let n=a.children.indexOf(r);if(og(e,i.length),o.captureSync(),r.text?.delete(0,i.length+1),"numbered"===t){let t=parseInt(i.slice(0,-1));Number.isInteger(t)||(t=1);let{list:s}=e.std.command.exec("convertToNumberedList",{id:r.id,order:t,stopCapturing:!1});if(!s)return!1;e.host.updateComplete.then(()=>{let t=e.host.view.getBlock(s.id);e.std.command.exec("focusBlockStart",{focusBlock:t})}).catch(console.error)}else{let i={type:t,text:r.text?.clone(),children:r.children,...s};o.deleteBlock(r,{deleteChildren:!1});let l=o.addBlock("affine:list",i,a,n);O.Km(e.host,l)?.catch(console.error)}}return!0}function ov(e,t,i){let{doc:s,model:o}=e;if((0,O.op)(o,["affine:paragraph"])&&o.type===t)return!1;if((0,O.op)(o,["affine:paragraph"])){if((0,O.op)(o,["affine:paragraph"])&&o.type!==t){og(e,i.length),s.captureSync(),o.text?.delete(0,i.length+1);let r=(0,O.h9)(e.host,o);r&&r.setInlineRange({index:0,length:0}),s.updateBlock(o,{type:t})}}else{let r=s.getParent(o);if(!r)return!1;let a=r.children.indexOf(o);og(e,i.length),s.captureSync(),o.text?.delete(0,i.length+1);let n={type:t,text:o.text?.clone(),children:o.children};s.deleteBlock(o,{deleteChildren:!1});let l=s.addBlock("affine:paragraph",n,r,a);O.Km(e.host,l)?.catch(console.error)}return!0}function oy(e,t,i,s){let{model:o}=e;if(!i.match(/^(\d+\.|-|\*|\[ ?\]|\[x\]|(#){1,6}|(-){3}|(\*){3}|>|```([a-zA-Z0-9]*))$/))return A.gT;let r=t.getLine(s.index);if(!r)return A.gT;let{lineIndex:a,rangeIndexRelatedToLine:n}=r;if(0!==a||n>i.length)return A.gT;let l=(0,O.op)(o,["affine:paragraph"]),c=l&&o.type.startsWith("h"),d=l&&(0,H.n4)(o.type,"quote"),h=(0,O.op)(o,["affine:code"]);if(c||d||h)return A.gT;let u=i.match(/^```([a-zA-Z0-9]*)$/g);if(u){if("affine:paragraph"===o.flavour&&"quote"===o.type)return A.gT;let t=o.doc;t.captureSync();let s=t.getParent(o);(0,H.Z1)(s);let r=s.children.indexOf(o),a=t.addBlock("affine:code",{language:eM(u[0].slice(3))?.id??V.Kc},s,r);if(o.text&&o.text.length>i.length){let e=o.text.clone();t.addBlock("affine:paragraph",{text:e},s,r+1),e.delete(0,i.length)}t.deleteBlock(o,{bringChildrenTo:s});let n=t.getBlockById(a);return(0,H.Z1)(n),(0,O.xw)(e.host,n,{index:0,length:0}).catch(console.error),A.rM}let p=!1;switch(i.trim()){case"[]":case"[ ]":p=om(e,"todo",i,{checked:!1});break;case"[x]":p=om(e,"todo",i,{checked:!0});break;case"-":case"*":p=om(e,"bulleted",i);break;case"***":case"---":p=function(e,t){let{doc:i,model:s}=e;if((0,O.op)(s,["affine:divider"])||(0,O.op)(s,["affine:paragraph"])&&"quote"===s.type)return!1;if(!(0,O.op)(s,["affine:divider"])){let o=i.getParent(s);if(!o)return!1;let r=o.children.indexOf(s);og(e,t.length),i.captureSync(),s.text?.delete(0,t.length+1);let a={children:s.children};i.addBlock("affine:divider",a,o,r);let n=o.children[r+1];if(n)O.Km(e.host,n.id)?.catch(console.error);else{let t=i.addBlock("affine:paragraph",{},o);O.Km(e.host,t)?.catch(console.error)}}return!0}(e,i);break;case"#":p=ov(e,"h1",i);break;case"##":p=ov(e,"h2",i);break;case"###":p=ov(e,"h3",i);break;case"####":p=ov(e,"h4",i);break;case"#####":p=ov(e,"h5",i);break;case"######":p=ov(e,"h6",i);break;case">":p=ov(e,"quote",i);break;default:p=om(e,"numbered",i)}return p?A.rM:A.gT}function ob(e){return!((0,tf.o)(e,["affine:image","affine:divider","affine:code"])||(0,tf.o)(e,["affine:paragraph"])&&["h1","h2","h3","h4","h5","h6","quote"].includes(e.type??""))}function ow(e,t){let i;let s=t.doc,o=s.getParent(t),r=s.getNext(t);if(!o)return;let[a,n]=(0,tf.o)(t,["affine:list"])?[t.flavour,{type:t.type}]:["affine:paragraph",{type:"text"}];if((0,tf.a)(s,t,"affine:database")){s.captureSync();let i=o.children.findIndex(e=>e.id===t.id),r=o,l=i+1,c=o.children.length;if(i===c-1&&t.text?.yText.length===0){1!==c&&s.deleteBlock(t);let i=s.getNext(r);if(i&&(0,tf.o)(i,["affine:paragraph"])){tp.Km(e,i.id,i.text.length)?.catch(console.error);return}let a=s.getParent(o);if(!a)return;let n=a.children.findIndex(e=>e.id===o.id);r=a,l=n+1}let d=s.addBlock(a,n,r,l);tp.Km(e,d)?.catch(console.error);return}let l=o.children.indexOf(t);if(-1!==l){if(s.captureSync(),i=t.children.length>0?s.addBlock(a,n,t,0):s.addBlock(a,n,o,l+1),(0,tf.o)(t,["affine:list"])&&"numbered"===t.type){let e=r;for(;e&&(0,tf.o)(e,["affine:list"])&&"numbered"===t.type;)s.updateBlock(e,{}),e=s.getNext(e)}tp.Km(e,i)?.catch(console.error)}}function ox(e,t,i=0){let s=t.doc,o=s.getPrev(t);if(s.readonly||!o||!ob(o))return;let r=s.getNexts(t);s.captureSync(),s.moveBlocks([t],o),(0,tf.o)(t,["affine:list"])&&"numbered"===t.type&&s.updateBlock(t,{}),r.filter(e=>(0,tf.o)(e,["affine:list"])&&"numbered"===e.type).forEach(e=>{s.updateBlock(e,{})}),(0,tf.o)(o,["affine:list"])&&o.collapsed&&s.updateBlock(o,{collapsed:!1}),(0,tp.xw)(e,t,{index:i,length:0}).catch(console.error)}function o_(e,t,i=0){let s=t.doc,o=s.getParent(t);if(s.readonly||!o||"content"!==o.role)return;let r=s.getParent(o);if(!r)return;s.captureSync();let a=s.getNexts(t),n=s.getNexts(o);s.moveBlocks(a,t),s.moveBlocks([t],r,o,!1),(0,tf.o)(t,["affine:list"])&&"numbered"===t.type&&s.updateBlock(t,{}),t.children.forEach(e=>{(0,tf.o)(e,["affine:list"])&&"numbered"===e.type&&s.updateBlock(e,{})}),n.filter(e=>(0,tf.o)(e,["affine:list"])&&"numbered"===e.type).forEach(e=>{s.updateBlock(e,{})}),(0,tp.xw)(e,t,{index:i,length:0}).catch(console.error)}function oC(e,t,i=0){let s=t.doc,o=s.getParent(t);for(;o&&!(0,tf.o)(o,["affine:note"]);)o_(e,t,i),o=s.getParent(t)}function ok(e,t){if(function(e,t){let i=t.doc;if(!(0,tf.o)(t,["affine:list"]))return!1;let s=i.getParent(t);if(!s)return!1;let o=i.getNexts(t),r=s.children.indexOf(t),a={type:"text",text:t.text?.clone(),children:t.children};i.captureSync(),i.deleteBlock(t,{deleteChildren:!1}),o.filter(e=>(0,tf.o)(e,["affine:list"])&&"numbered"===e.type).forEach(e=>i.updateBlock(e,{}));let n=i.addBlock("affine:paragraph",a,s,r);return tp.Km(e,n)?.catch(console.error),!0}(e,t)||function(e,t){let i=t.doc;return!!(0,tf.o)(t,["affine:paragraph"])&&("text"!==t.type?(i.captureSync(),i.updateBlock(t,{type:"text"}),!0):!!function(e,t){let i=t.doc,s=i.getParent(t);if(!s)return!1;let o=(0,of.HA)(e,t);if(!o)return function(e,t){let i=t.doc,s=t.text,o=i.getParent(t);if(!o)return!1;if(!(0,of.zB)(e))return(!!(0,tf.o)(o,["affine:edgeless-text"])||t.children.length>0)&&(i.deleteBlock(t,{bringChildrenTo:o}),!0);let r=t.doc.root.title;i.captureSync();let a=0;if(s&&(a=s.length,r.join(s)),i.getNext(t)||t.children.length>0){let e=i.getParent(t);if(!e)return!1;i.deleteBlock(t,{bringChildrenTo:e})}else s?.clear();return(0,tp.Zr)(e,r.length-a),!0}(e,t);if((0,tf.o)(o,["affine:paragraph","affine:list"])){let r=s.children.indexOf(t);if((-1===r||r===s.children.length-1)&&"content"===s.role)return!1;let a=o.text?.length??0;return o.text?.join(t.text),i.deleteBlock(t,{bringChildrenTo:s}),(0,tp.xw)(e,o,{index:a,length:0}).catch(console.error),!0}if((0,tf.o)(o,["affine:attachment","affine:bookmark","affine:code","affine:image","affine:divider",...eh.zu])){let r=(0,of.DG)(e,o);if(!r)return!1;let a=e.selection.create("block",{blockId:r.blockId});return e.selection.setGroup("note",[a]),t.text?.length===0&&i.deleteBlock(t,{bringChildrenTo:s}),!0}return!!(0,tf.o)(o,["affine:edgeless-text"])||((0,tf.o)(s,["affine:database"])?(i.deleteBlock(t),(0,tp.q3)(e,o),!0):!!(0,tf.o)(s,["affine:note"])&&(function(e,t,i,s){let o=t.doc;if(!(0,tf.o)(i,["affine:paragraph","affine:list"]))return!1;o.captureSync();let r=i.text?.length||0;t.text?.length&&i.text?.join(t.text),o.deleteBlock(t,{bringChildrenTo:s});let a=(0,of.h9)(e,i);return a?.setInlineRange({index:r,length:0}),!0}(e,t,o,s)||function(e,t,i,s){let o=t.doc;return(0,tf.o)(i,["affine:divider"])?(o.deleteBlock(i),!0):!!(0,tf.o)(i,["affine:image","affine:code","affine:bookmark","affine:attachment","affine:surface-ref"])&&((0,tp.q3)(e,i),t.text?.length||(o.captureSync(),o.deleteBlock(t,{bringChildrenTo:s})),!0)}(e,t,o,s)))}(e,t)||(o_(e,t),!0))}(e,t))return}let oS=[{name:"parenthesis",left:"(",right:")"},{name:"square bracket",left:"[",right:"]"},{name:"curly bracket",left:"{",right:"}"},{name:"single quote",left:"'",right:"'"},{name:"double quote",left:'"',right:'"'},{name:"angle bracket",left:"<",right:">"},{name:"fullwidth single quote",left:"‘",right:"’"},{name:"fullwidth double quote",left:"“",right:"”"},{name:"fullwidth parenthesis",left:"(",right:")"},{name:"fullwidth square bracket",left:"【",right:"】"},{name:"fullwidth angle bracket",left:"《",right:"》"},{name:"corner bracket",left:"「",right:"」"},{name:"white corner bracket",left:"『",right:"』"}];function oM(e,t){return t.insertText(e,"\n"),t.setInlineRange({index:e.index+1,length:0}),A.rM}function oE(e,t,i,s,o,r=!1){let a=t.doc;o.stopPropagation();let n=a.getParent(t),l=n?.lastChild()===t,c=(0,tf.o)(t,["affine:list"])&&0===t.text.length;if((0,H.Z1)(t.text,"Failed to hardEnter! model.text not exists!"),c&&n&&(0,tf.o)(n,["affine:note","affine:database"])&&0===t.children.length)return ok(e,t),A.rM;if(c&&l)return o_(e,t,i.index),A.rM;let d=t.text.length===i.index,h=oI(t);if(d&&h){if((0,tf.o)(t,["affine:code"]))return r?ow(e,t):oM(i,s),A.rM;let o=t.text.toString(),a="\n"===o||o.endsWith("\n");return h&&!a||r?oM(i,s):(t.text.delete(i.index-1,1),ow(e,t)),A.rM}return d||r?ow(e,t):oI(t)?oM(i,s):(function(e,t,i,s){if(!(t.text instanceof f.EY)||t.text.yText.length0&&i>0){let i=o.addBlock(t.flavour,{text:n,type:t.type},t,0);return(0,tp.Km)(e,i)}{let i=o.addBlock(t.flavour,{text:n,type:t.type},r,a+1),s=o.getBlock(i).model;return o.moveBlocks(t.children,s),(0,tp.Km)(e,i)}})(e,t,i.index,i.length)?.catch(console.error),A.rM}function oI(e){return!!(0,tf.o)(e,["affine:code"])||!!(0,tf.o)(e,["affine:paragraph"])&&"quote"===e.type}let oB=e=>{let t=e.host.selection,i=e.model,s=e.host,o=s.std,r=oS.map(e=>e.left),a=()=>(t.update(i=>i.map(i=>i.blockId===e.blockId?t.create("block",{blockId:e.blockId}):i)),!0),n=i=>(t.update(s=>s.map(s=>s.blockId===e.blockId?t.create("text",{from:{blockId:e.blockId,index:i?0:e.model.text?.length??0,length:0},to:null}):s)),!0),l=()=>{let t=e.querySelector(`[${A.jN}]`);return t?t.inlineEditor:null},c=e=>{let t=e.getInlineRange();if(!t)return"";let i=e.yTextString.search(/\n/);if(-1!==i&&t.index>i)return"";let s=e.getTextPoint(t.index);if(!s)return"";let[o,r]=s;return o.textContent?o.textContent.slice(0,r):""},d=e=>{e.get("defaultState").event.preventDefault()},h=()=>(t.update(i=>i.map(i=>i.blockId!==e.blockId?i:t.create("text",{from:{blockId:e.blockId,index:0,length:e.model.text?.length??0},to:null}))),!0);function u(t){if(!e.selected?.is("text"))return;let i=l();if(!i)return;let s=i.getInlineRange();if(!s)return;let o=c(i);if(!oy(e,i,o,s))return d(t),!0}function p(t){if(!e.selected?.is("text"))return;let o=t.get("keyboardState"),r=l();if(r){var a,n;return((o.raw.stopPropagation(),function(e){let t=e.getInlineRange();return t?.index===e.yText.length&&t?.length===0}(r))?(a=s,n=i,((0,tf.o)(n,["affine:code"])||function(e,t){if(!(0,tf.o)(t,["affine:list"]))return!1;let i=t.doc,s=t.firstChild();if(s){t.text?.join(s.text);let e=s.children;return e&&i.moveBlocks(e,t),i.deleteBlock(s),!0}{let s=i.getNext(t);if(s){if(t.text?.join(s.text),!s.children)return i.deleteBlock(s),!0;{let e=i.getParent(s);return!!e&&(i.moveBlocks(s.children,e,t,!1),i.deleteBlock(s),!0)}}{let s=(0,of.RL)(e,t);if(!s)return!0;if(t.text?.join(s.text),!s.children)return i.deleteBlock(s),!0;{let e=i.getParent(s);return!!e&&(i.moveBlocks(s.children,e,i.getParent(t),!1),i.deleteBlock(s),!0)}}}}(a,n)||function(e,t){let i=t.doc;if(!(0,tf.o)(t,["affine:paragraph"]))return!1;let s=i.getParent(t);if(!s)return!1;let o=i.getNext(t),r=t.firstChild();if((0,tf.o)(s,["affine:database"]))return!1;{let s=["affine:database","affine:image","affine:code","affine:attachment","affine:bookmark",...eh.zu];return!!(o&&(0,tf.o)(o,s))||function(t,i,s,o){let r=(0,of.RL)(e,i);return!o&&!r||function(e,t,i){if(!i||!(0,tf.o)(i,["affine:paragraph","affine:list"]))return!1;let s=i.children;return t.text?.join(i.text),s&&e.moveBlocks(s,t),e.deleteBlock(i),!0}(t,i,o)||function(t,i,s){if(s&&(0,tf.o)(s,["affine:paragraph","affine:list"])){if(i.text?.join(s.text),!s.children)return t.deleteBlock(s),!0;{let e=t.getParent(s);return!!e&&(t.moveBlocks(s.children,e,i,!1),t.deleteBlock(s),!0)}}{let s=(0,of.RL)(e,i);if(!s||!(0,tf.o)(s,["affine:paragraph","affine:list"]))return!1;if(i.text?.join(s.text),!s.children)return t.deleteBlock(s),!0;{let e=t.getParent(s);return!!e&&(t.moveBlocks(s.children,e,t.getParent(i),!1),t.deleteBlock(s),!0)}}}(t,i,s)}(i,t,o,r)||!!(r&&(0,tf.o)(r,["affine:image","affine:divider","affine:code"]))&&((0,tp.q3)(e,r),!0)||function(t){if((0,tf.o)(t,["affine:divider"])){let i=(0,of.DG)(e,t);return!!i&&(e.selection.setGroup("note",[e.selection.create("block",{blockId:i.blockId})]),!0)}return!!(t&&(0,tf.o)(t,["affine:image","affine:code"]))&&((0,tp.q3)(e,t),!0)}(o)}}(a,n))&&function(e){let t=e.doc;(0,tf.a)(t,e,"affine:database")}(n),A.rM):A.gT)||d(t),!0}}e.bindHotKey({ArrowUp:()=>{if(!e.selected?.is("text"))return!1;let t=l();if(!t)return;let i=t.getInlineRange();return!t.isFirstLine(i)},ArrowDown:()=>{if(!e.selected?.is("text"))return!1;let t=l();if(!t)return;let i=t.getInlineRange();return!t.isLastLine(i)},Escape:()=>{if(e.selected?.is("text"))return a()},Enter:t=>{if(d(t),e.selected?.is("block"))return n(!1);let r=t.get("defaultState").event.target;if(!e.host.contains(r)||!e.selected?.is("text"))return;let a=l();if(!a)return;let h=a.getInlineRange();return h?(0,tf.o)(e.model,["affine:list"])?(o.command.exec("splitList",{blockId:e.blockId,inlineIndex:h.index}),!0):(e.doc.captureSync(),!oy(e,a,c(a),h)||(oE(s,i,h,a,t.get("keyboardState").raw),!0)):void 0},"Mod-Enter":t=>{if(!e.selected?.is("text"))return;let r=t.get("keyboardState"),a=l();if(!a)return;let n=a.getInlineRange();if(n)return(d(t),(0,tf.o)(e.model,["affine:list"]))?o.command.exec("splitList",{blockId:e.blockId,inlineIndex:n.index}):oE(s,i,n,a,r.raw,!0),!0},Space:e=>u(e),"Shift-Space":e=>u(e),"Mod-a":t=>{if(d(t),!e.selected?.is("text"))return;let i=e.selected,s=e.querySelector(`[${A.jN}]`);return 0===i.from.index&&i.from.length===s?.inlineEditor.yText.length?a():h()},Tab:t=>{if(!(e.selected?.is("block")||e.selected?.is("text")))return;d(t);{let{selectedModels:t}=o.command.exec("getSelectedModels",{types:["text"]});if(t&&1===t.length){let t=l();if(!t)return;let s=t.getInlineRange();return s?((0,tf.o)(i,["affine:list"])?o.command.exec("indentList",{blockId:i.id,inlineIndex:s.index}):ox(e.host,i,s.index),!0):void 0}}let[s,r]=o.command.chain().getSelectedModels({types:["text","block"]}).run(),a=r.selectedModels;if(a)return function(e,t){if(!t.length)return;let i=t[0].doc,s=-1,o=null;for(let e=0;e{let s=i.getParent(t);s&&!r.includes(s)&&ox(e,t)})}(e.host,a),!0},"Mod-Backspace":t=>{if(!(e.selected?.is("block")||e.selected?.is("text"))||!e.closest("affine-page-root,affine-edgeless-root"))return;{let[s,r]=o.command.chain().getSelectedModels({types:["text"]}).run(),a=r.selectedModels;if(a&&1===a.length){let s=l();if(!s)return;let o=s.getInlineRange();if(!o)return;return 0===o.index&&(oC(e.host,i,o.index),d(t)),!0}}let[s,r]=o.command.chain().getSelectedModels({types:["text","block"]}).run(),a=r.selectedModels;if(a)return function(e,t){if(!t.length)return;let i=t[0].doc;for(let s=t.length-1;s>=0;s--){let o=t[s],r=i.getParent(o);r&&!(0,tf.o)(r,["affine:note"])&&oC(e,o)}}(e.host,a),!0},"Shift-Tab":t=>{if(!(e.selected?.is("block")||e.selected?.is("text"))||!e.closest("affine-page-root,affine-edgeless-root"))return;d(t);{let{selectedModels:t}=o.command.exec("getSelectedModels",{types:["text"]});if(t&&1===t.length){let t=l();if(!t)return;let s=t.getInlineRange();return s?((0,tf.o)(i,["affine:list"])?o.command.exec("unindentList",{blockId:i.id,inlineIndex:s.index}):o_(e.host,i,s.index),!0):void 0}}let[s,r]=o.command.chain().getSelectedModels({types:["text","block"]}).run(),a=r.selectedModels;if(a)return function(e,t){let i;if(!t.length)return;let s=t[0].doc,o=-1;for(let e=0;e=0;t--){let i=r[t],o=s.getParent(i);o&&!r.includes(o)&&o_(e,i)}}(e.host,a),!0},Backspace:t=>{if(!e.selected?.is("text"))return;let o=t.get("keyboardState"),a=l();if(a){if(!function(e,t,i,s){return!function(e){let t=e.getInlineRange();return t?.index===0&&t?.length===0}(s)?(i.stopPropagation(),A.gT):"affine:code"===t.flavour?A.gT:(i.stopPropagation(),ok(e,t),A.rM)}(s,i,o.raw,a)&&d(t),(0,tf.o)(e.model,["affine:code"])){let e=a.getInlineRange();if(!e)return;let i=a.yText.toString()[e.index-1],s=a.yText.toString()[e.index];if(oS[r.indexOf(i)]?.right===s){let i=e.index-1;a.deleteText({index:i,length:2}),a.setInlineRange({index:i,length:0}),d(t)}}return!0}},Delete:e=>p(e),"Control-d":e=>{ij.vL&&p(e)}}),op.forEach(t=>{t.hotkey&&e.bindHotKey({[t.hotkey]:i=>{if(!e.doc.readonly&&e.selection.find("text"))return d(i),t.action(s),!0}})}),oS.forEach(t=>{e.bindHotKey({[t.left]:s=>{if(e.doc.readonly)return;let o=e.selection.find("text");if(!o||o.isCollapsed()&&!(0,tf.o)(e.model,["affine:code"])||!o.isInSameBlock())return;d(s);let r=l();if(!r)return;let a=r.getInlineRange();if(!a)return;let n=r.yText.toString().slice(a.index,a.index+a.length);return!!("square bracket"===t.name&&function(){let t=i.doc.root;if(!t||!e.host.view.viewFromPath("block",(0,of.UL)(i.doc.root))||!e.host.view.getWidget("affine-linked-doc-widget",t.id))return!1;let s=l();if(!s)return;let o=s.getInlineRange();if(!o)return!1;let r=s.yText.toString(),a=r[o.index-1],n=r[o.index+o.length];if(!("["===a&&"]"===n))return!1;let c=r.slice(o.index,o.index+o.length);return s.deleteText({index:o.index-1,length:o.length+2}),s.setInlineRange({index:o.index-1,length:0}),ol({inlineEditor:s,docId:(0,s5.U)(e.doc.collection,{title:c}).id}),!0}())||(r.insertText(a,t.left+n+t.right),r.setInlineRange({index:a.index+1,length:a.length}),!0)}})}),oS.forEach(t=>{e.bindHotKey({[t.right]:i=>{if(!(0,tf.o)(e.model,["affine:code"]))return;let s=l();if(!s)return;let o=s.getInlineRange();if(!o)return;let r=s.yText.toString()[o.index-1],a=s.yText.toString()[o.index];t.left===r&&t.right===a&&(s.setInlineRange({index:o.index+1,length:0}),d(i))}})}),e.bindHotKey({"`":t=>{if(e.doc.readonly)return;let i=e.selection.find("text");if(!i||i.isCollapsed()||!i.isInSameBlock())return;d(t);let s=l();if(!s)return;let o=s.getInlineRange();if(o)return s.formatText(o,{code:!0}),s.setInlineRange({index:o.index,length:o.length}),!0}})};var o$=i(23725),oT=i(30955);let oO=(0,L.AH)` .affine-bookmark-card { margin: 0 auto; box-sizing: border-box; display: flex; width: 100%; height: ${eh.Hn.horizontal}px; border-radius: 8px; border: 1px solid var(--affine-background-tertiary-color); opacity: var(--add, 1); background: var(--affine-background-primary-color); user-select: none; } .affine-bookmark-content { width: calc(100% - 204px); height: 100%; display: flex; flex-direction: column; align-self: stretch; gap: 4px; padding: 12px; border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-bookmark-content-title { display: flex; flex-direction: row; gap: 8px; align-items: center; align-self: stretch; padding: var(--1, 0px); border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-bookmark-content-title-icon { display: flex; width: 16px; height: 16px; justify-content: center; align-items: center; } .affine-bookmark-content-title-icon img, .affine-bookmark-content-title-icon object, .affine-bookmark-content-title-icon svg { width: 16px; height: 16px; fill: var(--affine-background-primary-color); } .affine-bookmark-content-title-text { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-word; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 600; line-height: 22px; } .affine-bookmark-content-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; flex-grow: 1; white-space: normal; word-break: break-word; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-bookmark-content-url { display: flex; align-items: center; justify-content: flex-start; gap: 4px; width: max-content; max-width: 100%; cursor: pointer; } .affine-bookmark-content-url > span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-all; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-secondary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-bookmark-content-url:hover > span { color: var(--affine-link-color); } .affine-bookmark-content-url:hover .open-icon { fill: var(--affine-link-color); } .affine-bookmark-content-url-icon { display: flex; align-items: center; justify-content: center; width: 12px; height: 20px; } .affine-bookmark-content-url-icon .open-icon { height: 12px; width: 12px; fill: var(--affine-text-secondary-color); } .affine-bookmark-banner { margin: 12px 12px 0px 0px; width: 204px; max-width: 100%; height: 102px; opacity: var(--add, 1); } .affine-bookmark-banner img, .affine-bookmark-banner object, .affine-bookmark-banner svg { width: 204px; max-width: 100%; height: 102px; object-fit: cover; border-radius: 4px 4px var(--1, 0px) var(--1, 0px); } .affine-bookmark-card.loading { .affine-bookmark-content-title-text { color: var(--affine-placeholder-color); } } .affine-bookmark-card.error { .affine-bookmark-content-description { color: var(--affine-placeholder-color); } } .affine-bookmark-card.selected { .affine-bookmark-content-url > span { color: var(--affine-link-color); } .affine-bookmark-content-url .open-icon { fill: var(--affine-link-color); } } .affine-bookmark-card.list { height: ${eh.Hn.list}px; .affine-bookmark-content { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; } .affine-bookmark-content-title { width: calc(100% - 204px); } .affine-bookmark-content-url { width: 204px; justify-content: flex-end; } .affine-bookmark-content-description { display: none; } .affine-bookmark-banner { display: none; } } .affine-bookmark-card.vertical { width: ${eh.Cd.vertical}px; height: ${eh.Hn.vertical}px; flex-direction: column-reverse; .affine-bookmark-content { width: 100%; } .affine-bookmark-content-description { -webkit-line-clamp: 6; max-height: 120px; } .affine-bookmark-content-url { flex-grow: 1; align-items: flex-end; } .affine-bookmark-banner { width: 340px; height: 170px; margin-left: 12px; } .affine-bookmark-banner img, .affine-bookmark-banner object, .affine-bookmark-banner svg { width: 340px; height: 170px; } } .affine-bookmark-card.cube { width: ${eh.Cd.cube}px; height: ${eh.Hn.cube}px; .affine-bookmark-content { width: 100%; flex-direction: column; align-items: flex-start; justify-content: space-between; } .affine-bookmark-content-title { flex-direction: column; gap: 4px; align-items: flex-start; } .affine-bookmark-content-title-text { -webkit-line-clamp: 2; } .affine-bookmark-content-description { display: none; } .affine-bookmark-banner { display: none; } } `;var oP=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oH=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("bookmark-card")],n=[],l=(0,P.Tm)(P.ao),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],oP(this,null,i,{kind:"accessor",name:"_isSelected",static:!1,private:!1,access:{has:e=>"_isSelected"in e,get:e=>e._isSelected,set:(e,t)=>{e._isSelected=t}},metadata:v},c,d),oP(this,null,s,{kind:"accessor",name:"bookmark",static:!1,private:!1,access:{has:e=>"bookmark"in e,get:e=>e.bookmark,set:(e,t)=>{e.bookmark=t}},metadata:v},h,u),oP(this,null,o,{kind:"accessor",name:"error",static:!1,private:!1,access:{has:e=>"error"in e,get:e=>e.error,set:(e,t)=>{e.error=t}},metadata:v},p,f),oP(this,null,r,{kind:"accessor",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:v},g,m),oP(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=oO}_handleClick(e){e.stopPropagation(),this.bookmark.isInSurface||this._selectBlock()}_handleDoubleClick(e){e.stopPropagation(),this.bookmark.open()}_selectBlock(){let e=this.bookmark.host.selection,t=e.create("block",{blockId:this.bookmark.blockId});e.setGroup("note",[t])}connectedCallback(){super.connectedCallback(),this.disposables.add(this.bookmark.model.propsUpdated.on(()=>{this.requestUpdate()})),this.disposables.add(j.Q.subscribe(()=>this.requestUpdate())),this.disposables.add(this.bookmark.selection.slots.changed.on(()=>{this._isSelected=!!this.bookmark.selected?.is("block")||!!this.bookmark.selected?.is("surface")}))}render(){let{icon:e,title:t,url:i,description:s,image:o,style:r}=this.bookmark.model,a=(0,sZ.H)({loading:this.loading,error:this.error,[r]:!0,selected:this._isSelected}),n=i.match(/^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:/\n]+)/im)?.[1],l=this.loading?"Loading...":t||(this.error?n??"Link card":""),{LoadingIcon:c,EmbedCardBannerIcon:d}=(0,oT.Yr)(),h=e?.split(".").pop()&&e?.split(".").pop()!=="svg"?e?.split(".").pop():"svg+xml",u=this.loading?c:e?(0,L.qy)` ${sv.NR} `:sv.NR,p=this.loading?"":s?s??"":this.error?"Failed to retrieve link information.":i,f=!this.loading&&o?(0,L.qy)` ${d} `:d;return(0,L.qy)`
${u}
${l}
${p}
${(0,oT.yz)(i)}
${(0,o$.PHA)({width:"12",height:"12"})}
${f}
`}#i9=oH(this,c,!1);get _isSelected(){return this.#i9}set _isSelected(e){this.#i9=e}#se=(oH(this,d),oH(this,h,void 0));get bookmark(){return this.#se}set bookmark(e){this.#se=e}#st=(oH(this,u),oH(this,p,void 0));get error(){return this.#st}set error(e){this.#st=e}#si=(oH(this,f),oH(this,g,void 0));get loading(){return this.#si}set loading(e){this.#si=e}constructor(){super(...arguments),oH(this,m)}static{oH(t,n)}})})();var oA=i(18132);async function oL(e,t){let i=null,s=null,o=null,r=null;try{e.loading=!0;let a=e.service?.queryUrlData;(0,H.Z1)(a);let n=await a(e.model.url,t);if(i=n.title??null,s=n.description??null,o=n.icon??null,r=n.image??null,i||s||o||r||(e.error=!0),t?.aborted)return;e.doc.updateBlock(e.model,{title:i,description:s,icon:o,image:r})}catch(e){if(t?.aborted||(0,oA.z)(e))return;throw e}finally{e.loading=!1}}var oD=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oZ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("affine-bookmark")],a=[],n=s0.w,l=[],c=[],d=[],h=[],u=[],f=[];return class extends n{static{t=this}constructor(){super(...arguments),this._isInSurface=!1,this.open=()=>{let e=this.model.url;e.match(/^[a-zA-Z]+:\/\//)||(e="https://"+e),window.open(e,"_blank")},this.refreshData=()=>{oL(this,this._fetchAbortController?.signal).catch(console.error)},this.#ss=oZ(this,l,void 0),this.#st=(oZ(this,c),oZ(this,d,!1)),this.#si=(oZ(this,h),oZ(this,u,!1)),this.#$=(oZ(this,f),!0)}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.P)("bookmark-card")],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],oD(this,null,i,{kind:"accessor",name:"bookmarkCard",static:!1,private:!1,access:{has:e=>"bookmarkCard"in e,get:e=>e.bookmarkCard,set:(e,t)=>{e.bookmarkCard=t}},metadata:p},l,c),oD(this,null,s,{kind:"accessor",name:"error",static:!1,private:!1,access:{has:e=>"error"in e,get:e=>e.error,set:(e,t)=>{e.error=t}},metadata:p},d,h),oD(this,null,o,{kind:"accessor",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:p},u,f),oD(null,e={value:t},r,{kind:"class",name:t.name,metadata:p},null,a),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p}),oZ(t,a)}connectedCallback(){super.connectedCallback(),oB(this),this._fetchAbortController=new AbortController,this.contentEditable="false";let e=this.host.doc.getParent(this.model);this._isInSurface=e?.flavour==="affine:surface",this.blockContainerStyles=this._isInSurface?void 0:{margin:"18px 0"},this.model.description||this.model.title||this.refreshData(),this.disposables.add(this.model.propsUpdated.on(({key:e})=>{"url"===e&&this.refreshData()})),this._isInSurface&&(this.style.position="absolute")}disconnectedCallback(){super.disconnectedCallback(),this._fetchAbortController?.abort()}renderBlock(){let{style:e}=this.model,t=(0,Z.W)({position:"relative",width:"100%",minWidth:"450px"});if(this.isInSurface){let i=eh.Cd[e],s=eh.Hn[e],o=p.z.deserialize((this.rootService?.getElementById(this.model.id)??this.model).xywh),r=o.w/i,a=o.h/s;t=(0,Z.W)({width:"100%",height:"100%",transform:`scale(${r}, ${a})`,transformOrigin:"0 0"}),this.style.left=`${o.x}px`,this.style.top=`${o.y}px`,this.style.width=`${i}px`,this.style.height=`${s}px`,this.style.zIndex=`${this.toZIndex()}`}return(0,L.qy)`
`}toZIndex(){return this.rootService?.layer.getZIndex(this.model)??1}updateZIndex(){this.style.zIndex=`${this.toZIndex()}`}get isInSurface(){return this._isInSurface}get rootService(){let e=this.host.spec.getService("affine:page");return e.surface?e:null}#ss;get bookmarkCard(){return this.#ss}set bookmarkCard(e){this.#ss=e}#st;get error(){return this.#st}set error(e){this.#st=e}#si;get loading(){return this.#si}set loading(e){this.#si=e}#$;get useCaptionEditor(){return this.#$}set useCaptionEditor(e){this.#$=e}},t})(),oV=(0,L.AH)` .embed-block-container { border-radius: 8px; } .embed-block-container.selected.light { box-shadow: 0px 0px 0px 1px var(--affine-brand-color); } .embed-block-container.selected.dark { box-shadow: 0px 0px 0px 1px var(--affine-brand-color); } `;var oz=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oR=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e=s0.w,t=[],i=[];return class extends e{constructor(){super(...arguments),this._cardStyle="horizontal",this._dragHandleOption={flavour:/affine:embed-*/,edgeless:!0,onDragStart:({state:e,startDragging:t,anchorBlockPath:i,editorHost:s})=>{if(!i)return!1;let o=s.std.view.getBlock(i);if(!o||!(0,O.op)(o.model,[this.flavour]))return!1;let r=i8(e.raw.target),a=!!r?.closest(sf),n=o.contains(r),l=o.isInSurface;if(!l&&(a||n))return s.selection.setGroup("note",[s.selection.create("block",{blockId:o.blockId})]),t([o],e),!0;if(l&&a){let i=s.std.spec.getService("affine:page"),r=i?.viewport.zoom??1,a=document.createElement("div"),n=p.z.deserialize(o.model.xywh),l=new u.b(n.x*r,n.y*r);return(0,L.XX)(o.host.renderModel(o.model),a),t([o],e,a,l),!0}return!1},onDragEnd:e=>{let{state:t,draggingElements:i}=e;if(1!==i.length||!(0,O.op)(i[0].model,[this.flavour]))return!1;let s=i[0],o=s.isInSurface,r=i8(t.raw.target),a=r?.classList.contains("edgeless-container");if(o){let t=s._cardStyle;return sh({blockComponent:s,style:"vertical"===t||"cube"===t?"horizontal":t,...e})}if(a){let t=s._cardStyle;return sd({blockComponent:s,cssSelector:".embed-block-container",width:eh.Cd[t],height:eh.Hn[t],...e})}return!1}},this._fetchAbortController=new AbortController,this._height=eh.Hn.horizontal,this._isInSurface=!1,this._width=eh.Cd.horizontal,this.renderEmbed=e=>{let t=j.Q.mode,i=!!this.selected?.is("block");if(!this.isInSurface)return("horizontal"===this._cardStyle||"horizontalThin"===this._cardStyle||"list"===this._cardStyle)&&(this.style.display="block",this.style.minWidth="450px"),(0,L.qy)`
${e()}
`;let s=this._width,o=this._height,r=p.z.deserialize(this.model.xywh),a=r.w/s,n=r.h/o;return this.style.left=`${r.x}px`,this.style.top=`${r.y}px`,this.style.width=`${s}px`,this.style.height=`${o}px`,this.style.zIndex=`${this.toZIndex()}`,(0,L.qy)`
${e()}
`},this.#so=oR(this,t,void 0),this.#B=(oR(this,i),!1),this.#$=!0}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(e[Symbol.metadata]??null):void 0;oz(this,null,[(0,D.P)(".embed-block-container")],{kind:"accessor",name:"embedBlock",static:!1,private:!1,access:{has:e=>"embedBlock"in e,get:e=>e.embedBlock,set:(e,t)=>{e.embedBlock=t}},metadata:s},t,i),s&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=oV}connectedCallback(){super.connectedCallback(),this._fetchAbortController.signal.aborted&&(this._fetchAbortController=new AbortController),this.contentEditable="false";let e=this.host.doc.getParent(this.model);this._isInSurface=e?.flavour==="affine:surface",this.blockContainerStyles=this.isInSurface?void 0:{margin:"18px 0"},this.disposables.add(sg.registerOption(this._dragHandleOption)),this.isInSurface&&(this.style.position="absolute")}disconnectedCallback(){super.disconnectedCallback(),this._fetchAbortController.abort()}toZIndex(){return this.rootService?.layer.getZIndex(this.model)??1}updateZIndex(){this.style.zIndex=`${this.toZIndex()}`}get bound(){return p.z.deserialize(this.model.xywh)}get fetchAbortController(){return this._fetchAbortController}get isInSurface(){return this._isInSurface}get rootService(){let e=this.host.spec.getService("affine:page");return e?.surface?e:null}#so;get embedBlock(){return this.#so}set embedBlock(e){this.#so=e}#B;get showBlockSelection(){return this.#B}set showBlockSelection(e){this.#B=e}#$;get useCaptionEditor(){return this.#$}set useCaptionEditor(e){this.#$=e}}})(),oN=(0,L.AH)` .affine-embed-figma-block { margin: 0 auto; box-sizing: border-box; width: 100%; height: ${eh.Hn.figma}px; display: flex; flex-direction: column; gap: 20px; padding: 12px; border-radius: 8px; border: 1px solid var(--affine-background-tertiary-color); opacity: var(--add, 1); background: var(--affine-background-primary-color); user-select: none; } .affine-embed-figma { width: 100%; height: 100%; opacity: var(--add, 1); } .affine-embed-figma img, .affine-embed-figma object, .affine-embed-figma svg { width: 100%; height: 100%; object-fit: cover; border-radius: 4px 4px var(--1, 0px) var(--1, 0px); } .affine-embed-figma-iframe-container { position: relative; } .affine-embed-figma-iframe-container > iframe { width: 100%; height: 410px; border-radius: 4px 4px var(--1, 0px) var(--1, 0px); border: none; } .affine-embed-figma-iframe-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .affine-embed-figma-iframe-overlay.hide { display: none; } .affine-embed-figma-content { display: flex; flex-direction: column; width: 100%; height: 100%; border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-figma-content-header { display: flex; flex-direction: row; gap: 8px; align-items: center; align-self: stretch; padding: var(--1, 0px); border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-figma-content-title-icon { display: flex; width: 20px; height: 20px; justify-content: center; align-items: center; } .affine-embed-figma-content-title-icon img, .affine-embed-figma-content-title-icon object, .affine-embed-figma-content-title-icon svg { width: 20px; height: 20px; fill: var(--affine-background-primary-color); } .affine-embed-figma-content-title-text { flex: 1 0 0; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-word; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 600; line-height: 22px; } .affine-embed-figma-content-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; flex: 1 0 0; align-self: stretch; word-break: break-word; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-figma-content-url { display: flex; align-items: center; justify-content: flex-start; gap: 4px; width: max-content; max-width: 100%; cursor: pointer; } .affine-embed-figma-content-url > span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-all; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-secondary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-figma-content-url:hover > span { color: var(--affine-link-color); } .affine-embed-figma-content-url:hover .open-icon { fill: var(--affine-link-color); } .affine-embed-figma-content-url-icon { display: flex; align-items: center; justify-content: center; width: 12px; height: 12px; } .affine-embed-figma-content-url-icon .open-icon { height: 12px; width: 12px; fill: var(--affine-text-secondary-color); } .affine-embed-figma-block.selected { .affine-embed-figma-content-url > span { color: var(--affine-link-color); } .affine-embed-figma-content-url .open-icon { fill: var(--affine-link-color); } } `,oq=(0,L.qy)` `;var oU=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},oW=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("affine-embed-figma-block")],r=[],a=oF,n=[],l=[],c=[],d=[];return class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],oU(this,null,i,{kind:"accessor",name:"_isSelected",static:!1,private:!1,access:{has:e=>"_isSelected"in e,get:e=>e._isSelected,set:(e,t)=>{e._isSelected=t}},metadata:h},n,l),oU(this,null,s,{kind:"accessor",name:"_showOverlay",static:!1,private:!1,access:{has:e=>"_showOverlay"in e,get:e=>e._showOverlay,set:(e,t)=>{e._showOverlay=t}},metadata:h},c,d),oU(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=oN}_handleClick(e){e.stopPropagation(),this.isInSurface||this._selectBlock()}_handleDoubleClick(e){e.stopPropagation(),this.open()}_selectBlock(){let e=this.host.selection,t=e.create("block",{blockId:this.blockId});e.setGroup("note",[t])}connectedCallback(){super.connectedCallback(),this.model.description||this.model.title||this.doc.withoutTransact(()=>{this.doc.updateBlock(this.model,{title:"Figma",description:this.model.url})}),this.disposables.add(this.model.propsUpdated.on(({key:e})=>{"url"===e&&this.refreshData()})),this.disposables.add(this.std.selection.slots.changed.on(()=>{this._isSelected=!!this.selected?.is("block")||!!this.selected?.is("surface"),this._showOverlay=this._isResizing||this._isDragging||!this._isSelected})),this.handleEvent("dragStart",()=>{this._isDragging=!0,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}),this.handleEvent("dragEnd",()=>{this._isDragging=!1,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}),this.isInSurface&&(this.disposables.add(this.model.propsUpdated.on(()=>{this.requestUpdate()})),this.rootService?.slots.elementResizeStart.on(()=>{this._isResizing=!0,this._showOverlay=!0}),this.rootService?.slots.elementResizeEnd.on(()=>{this._isResizing=!1,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}))}renderBlock(){let{title:e,description:t,style:i,url:s}=this.model;this._cardStyle=i,this._width=eh.Cd[this._cardStyle],this._height=eh.Hn[this._cardStyle];let o=e??"Figma",r=t??s;return this.renderEmbed(()=>(0,L.qy)`
${oq}
${o}
${r}
www.figma.com
${sv.gb}
`)}#i9;get _isSelected(){return this.#i9}set _isSelected(e){this.#i9=e}#sr;get _showOverlay(){return this.#sr}set _showOverlay(e){this.#sr=e}constructor(){super(...arguments),this._cardStyle="figma",this._isDragging=!1,this._isResizing=!1,this.open=()=>{let e=this.model.url;e.match(/^[a-zA-Z]+:\/\//)||(e="https://"+e),window.open(e,"_blank")},this.refreshData=()=>{},this.#i9=oW(this,n,!1),this.#sr=(oW(this,l),oW(this,c,!0)),oW(this,d)}static{oW(t,r)}},t})();var oY=i(9456);let oK=(0,L.AH)` .affine-embed-github-block { margin: 0 auto; box-sizing: border-box; display: flex; width: 100%; height: ${eh.Hn.horizontal}px; border-radius: 8px; border: 1px solid var(--affine-background-tertiary-color); opacity: var(--add, 1); background: var(--affine-background-primary-color); user-select: none; } .affine-embed-github-content { width: calc(100% - 204px); height: 100%; display: flex; flex-direction: column; align-self: stretch; gap: 4px; padding: 12px; border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-github-content-title { display: flex; min-height: 22px; flex-direction: row; gap: 8px; align-items: center; align-self: stretch; padding: var(--1, 0px); border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-github-content-title-icons { display: flex; justify-content: center; align-items: center; gap: 8px; } .affine-embed-github-content-title-icons img, .affine-embed-github-content-title-icons object, .affine-embed-github-content-title-icons svg { width: 16px; height: 16px; color: var(--affine-pure-white); } .affine-embed-github-content-title-site-icon { display: flex; width: 16px; height: 16px; justify-content: center; align-items: center; .github-icon { fill: var(--affine-black); color: var(--affine-black); } } .affine-embed-github-content-title-status-icon { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 20px; color: var(--affine-pure-white); leading-trim: both; text-edge: cap; font-feature-settings: 'clig' off, 'liga' off; text-transform: capitalize; font-family: var(--affine-font-family); font-size: 12px; font-style: normal; font-weight: 500; line-height: 16px; } .affine-embed-github-content-title-status-icon.issue.open { background: #238636; } .affine-embed-github-content-title-status-icon.issue.closed.success { background: #8957e5; } .affine-embed-github-content-title-status-icon.issue.closed.failure { background: #6e7681; } .affine-embed-github-content-title-status-icon.pr.open { background: #238636; } .affine-embed-github-content-title-status-icon.pr.draft { background: #6e7681; } .affine-embed-github-content-title-status-icon.pr.merged { background: #8957e5; } .affine-embed-github-content-title-status-icon.pr.closed { background: #c03737; } .affine-embed-github-content-title-status-icon > svg { height: 16px; width: 16px; padding: 2px; } .affine-embed-github-content-title-status-icon > span { padding: 0px 1.5px; } .affine-embed-github-content-title-text { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-word; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 600; line-height: 22px; } .affine-embed-github-content-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; flex-grow: 1; word-break: break-word; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-github-content-assignees { display: none; } .affine-embed-github-content-url { display: flex; align-items: center; justify-content: flex-start; gap: 4px; width: max-content; max-width: 100%; cursor: pointer; } .affine-embed-github-content-url > span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-all; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-secondary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-github-content-url:hover > span { color: var(--affine-link-color); } .affine-embed-github-content-url:hover .open-icon { fill: var(--affine-link-color); } .affine-embed-github-content-url-icon { display: flex; align-items: center; justify-content: center; width: 12px; height: 12px; } .affine-embed-github-content-url-icon .open-icon { height: 12px; width: 12px; fill: var(--affine-text-secondary-color); } .affine-embed-github-banner { margin: 12px 12px 0px 0px; width: 204px; height: 102px; max-width: 100%; opacity: var(--add, 1); } .affine-embed-github-banner img, .affine-embed-github-banner object, .affine-embed-github-banner svg { width: 204px; max-width: 100%; height: 102px; object-fit: cover; border-radius: 4px 4px var(--1, 0px) var(--1, 0px); } .affine-embed-github-block.loading { .affine-embed-github-content-title-text { color: var(--affine-placeholder-color); } } .affine-embed-github-block.selected { .affine-embed-github-content-url > span { color: var(--affine-link-color); } .affine-embed-github-content-url .open-icon { fill: var(--affine-link-color); } } .affine-embed-github-block.list { height: ${eh.Hn.list}px; .affine-embed-github-content { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; } .affine-embed-github-content-title { width: 660px; } .affine-embed-github-content-repo { display: none; } .affine-embed-github-content-date { display: none; } .affine-embed-github-content-url { width: 90px; justify-content: flex-end; } .affine-embed-github-content-description { display: none; } .affine-embed-github-banner { display: none; } } .affine-embed-github-block.vertical { width: ${eh.Cd.vertical}px; height: ${eh.Hn.vertical}px; flex-direction: column-reverse; .affine-embed-github-content { width: 100%; } .affine-embed-github-content-description { -webkit-line-clamp: 6; } .affine-embed-github-content-assignees { display: flex; padding: var(--1, 0px); align-items: center; justify-content: flex-start; gap: 2px; align-self: stretch; } .affine-embed-github-content-assignees-text { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 600; line-height: 20px; } .affine-embed-github-content-assignees-text.label { width: 72px; color: var(--affine-text-primary-color); font-weight: 600; } .affine-embed-github-content-assignees-text.users { width: calc(100% - 72px); word-break: break-all; white-space: normal; overflow: hidden; text-overflow: ellipsis; font-weight: 400; } .affine-embed-github-content-assignees-text-users.user { color: var(--affine-link-color); cursor: pointer; } .affine-embed-github-content-assignees-text-users.placeholder { color: var(--affine-placeholder-color); } .affine-embed-github-banner { width: 340px; height: 170px; margin-left: 12px; } .affine-embed-github-banner img, .affine-embed-github-banner object, .affine-embed-github-banner svg { width: 340px; height: 170px; } } .affine-embed-github-block.cube { width: ${eh.Cd.cube}px; height: ${eh.Hn.cube}px; .affine-embed-github-content { width: 100%; flex-direction: column; align-items: flex-start; justify-content: space-between; } .affine-embed-github-content-title { flex-direction: column; gap: 4px; align-items: flex-start; } .affine-embed-github-content-title-text { -webkit-line-clamp: 2; } .affine-embed-github-content-description { display: none; } .affine-embed-github-banner { display: none; } .affine-embed-github-content-repo { display: none; } .affine-embed-github-content-date { display: none; } } `,oX=(0,L.qy)` `,oQ=(0,L.qy)` `,oJ=(0,L.qy)``,o1=(0,L.qy)``,o0=(0,L.qy)``,o2=(0,L.qy)``,o5=(0,L.qy)``,o7=(0,L.qy)``;async function o3(e,t,i){let[s,o]=await Promise.all([o4(e,i),t.query(e.url,i)]);return{...s,...o}}async function o4(e,t){let{owner:i,repo:s,githubType:o,githubId:r}=e,a={},n=`https://api.github.com/repos/${i}/${s}/${"issue"===o?"issues":"pulls"}/${r}`,l=await fetch(n,{cache:"no-cache",signal:t}).catch(()=>null);if(l&&l.ok){let{state:e,state_reason:t,draft:i,merged:s,created_at:o,assignees:r}=await l.json(),n=r.map(e=>e.login),c=e;s?c="merged":"open"===e&&i&&(c="draft"),a={status:c,statusReason:t,createdAt:o,assignees:n}}return a}async function o6(e,t){let i=null,s=null,o=null,r=null,a=null,n=null,l=null;try{e.loading=!0;let c=e.service?.queryUrlData;(0,H.Z1)(c);let d=await c(e.model);if({image:i=null,status:s=null,statusReason:o=null,title:r=null,description:a=null,createdAt:n=null,assignees:l=null}=d,t?.aborted)return;e.doc.updateBlock(e.model,{image:i,status:s,statusReason:o,title:r,description:a,createdAt:n,assignees:l})}catch(e){if(t?.aborted||(0,oA.z)(e))return;throw Error}finally{e.loading=!1}}async function o8(e,t){let i=e.service?.queryApiData;(0,H.Z1)(i);let s=await i(e.model,t);!s.status||t?.aborted||e.doc.updateBlock(e.model,{status:s.status,statusReason:s.statusReason,createdAt:s.createdAt,assignees:s.assignees})}var o9=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},re=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("affine-embed-github-block")],r=[],a=oF,n=[],l=[],c=[],d=[];return class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.MZ)({attribute:!1})],o9(this,null,i,{kind:"accessor",name:"_isSelected",static:!1,private:!1,access:{has:e=>"_isSelected"in e,get:e=>e._isSelected,set:(e,t)=>{e._isSelected=t}},metadata:h},n,l),o9(this,null,s,{kind:"accessor",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:h},c,d),o9(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=oK}_handleAssigneeClick(e){let t=`https://www.github.com/${e}`;window.open(t,"_blank")}_handleClick(e){e.stopPropagation(),this.isInSurface||this._selectBlock()}_handleDoubleClick(e){e.stopPropagation(),this.open()}_selectBlock(){let e=this.host.selection,t=e.create("block",{blockId:this.blockId});e.setGroup("note",[t])}connectedCallback(){super.connectedCallback(),this.model.owner&&this.model.repo&&this.model.githubId||this.doc.withoutTransact(()=>{let e=this.model.url.match(oY.EO);if(e){let[,t,i,s,o]=e;this.doc.updateBlock(this.model,{owner:t,repo:i,githubType:"issue"===s?"issue":"pr",githubId:o})}}),this.doc.withoutTransact(()=>{this.model.description||this.model.title?this.refreshStatus():this.refreshData()}),this.disposables.add(this.model.propsUpdated.on(({key:e})=>{"url"===e&&this.refreshData()})),this.disposables.add(this.selection.slots.changed.on(()=>{this._isSelected=!!this.selected?.is("block")||!!this.selected?.is("surface")})),this.isInSurface&&this.disposables.add(this.model.propsUpdated.on(()=>{this.requestUpdate()}))}renderBlock(){let{title:e="GitHub",githubType:t,status:i,statusReason:s,owner:o,repo:r,createdAt:a,assignees:n,description:l,image:c,style:d}=this.model;this._cardStyle=d,this._width=eh.Cd[this._cardStyle],this._height=eh.Hn[this._cardStyle];let h=this.loading,{LoadingIcon:u,EmbedCardBannerIcon:p}=(0,oT.Yr)(),f=h?u:oX,g=i?function(e,t,i){if("issue"===e){if("open"===t)return oQ;if("closed"===t&&"completed"===i)return oJ;if("closed"===t&&"not_planned"===i)return o1}else if("pr"===e){if("open"===t)return o0;if("draft"===t)return o2;if("merged"===t)return o5;if("closed"===t)return o7}return L.s6}(t,i,s):L.s6,m=h?"":i,v=h?"Loading...":e,y=h?"":l,b=!h&&c?(0,L.qy)` ${p} `:p,w="";if(a){let e=new Date(a);w=e.toLocaleDateString("en-US",{month:"short",day:"numeric"});let t=e.getDate(),i=["th","st","nd","rd"][(t/10|0)!=1?t%10:4]||"th";w=w.replace(/\d+/,`${t}${i}`)}return this.renderEmbed(()=>(0,L.qy)`
${f}
${i&&m?(0,L.qy)`
${g} ${m}
`:L.s6}
${v}
${y}
${"issue"===t&&n?(0,L.qy)`
Assignees
${0===n.length?(0,L.qy)`No one`:(0,t$.u)(n,e=>e,(e,t)=>(0,L.qy)`this._handleAssigneeClick(e)} >${`@${e}`} ${t===n.length-1?"":", "}`)}
`:L.s6}
${`${o}/${r} |`} ${a?(0,L.qy)``:L.s6} github.com
${sv.gb}
${b}
`)}#i9;get _isSelected(){return this.#i9}set _isSelected(e){this.#i9=e}#si;get loading(){return this.#si}set loading(e){this.#si=e}constructor(){super(...arguments),this._cardStyle="horizontal",this.open=()=>{let e=this.model.url;e.match(/^[a-zA-Z]+:\/\//)||(e="https://"+e),window.open(e,"_blank")},this.refreshData=()=>{o6(this,this.fetchAbortController.signal).catch(console.error)},this.refreshStatus=()=>{o8(this,this.fetchAbortController.signal).catch(console.error)},this.#i9=re(this,n,!1),this.#si=(re(this,l),re(this,c,!1)),re(this,d)}static{re(t,r)}},t})();var ri=i(52222);i(76020);var rs=i(91721);let ro=(0,L.AH)` .edgeless-block-portal-embed > affine-embed-synced-doc-block[data-nested-editor] { position: relative; display: block; left: 0px; top: 0px; width: 100%; height: 100%; } .edgeless-block-portal-embed .affine-embed-synced-doc-editor .affine-page-root-block-container { width: 100%; } .edgeless-block-portal-embed .affine-embed-synced-doc-container.edgeless { display: block; padding: 0; width: 100%; height: calc(${eh.Hn.syncedDoc}px + 36px); } .edgeless-block-portal-embed .affine-embed-synced-doc-container.surface { border: 1px solid var(--affine-border-color); } affine-embed-synced-doc-block[data-nested-editor] .affine-embed-synced-doc-container.page { padding: 0 24px; } .affine-embed-synced-doc-editor { pointer-events: none; } .affine-embed-synced-doc-container { border-radius: 8px; overflow: hidden; } .affine-embed-synced-doc-container.page { display: block; width: 100%; } .affine-embed-synced-doc-container.edgeless { display: block; width: 100%; height: calc(${eh.Hn.syncedDoc}px + 36px); } .affine-embed-synced-doc-container:hover.light { box-shadow: 0px 0px 0px 2px rgba(0, 0, 0, 0.08); } .affine-embed-synced-doc-container:hover.dark { box-shadow: 0px 0px 0px 2px rgba(255, 255, 255, 0.14); } .affine-embed-synced-doc-header-wrapper { position: absolute; top: 0; left: 0; height: 34px; width: 100%; background-color: var(--affine-white); opacity: 0; } .affine-embed-synced-doc-header-wrapper.selected { opacity: 1; transition: all 0.23s ease; } .affine-embed-synced-doc-header { display: flex; align-items: center; width: 100%; height: 100%; padding: 0 24px; background-color: var(--affine-hover-color); } .affine-embed-synced-doc-header svg { flex-shrink: 0; } .affine-embed-synced-doc-title { font-size: 14px; font-weight: 600; line-height: 22px; margin-left: 8px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .affine-embed-synced-doc-editor-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; cursor: pointer; } .affine-embed-synced-doc-editor-overlay:hover { background: var(--affine-hover-color); } .affine-embed-synced-doc-editor-empty { display: flex; align-items: center; width: 100%; height: 100%; min-height: 44px; } .affine-embed-synced-doc-container.surface > .affine-embed-synced-doc-editor > .affine-embed-synced-doc-editor-empty { left: 0; justify-content: center; } .affine-embed-synced-doc-editor-empty > span { color: var(--affine-placeholder-color); font-feature-settings: 'clig' off, 'liga' off; font-family: var(--affine-font-family); font-size: 15px; font-style: normal; font-weight: 400; line-height: 24px; } .affine-embed-synced-doc-container.surface { background: var(--affine-background-primary-color); } .affine-embed-synced-doc-container > .affine-embed-synced-doc-editor.affine-page-viewport { background: transparent; } .affine-embed-synced-doc-container > .affine-embed-synced-doc-editor { width: 100%; height: 100%; } .affine-embed-synced-doc-editor .affine-page-root-block-container { width: 100%; max-width: 100%; } `,rr=(0,L.AH)` .affine-embed-synced-doc-card { margin: 0 auto; box-sizing: border-box; display: flex; width: 100%; height: ${eh.Hn.horizontal}px; border-radius: 8px; border: 1px solid var(--affine-background-tertiary-color); opacity: var(--add, 1); background: var(--affine-background-primary-color); user-select: none; } .affine-embed-synced-doc-card-content { width: calc(100% - 204px); height: 100%; display: flex; flex-direction: column; align-self: stretch; gap: 4px; padding: 12px; border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-synced-doc-card-content-title { display: flex; flex-direction: row; gap: 8px; align-items: center; align-self: stretch; padding: var(--1, 0px); border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-synced-doc-card-content-title-icon { display: flex; width: 16px; height: 16px; justify-content: center; align-items: center; } .affine-embed-synced-doc-card-content-title-icon svg { width: 16px; height: 16px; fill: var(--affine-background-primary-color); } .affine-embed-synced-doc-card-content-title-text { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-word; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 600; line-height: 22px; } .affine-embed-synced-doc-content-note.render { display: none; overflow: hidden; pointer-events: none; } ${iV.zX} .affine-embed-synced-doc-content-note.default { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; word-break: break-word; overflow: hidden; text-overflow: ellipsis; color: var(--affine-placeholder-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-synced-doc-card-content-date, .affine-embed-synced-doc-card-content-reload { display: flex; flex-grow: 1; align-items: flex-end; justify-content: flex-start; gap: 8px; width: max-content; max-width: 100%; line-height: 20px; } .affine-embed-synced-doc-card-content-date > span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-all; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-secondary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-synced-doc-card-content-reload-button { display: flex; flex-direction: row; align-items: center; gap: 4px; cursor: pointer; } .affine-embed-synced-doc-card-content-reload-button svg { width: 12px; height: 12px; fill: var(--affine-background-primary-color); } .affine-embed-synced-doc-card-content-reload-button > span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-all; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-brand-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 500; line-height: 20px; } .affine-embed-synced-doc-card-banner { margin: 12px 12px 0px 0px; width: 204px; max-width: 100%; height: 102px; opacity: var(--add, 1); pointer-events: none; } .affine-embed-synced-doc-card-banner.render { display: none; } .affine-embed-synced-doc-card-banner img, .affine-embed-synced-doc-card-banner object, .affine-embed-synced-doc-card-banner svg { width: 204px; max-width: 100%; height: 102px; object-fit: cover; border-radius: 4px 4px var(--1, 0px) var(--1, 0px); } .affine-embed-synced-doc-card.loading, .affine-embed-synced-doc-card.deleted, .affine-embed-synced-doc-card.error { .affine-embed-linked-doc-content-note.render { display: none; } .affine-embed-linked-doc-content-note.default { display: block; } .affine-embed-synced-doc-card-banner.render { display: none; } .affine-embed-synced-doc-card-banner.default { display: block; } .affine-embed-synced-doc-card-content-date { display: none; } } .affine-embed-synced-doc-card:not(.loading).deleted, .affine-embed-synced-doc-card:not(.loading).error { background: var(--affine-background-secondary-color); } .affine-embed-synced-doc-card:not(.loading):not(.error):not( .surface ).deleted { height: ${eh.Hn.horizontalThin}px; .affine-embed-synced-doc-card-banner { height: 66px; } .affine-embed-synced-doc-card-banner img, .affine-embed-synced-doc-card-banner object, .affine-embed-synced-doc-card-banner svg { height: 66px; } .affine-embed-synced-doc-card-content { gap: 12px; } } .affine-embed-synced-doc-card:not(.loading):not(.error):not(.deleted):not( .note-empty ).cycle { .affine-embed-synced-doc-content-note.render { display: block; } .affine-embed-synced-doc-content-note.default { display: none; } } .affine-embed-synced-doc-card:not(.loading):not(.error):not(.deleted):not( .banner-empty ).cycle { .affine-embed-synced-doc-card-banner.render { display: block; } .affine-embed-synced-doc-card-banner.default { display: none; } } .affine-embed-synced-doc-card:not(.loading):not(.error):not( .deleted ).cycle.banner-empty { .affine-embed-synced-doc-card-content { width: 100%; height: 100%; } .affine-embed-synced-doc-card-banner.render { display: none; } .affine-embed-synced-doc-card-banner.default { display: none; } } .affine-embed-synced-doc-card.surface:not(.cycle) { width: ${eh.Cd.syncedDoc}px; height: ${eh.Hn.syncedDoc}px; flex-direction: column-reverse; .affine-embed-synced-doc-card-banner.default { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 267.5px; margin-left: 12px; flex-shrink: 0; } .affine-embed-synced-doc-card-banner img, .affine-embed-synced-doc-card-banner object, .affine-embed-synced-doc-card-banner svg { width: 340px; height: 170px; } .affine-embed-synced-doc-card-content { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; height: 100%; } .affine-embed-synced-doc-card-content-title { margin: 0 auto; } .affine-embed-synced-doc-card-content-note { margin: 0 auto; flex-grow: 0; } .affine-embed-synced-doc-card-content-reload { flex-grow: 0; margin: 0 auto; } } .affine-embed-synced-doc-card.surface:not(.loading):not(.error):not( .deleted ).cycle { width: ${eh.Cd.vertical}px; height: ${eh.Hn.vertical}px; flex-direction: column-reverse; margin-top: calc( (${eh.Hn.syncedDoc}px - ${eh.Hn.vertical}px) / 2 ); .affine-embed-synced-doc-card-content { width: 100%; } .affine-embed-synced-doc-card-content-note { -webkit-line-clamp: 6; max-height: 130px; } .affine-embed-synced-doc-card-content-date { flex-grow: 1; align-items: flex-end; } .affine-embed-synced-doc-card-banner { width: 340px; height: 170px; margin-left: 12px; } .affine-embed-synced-doc-card-banner img, .affine-embed-synced-doc-card-banner object, .affine-embed-synced-doc-card-banner svg { width: 340px; height: 170px; } } .affine-embed-synced-doc-card.surface:not(.loading):not(.error):not( .deleted ).cycle:not(.empty).banner-empty { .affine-embed-synced-doc-card-content { width: 100%; height: 100%; } .affine-embed-synced-doc-card-banner.render { display: none; } .affine-embed-synced-doc-card-banner.default { display: none; } .affine-embed-synced-doc-card-content-note { -webkit-line-clamp: 16; max-height: 320px; } .affine-embed-synced-doc-card-content-date { flex-grow: unset; align-items: center; } } `,ra=(0,L.qy)` `,rn=(0,L.qy)` `,rl=(0,L.qy)` `,rc=(0,L.qy)` `,rd=(0,L.qy)` `,rh=(0,L.qy)` `,ru=(0,L.qy)` `,rp=(0,L.qy)` `,rf=(0,L.AH)` .affine-embed-linked-doc-block { margin: 0 auto; box-sizing: border-box; display: flex; width: 100%; height: ${eh.Hn.horizontal}px; border-radius: 8px; border: 1px solid var(--affine-background-tertiary-color); opacity: var(--add, 1); background: var(--affine-background-primary-color); user-select: none; position: relative; } .affine-embed-linked-doc-block-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; border-radius: 8px; } .affine-embed-linked-doc-content { width: calc(100% - 204px); height: 100%; display: flex; flex-direction: column; align-self: stretch; gap: 4px; padding: 12px; border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-linked-doc-content-title { display: flex; flex-direction: row; gap: 8px; align-items: center; align-self: stretch; padding: var(--1, 0px); border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-linked-doc-content-title-icon { display: flex; width: 16px; height: 16px; justify-content: center; align-items: center; } .affine-embed-linked-doc-content-title-icon img, .affine-embed-linked-doc-content-title-icon object, .affine-embed-linked-doc-content-title-icon svg { width: 16px; height: 16px; fill: var(--affine-background-primary-color); } .affine-embed-linked-doc-content-title-text { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-word; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 600; line-height: 22px; } .affine-embed-linked-doc-content-note.render { display: none; overflow: hidden; pointer-events: none; flex: 1; } ${iV.zX} .affine-embed-linked-doc-content-note.default { flex: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; word-break: break-word; overflow: hidden; text-overflow: ellipsis; color: var(--affine-placeholder-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-linked-doc-card-content-reload, .affine-embed-linked-doc-content-date { display: flex; height: 20px; align-items: flex-end; justify-content: flex-start; gap: 8px; width: max-content; max-width: 100%; line-height: 20px; } .affine-embed-linked-doc-card-content-reload-button { display: flex; flex-direction: row; align-items: center; gap: 4px; cursor: pointer; } .affine-embed-linked-doc-card-content-reload-button svg { width: 12px; height: 12px; fill: var(--affine-background-primary-color); } .affine-embed-linked-doc-card-content-reload-button > span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-all; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-brand-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 500; line-height: 20px; } .affine-embed-linked-doc-content-date > span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-all; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-secondary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-linked-doc-banner { margin: 12px 12px 0px 0px; width: 204px; max-width: 100%; height: 102px; opacity: var(--add, 1); pointer-events: none; } .affine-embed-linked-doc-banner.render { display: none; } .affine-embed-linked-doc-banner img, .affine-embed-linked-doc-banner object, .affine-embed-linked-doc-banner svg { width: 204px; max-width: 100%; height: 102px; object-fit: cover; border-radius: 4px 4px var(--1, 0px) var(--1, 0px); } .affine-embed-linked-doc-block.loading { .affine-embed-linked-doc-content-date { display: none; } } .affine-embed-linked-doc-block:not(.loading):not(.note-empty) { .affine-embed-linked-doc-content-note.render { display: block; } .affine-embed-linked-doc-content-note.default { display: none; } } .affine-embed-linked-doc-block:not(.loading):not(.banner-empty) { .affine-embed-linked-doc-banner.render { display: block; } .affine-embed-linked-doc-banner.default { display: none; } } .affine-embed-linked-doc-block:not(.loading):not(.deleted):not(.error):not( .empty ).banner-empty { .affine-embed-linked-doc-content { width: 100%; height: 100%; } .affine-embed-linked-doc-banner.render { display: none; } .affine-embed-linked-doc-banner.default { display: none; } } .affine-embed-linked-doc-block:not(.loading).error, .affine-embed-linked-doc-block:not(.loading).deleted { background: var(--affine-background-secondary-color); .affine-embed-linked-doc-content-note.render { display: none; } .affine-embed-linked-doc-content-note.default { display: block; } .affine-embed-linked-doc-content-date { display: none; } .affine-embed-linked-doc-banner.render { display: none; } .affine-embed-linked-doc-banner.default { display: block; } } .affine-embed-linked-doc-block.horizontalThin { height: ${eh.Hn.horizontalThin}px; .affine-embed-linked-doc-banner { height: 66px; } .affine-embed-linked-doc-banner img, .affine-embed-linked-doc-banner object, .affine-embed-linked-doc-banner svg { height: 66px; } .affine-embed-linked-doc-content { gap: 12px; } } .affine-embed-linked-doc-block.list { height: ${eh.Hn.list}px; .affine-embed-linked-doc-content { width: 100%; flex-direction: row; align-items: center; justify-content: space-between; } .affine-embed-linked-doc-content-title { width: calc(100% - 204px); } .affine-embed-linked-doc-content-note { display: none !important; } .affine-embed-linked-doc-content-date { width: 204px; justify-content: flex-end; } .affine-embed-linked-doc-banner { display: none !important; } } .affine-embed-linked-doc-block.vertical { width: ${eh.Cd.vertical}px; height: ${eh.Hn.vertical}px; flex-direction: column-reverse; .affine-embed-linked-doc-content { width: 100%; } .affine-embed-linked-doc-content-note { -webkit-line-clamp: 6; max-height: 130px; } .affine-embed-linked-doc-banner { width: 340px; height: 170px; margin-left: 12px; } .affine-embed-linked-doc-banner img, .affine-embed-linked-doc-banner object, .affine-embed-linked-doc-banner svg { width: 340px; height: 170px; } } .affine-embed-linked-doc-block.vertical:not(.loading):not(.deleted):not( .error ):not(.empty).banner-empty { .affine-embed-linked-doc-content { width: 100%; height: 100%; } .affine-embed-linked-doc-banner.render { display: none; } .affine-embed-linked-doc-banner.default { display: none; } .affine-embed-linked-doc-content-note { -webkit-line-clamp: 16; max-height: 320px; } .affine-embed-linked-doc-content-date { flex-grow: unset; align-items: center; } } .affine-embed-linked-doc-block.cube { width: ${eh.Cd.cube}px; height: ${eh.Hn.cube}px; .affine-embed-linked-doc-content { width: 100%; flex-direction: column; align-items: flex-start; justify-content: space-between; } .affine-embed-linked-doc-content-title { flex-direction: column; gap: 4px; align-items: flex-start; } .affine-embed-linked-doc-content-title-text { -webkit-line-clamp: 2; } .affine-embed-linked-doc-content-note { display: none !important; } .affine-embed-linked-doc-banner { display: none !important; } } `,rg=(0,L.qy)` `,rm=(0,L.qy)` `,rv=(0,L.qy)` `,ry=(0,L.qy)` `,rb=(0,L.qy)` `,rw=(0,L.qy)` `,rx=(0,L.qy)` `,r_=(0,L.qy)` `,rC=(0,L.qy)` `,rk=(0,L.qy)` `,rS=(0,L.qy)` `,rM=(0,L.qy)` `,rE=(0,L.qy)` `,rI=(0,L.qy)` `,rB=(0,L.qy)` `,r$=(0,L.qy)` `,rT=(0,L.qy)` `;var rO=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},rP=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d,h,u=[(0,D.EM)("affine-embed-linked-doc-block"),(0,ri.YE)({enableOn:({doc:e})=>!e.readonly})],g=[],m=oF,v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],P=[],A=[],Z=[],V=[];return class extends m{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(m[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.nJ)(".affine-embed-linked-doc-banner.render")],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],c=[(0,D.nJ)(".affine-embed-linked-doc-content-note.render")],d=[(0,D.MZ)({attribute:!1})],h=[(0,D.MZ)({attribute:!1})],rO(this,null,i,{kind:"accessor",name:"_docUpdatedAt",static:!1,private:!1,access:{has:e=>"_docUpdatedAt"in e,get:e=>e._docUpdatedAt,set:(e,t)=>{e._docUpdatedAt=t}},metadata:p},v,y),rO(this,null,s,{kind:"accessor",name:"_linkedDocMode",static:!1,private:!1,access:{has:e=>"_linkedDocMode"in e,get:e=>e._linkedDocMode,set:(e,t)=>{e._linkedDocMode=t}},metadata:p},b,w),rO(this,null,o,{kind:"accessor",name:"_loading",static:!1,private:!1,access:{has:e=>"_loading"in e,get:e=>e._loading,set:(e,t)=>{e._loading=t}},metadata:p},x,_),rO(this,null,r,{kind:"accessor",name:"bannerContainer",static:!1,private:!1,access:{has:e=>"bannerContainer"in e,get:e=>e.bannerContainer,set:(e,t)=>{e.bannerContainer=t}},metadata:p},C,k),rO(this,null,a,{kind:"accessor",name:"isBannerEmpty",static:!1,private:!1,access:{has:e=>"isBannerEmpty"in e,get:e=>e.isBannerEmpty,set:(e,t)=>{e.isBannerEmpty=t}},metadata:p},S,M),rO(this,null,n,{kind:"accessor",name:"isError",static:!1,private:!1,access:{has:e=>"isError"in e,get:e=>e.isError,set:(e,t)=>{e.isError=t}},metadata:p},E,I),rO(this,null,l,{kind:"accessor",name:"isNoteContentEmpty",static:!1,private:!1,access:{has:e=>"isNoteContentEmpty"in e,get:e=>e.isNoteContentEmpty,set:(e,t)=>{e.isNoteContentEmpty=t}},metadata:p},B,$),rO(this,null,c,{kind:"accessor",name:"noteContainer",static:!1,private:!1,access:{has:e=>"noteContainer"in e,get:e=>e.noteContainer,set:(e,t)=>{e.noteContainer=t}},metadata:p},T,O),rO(this,null,d,{kind:"accessor",name:"surfaceRefRenderer",static:!1,private:!1,access:{has:e=>"surfaceRefRenderer"in e,get:e=>e.surfaceRefRenderer,set:(e,t)=>{e.surfaceRefRenderer=t}},metadata:p},P,A),rO(this,null,h,{kind:"accessor",name:"surfaceRefService",static:!1,private:!1,access:{has:e=>"surfaceRefService"in e,get:e=>e.surfaceRefService,set:(e,t)=>{e.surfaceRefService=t}},metadata:p},Z,V),rO(null,e={value:t},u,{kind:"class",name:t.name,metadata:p},null,g),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=rf}_handleClick(e){if(this.config.handleClick){this.config.handleClick(e,this.host);return}this.isInSurface||this._selectBlock()}_handleDoubleClick(e){if(this.config.handleDoubleClick){this.config.handleDoubleClick(e,this.host);return}(0,ri.mV)(this)||(e.stopPropagation(),this.open())}_isDocEmpty(){let e=this.linkedDoc;return!!e&&!!e&&this.isNoteContentEmpty&&this.isBannerEmpty}get _rootService(){return this.std.spec.getService("affine:page")}connectedCallback(){super.connectedCallback(),this._load().catch(e=>{console.error(e),this.isError=!0});let e=this.linkedDoc;e&&(this.disposables.add(e.collection.meta.docMetaUpdated.on(()=>{this._load().catch(e=>{console.error(e),this.isError=!0})})),this.disposables.add(e.slots.blockUpdated.on(e=>{"update"===e.type&&["","caption","xywh"].includes(e.props.key)||"add"===e.type&&e.init||this._load().catch(e=>{console.error(e),this.isError=!0})})),this._setDocUpdatedAt(),this.disposables.add(this.doc.collection.meta.docMetaUpdated.on(()=>{this._setDocUpdatedAt()})),this._linkedDocMode=this._rootService.docModeService.getMode(this.model.pageId),this.disposables.add(this._rootService.docModeService.onModeChange(e=>{this._linkedDocMode=e},this.model.pageId))),this.model.propsUpdated.on(({key:e})=>{("pageId"===e||"style"===e)&&this._load().catch(e=>{console.error(e),this.isError=!0})}),this.isInSurface&&this.disposables.add(this.model.propsUpdated.on(()=>{this.requestUpdate()}))}disconnectedCallback(){this.cleanUpSurfaceRefRenderer(),super.disconnectedCallback()}renderBlock(){this._cardStyle=this.model.style,this._width=eh.Cd[this._cardStyle],this._height=eh.Hn[this._cardStyle];let e=this.linkedDoc,t=!e,i=this._loading,s=this.isError,o=this._isDocEmpty()&&this.isBannerEmpty,r=(0,sZ.H)({loading:i,error:s,deleted:t,empty:o,"banner-empty":this.isBannerEmpty,"note-empty":this.isNoteContentEmpty,[this._cardStyle]:!0}),{LoadingIcon:a,ReloadIcon:n,LinkedDocIcon:l,LinkedDocDeletedIcon:c,LinkedDocDeletedBanner:d,LinkedDocEmptyBanner:h,SyncedDocErrorBanner:u}=function(e,t){let i=j.Q.mode,s="vertical"!==t;return"page"===e?"light"===i?{LoadingIcon:sv.ik,ReloadIcon:sv.jf,LinkedDocIcon:sv.iS,LinkedDocDeletedIcon:rg,LinkedDocEmptyBanner:s?rm:ry,LinkedDocDeletedBanner:s?rw:r_,SyncedDocErrorBanner:rd}:{ReloadIcon:sv.jf,LoadingIcon:sv.i$,LinkedDocIcon:sv.iS,LinkedDocDeletedIcon:rg,LinkedDocEmptyBanner:s?rv:rb,LinkedDocDeletedBanner:s?rx:rC,SyncedDocErrorBanner:rh}:"light"===i?{ReloadIcon:sv.jf,LoadingIcon:sv.ik,LinkedDocIcon:sv.Nv,LinkedDocDeletedIcon:rg,LinkedDocEmptyBanner:s?rk:rM,LinkedDocDeletedBanner:s?rI:r$,SyncedDocErrorBanner:rd}:{ReloadIcon:sv.jf,LoadingIcon:sv.i$,LinkedDocIcon:sv.Nv,LinkedDocDeletedIcon:rg,LinkedDocEmptyBanner:s?rS:rE,LinkedDocDeletedBanner:s?rB:rT,SyncedDocErrorBanner:rh}}(this._linkedDocMode,this._cardStyle),p=s?ra:i?a:t?c:l,f=s?e?.meta?.title||"Untitled":i?"Loading...":t?"Deleted doc":e?.meta?.title||"Untitled",g=s||i||t||o,m=s?"This linked doc failed to load.":i?"":t?"This linked doc is deleted.":o?"Preview of the doc will be displayed here.":"",v="cube"===this._cardStyle?this._docUpdatedAt.toLocaleTimeString():this._docUpdatedAt.toLocaleString(),y=s||i||t||o,b=s?u:i?h:t?d:h;return this.renderEmbed(()=>(0,L.qy)`
${p}
${f}
${g?(0,L.qy)`
${m}
`:L.s6} ${s?(0,L.qy)`
${n} Reload
`:(0,L.qy)` `}
${y?(0,L.qy)`
${b}
`:L.s6}
`)}updated(){let e=this.linkedDoc,{xywh:t,style:i}=this.model,s=p.z.deserialize(t);e&&"horizontalThin"===i?(s.w=eh.Cd.horizontal,s.h=eh.Hn.horizontal,this.doc.withoutTransact(()=>{this.doc.updateBlock(this.model,{xywh:s.serialize(),style:"horizontal"})})):e||"horizontal"!==i||(s.w=eh.Cd.horizontalThin,s.h=eh.Hn.horizontalThin,this.doc.withoutTransact(()=>{this.doc.updateBlock(this.model,{xywh:s.serialize(),style:"horizontalThin"})}))}get config(){return this.std.spec.getConfig("affine:embed-linked-doc")||{}}get docTitle(){return this.linkedDoc?.meta?.title.length?this.linkedDoc.meta.title:"Untitled"}get editorMode(){return this._linkedDocMode}get linkedDoc(){return this.std.collection.getDoc(this.model.pageId)}#sa;get _docUpdatedAt(){return this.#sa}set _docUpdatedAt(e){this.#sa=e}#sn;get _linkedDocMode(){return this.#sn}set _linkedDocMode(e){this.#sn=e}#i5;get _loading(){return this.#i5}set _loading(e){this.#i5=e}#sl;get bannerContainer(){return this.#sl}set bannerContainer(e){this.#sl=e}#sc;get isBannerEmpty(){return this.#sc}set isBannerEmpty(e){this.#sc=e}#sd;get isError(){return this.#sd}set isError(e){this.#sd=e}#sh;get isNoteContentEmpty(){return this.#sh}set isNoteContentEmpty(e){this.#sh=e}#su;get noteContainer(){return this.#su}set noteContainer(e){this.#su=e}#sp;get surfaceRefRenderer(){return this.#sp}set surfaceRefRenderer(e){this.#sp=e}#sf;get surfaceRefService(){return this.#sf}set surfaceRefService(e){this.#sf=e}constructor(){super(...arguments),this._cardStyle="horizontal",this._height=eh.Hn.horizontal,this._load=async()=>{this._loading=!0,this.isError=!1,this.isNoteContentEmpty=!0,this.isBannerEmpty=!0;let e=this.linkedDoc;if(!e){this._loading=!1;return}if(!e.loaded)try{e.load()}catch(e){console.error(e),this.isError=!0}if(this.isError||e.root||await new Promise(t=>{e.slots.rootAdded.once(()=>{t()})}),this._loading=!1,!this.isError){let e=this.model.style;("horizontal"===e||"vertical"===e)&&(0,iV.rq)(this)}},this._selectBlock=()=>{let e=this.host.selection,t=e.create("block",{blockId:this.blockId});e.setGroup("note",[t])},this._setDocUpdatedAt=()=>{let e=this.doc.collection.meta.getDocMeta(this.model.pageId);if(e){let t=e.updatedDate||e.createDate;this._docUpdatedAt=new Date(t)}},this._width=eh.Cd.horizontal,this.cleanUpSurfaceRefRenderer=()=>{this.surfaceRefRenderer&&this.surfaceRefService.removeRenderer(this.surfaceRefRenderer.id)},this.convertToEmbed=()=>{let{id:e,doc:t,pageId:i,caption:s,xywh:o}=this.model;if(t.awarenessStore.getFlag("enable_synced_doc_block")){if(this.isInSurface){let t="syncedDoc",r=p.z.deserialize(o);r.w=eh.Cd[t],r.h=eh.Hn[t];let a=this.rootService;if(!a)return;let n=a.addBlock("affine:embed-synced-doc",{pageId:i,xywh:r.serialize(),caption:s},a.surface);this.std.command.exec("reassociateConnectors",{oldId:e,newId:n}),a.selection.set({editing:!1,elements:[n]})}else{let e=t.getParent(this.model);(0,H.Z1)(e);let o=e.children.indexOf(this.model);t.addBlock("affine:embed-synced-doc",{pageId:i,caption:s},e,o),this.std.selection.setGroup("note",[])}t.deleteBlock(this.model)}},this.covertToInline=()=>{let{doc:e,pageId:t}=this.model,i=e.getParent(this.model);(0,H.Z1)(i);let s=i.children.indexOf(this.model),o=new f.rl.Y.Text;o.insert(0," "),o.format(0,1,{reference:{type:"LinkedPage",pageId:t}});let r=new e.Text(o);e.addBlock("affine:paragraph",{text:r},i,s),e.deleteBlock(this.model)},this.open=()=>{let e=this.model.pageId;if(e===this.doc.id)return;let t=this.std.view.viewFromPath("block",[this.doc.root?.id??""]);(0,H.Z1)(t),t.slots.docLinkClicked.emit({docId:e})},this.refreshData=()=>{this._load().catch(e=>{console.error(e),this.isError=!0})},this.#sa=rP(this,v,new Date),this.#sn=(rP(this,y),rP(this,b,"page")),this.#i5=(rP(this,w),rP(this,x,!1)),this.#sl=(rP(this,_),rP(this,C,void 0)),this.#sc=(rP(this,k),rP(this,S,!1)),this.#sd=(rP(this,M),rP(this,E,!1)),this.#sh=(rP(this,I),rP(this,B,!1)),this.#su=(rP(this,$),rP(this,T,void 0)),this.#sp=(rP(this,O),rP(this,P,void 0)),this.#sf=(rP(this,A),rP(this,Z,void 0)),rP(this,V)}static{rP(t,g)}},t})();i(3714);let rA=(e,t)=>{let i=e.std.spec.getService("affine:page");(0,H.Z1)(i),t({insertedLinkType:i.insertLinkByQuickSearch(e.userInput,e.skipSelection)})};class rL extends P.ps{constructor(){super(...arguments),this.slots={linkedDocCreated:new f.DX}}mounted(){super.mounted(),this.std.command.add("insertLinkByQuickSearch",rA)}}let rD={schema:i(55012).V,view:{component:(0,th.eu)`affine-embed-linked-doc-block`},service:rL};(0,td.lQ)(rH);var rZ=i(88680);let rj=(0,L.AH)` .affine-embed-loom-block { margin: 0 auto; box-sizing: border-box; width: 100%; height: ${eh.Hn.video}px; display: flex; flex-direction: column; gap: 20px; padding: 12px; border-radius: 8px; border: 1px solid var(--affine-background-tertiary-color); opacity: var(--add, 1); background: var(--affine-background-primary-color); user-select: none; } .affine-embed-loom-video { width: 100%; height: 100%; opacity: var(--add, 1); } .affine-embed-loom-video img, .affine-embed-loom-video object, .affine-embed-loom-video svg { width: 100%; height: 100%; object-fit: cover; border-radius: 4px 4px var(--1, 0px) var(--1, 0px); } .affine-embed-loom-video-iframe-container { position: relative; } .affine-embed-loom-video-iframe-container > iframe { width: 100%; height: 410px; border-radius: 4px 4px var(--1, 0px) var(--1, 0px); } .affine-embed-loom-video-iframe-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .affine-embed-loom-video-iframe-overlay.hide { display: none; } .affine-embed-loom-content { display: flex; flex-direction: column; width: 100%; height: 100%; border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-loom-content-header { display: flex; flex-direction: row; gap: 8px; align-items: center; align-self: stretch; padding: var(--1, 0px); border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-loom-content-title-icon { display: flex; width: 20px; height: 20px; justify-content: center; align-items: center; } .affine-embed-loom-content-title-icon img, .affine-embed-loom-content-title-icon object, .affine-embed-loom-content-title-icon svg { width: 20px; height: 20px; fill: var(--affine-background-primary-color); } .affine-embed-loom-content-title-text { flex: 1 0 0; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-word; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 600; line-height: 22px; } .affine-embed-loom-content-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; flex: 1 0 0; align-self: stretch; word-break: break-word; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-loom-content-url { display: flex; align-items: center; justify-content: flex-start; gap: 4px; width: max-content; max-width: 100%; cursor: pointer; } .affine-embed-loom-content-url > span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-all; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-secondary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-loom-content-url:hover > span { color: var(--affine-link-color); } .affine-embed-loom-content-url:hover .open-icon { fill: var(--affine-link-color); } .affine-embed-loom-content-url-icon { display: flex; align-items: center; justify-content: center; width: 12px; height: 12px; } .affine-embed-loom-content-url-icon .open-icon { height: 12px; width: 12px; fill: var(--affine-text-secondary-color); } .affine-embed-loom-block.loading { .affine-embed-loom-content-title-text { color: var(--affine-placeholder-color); } } .affine-embed-loom-block.selected { .affine-embed-loom-content-url > span { color: var(--affine-link-color); } .affine-embed-loom-content-url .open-icon { fill: var(--affine-link-color); } } `,rV=(0,L.qy)` `;async function rz(e,t){let i=e.url;return await rR(i,t)}async function rR(e,t){let i={},s=`https://www.loom.com/v1/oembed?url=${e}`,o=await fetch(s,{signal:t}).catch(()=>null);if(o&&o.ok){let{title:e,description:t,thumbnail_url:s}=await o.json();i={title:e,description:t,image:s}}return i}async function rF(e,t){let i=null,s=null,o=null;try{e.loading=!0;let r=e.service?.queryUrlData;(0,H.Z1)(r);let a=await r(e.model);if({title:i=null,description:s=null,image:o=null}=a,t?.aborted)return;e.doc.updateBlock(e.model,{title:i,description:s,image:o})}catch(e){if(t?.aborted||(0,oA.z)(e))return}finally{e.loading=!1}}var rN=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},rq=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("affine-embed-loom-block")],a=[],n=oF,l=[],c=[],d=[],h=[],u=[],p=[];return class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.MZ)({attribute:!1})],rN(this,null,i,{kind:"accessor",name:"_isSelected",static:!1,private:!1,access:{has:e=>"_isSelected"in e,get:e=>e._isSelected,set:(e,t)=>{e._isSelected=t}},metadata:f},l,c),rN(this,null,s,{kind:"accessor",name:"_showOverlay",static:!1,private:!1,access:{has:e=>"_showOverlay"in e,get:e=>e._showOverlay,set:(e,t)=>{e._showOverlay=t}},metadata:f},d,h),rN(this,null,o,{kind:"accessor",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:f},u,p),rN(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=rj}_handleClick(e){e.stopPropagation(),this.isInSurface||this._selectBlock()}_handleDoubleClick(e){e.stopPropagation(),this.open()}_selectBlock(){let e=this.host.selection,t=e.create("block",{blockId:this.blockId});e.setGroup("note",[t])}connectedCallback(){super.connectedCallback(),this.model.videoId||this.doc.withoutTransact(()=>{let e=this.model.url.match(rZ.kn);if(e){let[,t]=e;this.doc.updateBlock(this.model,{videoId:t})}}),this.model.description||this.model.title||this.doc.withoutTransact(()=>{this.refreshData()}),this.disposables.add(this.model.propsUpdated.on(({key:e})=>{this.requestUpdate(),"url"===e&&this.refreshData()})),this.disposables.add(this.std.selection.slots.changed.on(()=>{this._isSelected=!!this.selected?.is("block")||!!this.selected?.is("surface"),this._showOverlay=this._isResizing||this._isDragging||!this._isSelected})),this.handleEvent("dragStart",()=>{this._isDragging=!0,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}),this.handleEvent("dragEnd",()=>{this._isDragging=!1,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}),this.isInSurface&&(this.disposables.add(this.model.propsUpdated.on(()=>{this.requestUpdate()})),this.rootService?.slots.elementResizeStart.on(()=>{this._isResizing=!0,this._showOverlay=!0}),this.rootService?.slots.elementResizeEnd.on(()=>{this._isResizing=!1,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}))}renderBlock(){let{image:e,title:t="Loom",description:i,videoId:s,style:o}=this.model;this._cardStyle=o,this._width=eh.Cd[this._cardStyle],this._height=eh.Hn[this._cardStyle];let r=this.loading,{LoadingIcon:a,EmbedCardBannerIcon:n}=(0,oT.Yr)(),l=r?a:rV,c=r?"Loading...":t,d=r?"":i,h=!r&&e?(0,L.qy)` ${n} `:n;return this.renderEmbed(()=>(0,L.qy)`
${s?(0,L.qy)`
`:h}
${l}
${c}
${d}
loom.com
${sv.gb}
`)}#i9;get _isSelected(){return this.#i9}set _isSelected(e){this.#i9=e}#sr;get _showOverlay(){return this.#sr}set _showOverlay(e){this.#sr=e}#si;get loading(){return this.#si}set loading(e){this.#si=e}constructor(){super(...arguments),this._cardStyle="video",this._isDragging=!1,this._isResizing=!1,this.open=()=>{let e=this.model.url;e.match(/^[a-zA-Z]+:\/\//)||(e="https://"+e),window.open(e,"_blank")},this.refreshData=()=>{rF(this,this.fetchAbortController.signal).catch(console.error)},this.#i9=rq(this,l,!1),this.#sr=(rq(this,c),rq(this,d,!0)),this.#si=(rq(this,h),rq(this,u,!1)),rq(this,p)}static{rq(t,a)}},t})();var rW=i(53010),rG=i(91705),rY=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},rK=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d=[(0,D.EM)("affine-embed-synced-doc-card")],h=[],u=(0,P.Tm)(P.ao),p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[];(class extends u{static{t=this}static{let B="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;i=[(0,D.nJ)(".affine-embed-synced-doc-card-banner.render")],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.nJ)(".affine-embed-synced-doc-content-note.render")],l=[(0,D.MZ)({attribute:!1})],c=[(0,D.MZ)({attribute:!1})],rY(this,null,i,{kind:"accessor",name:"bannerContainer",static:!1,private:!1,access:{has:e=>"bannerContainer"in e,get:e=>e.bannerContainer,set:(e,t)=>{e.bannerContainer=t}},metadata:B},p,f),rY(this,null,s,{kind:"accessor",name:"block",static:!1,private:!1,access:{has:e=>"block"in e,get:e=>e.block,set:(e,t)=>{e.block=t}},metadata:B},g,m),rY(this,null,o,{kind:"accessor",name:"isBannerEmpty",static:!1,private:!1,access:{has:e=>"isBannerEmpty"in e,get:e=>e.isBannerEmpty,set:(e,t)=>{e.isBannerEmpty=t}},metadata:B},v,y),rY(this,null,r,{kind:"accessor",name:"isError",static:!1,private:!1,access:{has:e=>"isError"in e,get:e=>e.isError,set:(e,t)=>{e.isError=t}},metadata:B},b,w),rY(this,null,a,{kind:"accessor",name:"isNoteContentEmpty",static:!1,private:!1,access:{has:e=>"isNoteContentEmpty"in e,get:e=>e.isNoteContentEmpty,set:(e,t)=>{e.isNoteContentEmpty=t}},metadata:B},x,_),rY(this,null,n,{kind:"accessor",name:"noteContainer",static:!1,private:!1,access:{has:e=>"noteContainer"in e,get:e=>e.noteContainer,set:(e,t)=>{e.noteContainer=t}},metadata:B},C,k),rY(this,null,l,{kind:"accessor",name:"surfaceRefRenderer",static:!1,private:!1,access:{has:e=>"surfaceRefRenderer"in e,get:e=>e.surfaceRefRenderer,set:(e,t)=>{e.surfaceRefRenderer=t}},metadata:B},S,M),rY(this,null,c,{kind:"accessor",name:"surfaceRefService",static:!1,private:!1,access:{has:e=>"surfaceRefService"in e,get:e=>e.surfaceRefService,set:(e,t)=>{e.surfaceRefService=t}},metadata:B},E,I),rY(null,e={value:t},d,{kind:"class",name:t.name,metadata:B},null,h),t=e.value,B&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:B})}static{this.styles=rr}_handleClick(e){e.stopPropagation(),this.block.isInSurface||this._selectBlock()}_isDocEmpty(){let e=this.block.syncedDoc;return!!e&&!!e&&!e.meta?.title.length&&this.isNoteContentEmpty&&this.isBannerEmpty}_selectBlock(){let e=this.host.selection,t=e.create("block",{blockId:this.block.blockId});e.setGroup("note",[t])}connectedCallback(){super.connectedCallback(),this.block.handleEvent("dragStart",()=>{this._dragging=!0},{global:!0}),this.block.handleEvent("dragEnd",()=>{this._dragging=!1},{global:!0});let{isCycle:e}=this.block.blockState,t=this.block.syncedDoc;e&&t&&(t.root?(0,iV.rq)(this):t.slots.rootAdded.once(()=>{(0,iV.rq)(this)}),this.disposables.add(t.collection.meta.docMetaUpdated.on(()=>{(0,iV.rq)(this)})),this.disposables.add(t.slots.blockUpdated.on(e=>{this._dragging||"update"===e.type&&["","caption","xywh"].includes(e.props.key)||(0,iV.rq)(this)})))}disconnectedCallback(){super.disconnectedCallback(),this.cleanUpSurfaceRefRenderer()}render(){var e;let{isLoading:t,isDeleted:i,isError:s,isCycle:o}=this.blockState,r=this.isError||s,a=this._isDocEmpty()&&this.isBannerEmpty,n=(0,sZ.H)({loading:t,error:r,deleted:i,cycle:o,surface:this.block.isInSurface,empty:a,"banner-empty":this.isBannerEmpty,"note-empty":this.isNoteContentEmpty}),{LoadingIcon:l,SyncedDocIcon:c,SyncedDocErrorIcon:d,SyncedDocDeletedIcon:h,ReloadIcon:u,SyncedDocEmptyBanner:p,SyncedDocErrorBanner:f,SyncedDocDeletedBanner:g}=(e=this.editorMode,"light"===j.Q.mode?{LoadingIcon:sv.ik,SyncedDocIcon:"page"===e?sv.iS:sv.Nv,SyncedDocErrorIcon:ra,SyncedDocDeletedIcon:rn,ReloadIcon:sv.jf,SyncedDocEmptyBanner:rl,SyncedDocErrorBanner:rd,SyncedDocDeletedBanner:ru}:{LoadingIcon:sv.i$,SyncedDocIcon:"page"===e?sv.iS:sv.Nv,SyncedDocErrorIcon:ra,SyncedDocDeletedIcon:rn,ReloadIcon:sv.jf,SyncedDocEmptyBanner:rc,SyncedDocErrorBanner:rh,SyncedDocDeletedBanner:rp}),m=r?d:t?l:i?h:c,v=r?this.block.docTitle:t?"Loading...":i?"Deleted doc":this.block.docTitle,y=t||r||i||a,b=r?"This linked doc failed to load.":t?"":i?"This linked doc is deleted.":a?"Preview of the page will be displayed here.":"",w=this.block.docUpdatedAt.toLocaleString(),x=t||r||i||a,_=t?p:r?f:i?g:p;return(0,L.qy)`
${m}
${v}
${y?(0,L.qy)`
${b}
`:L.s6}
${r?(0,L.qy)`
this.block.refreshData()} > ${u} Reload
`:(0,L.qy)` `}
${x?(0,L.qy)`
${_}
`:L.s6}
`}get blockState(){return this.block.blockState}get editorMode(){return this.block.editorMode}get host(){return this.block.host}get linkedDoc(){return this.block.syncedDoc}get model(){return this.block.model}get path(){return this.block.path}get std(){return this.block.std}#sl;get bannerContainer(){return this.#sl}set bannerContainer(e){this.#sl=e}#T;get block(){return this.#T}set block(e){this.#T=e}#sc;get isBannerEmpty(){return this.#sc}set isBannerEmpty(e){this.#sc=e}#sd;get isError(){return this.#sd}set isError(e){this.#sd=e}#sh;get isNoteContentEmpty(){return this.#sh}set isNoteContentEmpty(e){this.#sh=e}#su;get noteContainer(){return this.#su}set noteContainer(e){this.#su=e}#sp;get surfaceRefRenderer(){return this.#sp}set surfaceRefRenderer(e){this.#sp=e}#sf;get surfaceRefService(){return this.#sf}set surfaceRefService(e){this.#sf=e}constructor(){super(...arguments),this._dragging=!1,this.cleanUpSurfaceRefRenderer=()=>{this.surfaceRefRenderer&&this.surfaceRefService.removeRenderer(this.surfaceRefRenderer.id)},this.#sl=rK(this,p,void 0),this.#T=(rK(this,f),rK(this,g,void 0)),this.#sc=(rK(this,m),rK(this,v,!1)),this.#sd=(rK(this,y),rK(this,b,!1)),this.#sh=(rK(this,w),rK(this,x,!1)),this.#su=(rK(this,_),rK(this,C,void 0)),this.#sp=(rK(this,k),rK(this,S,null)),this.#sf=(rK(this,M),rK(this,E,void 0)),rK(this,I)}static{rK(t,h)}})})();var rX=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},rQ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d,h,u=[(0,D.EM)("affine-embed-synced-doc-block"),(0,ri.YE)({enableOn:({doc:e})=>!e.readonly})],g=[],m=oF,v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],P=[],A=[],V=[],z=[];return class extends m{static{t=this}constructor(){super(...arguments),this._buildPreviewSpec=e=>{let t=this.depth+1,i=iU.f.getInstance().getSpec(e),s=this.disposables;return i.setup("affine:embed-synced-doc",(e,i)=>{i.add(e.viewConnected.on(({component:e})=>{e.depth=t,s.add(()=>{e.depth=0})})),i.add(e.viewDisconnected.on(({component:e})=>{e.depth=0}))}),i.value},this._initEdgelessFitEffect=()=>{let e=()=>{let{_syncedDocMode:e}=this;if("edgeless"!==e)return;let t=this.syncedDocEditorHost?.std.spec.getService("affine:page");t&&(t.viewport.onResize(),t.zoomToFit())},t=new ResizeObserver(e),i=this.embedBlock;t.observe(i),this._disposables.add(()=>{t.disconnect()}),this.syncedDocEditorHost?.updateComplete.then(()=>{e()}).catch(()=>{})},this._pageFilter={mode:"loose",match:[{flavour:"affine:note",props:{displayMode:e$.ko.EdgelessOnly},viewType:f.lv.Hidden}]},this._renderSyncedView=()=>{let e=this.syncedDoc,t=this.isInSurface,i=this._syncedDocMode;(0,H.Z1)(e),this.isPageMode&&!this.isInSurface&&(this.style.width="calc(100% + 48px)",this.style.marginLeft="-24px",this.style.marginRight="-24px");let s=(0,Z.W)({position:"relative",width:"100%"});if(t){let e=this.model.scale??1,t=p.z.deserialize((this.rootService?.getElementById(this.model.id)??this.model).xywh),i=t.w/e,o=t.h/e;s=(0,Z.W)({width:`${i}px`,height:`${o}px`,minHeight:`${o}px`,transform:`scale(${e})`,transformOrigin:"0 0"})}let o=j.Q.mode,r=!!this.selected?.is("block"),a=t?this.model.scale??1:void 0;this.dataset.nestedEditor="";let n=()=>(0,rW.S)(i,[["page",()=>(0,L.qy)`
${this.host.renderSpecPortal(e,this._buildPreviewSpec("page:preview"))}
`],["edgeless",()=>(0,L.qy)`
${this.host.renderSpecPortal(e,this._buildPreviewSpec("edgeless:preview"))}
`]]),l=this.isPageMode?sv.iS:sv.Nv;return this.renderEmbed(()=>(0,L.qy)`
${this.isPageMode&&this._isEmptySyncedDoc?(0,L.qy)`
This is a linked doc, you can add content here.
`:(0,rG.a)([i,e],n)}
${t?L.s6:(0,L.qy)`
${l} ${this.docTitle}
`} ${t?(0,L.qy)`
`:L.s6}
`)},this.convertToCard=()=>{let{id:e,doc:t,pageId:i,caption:s,xywh:o}=this.model;if(this.isInSurface){let t="vertical",r=p.z.deserialize(o);r.w=eh.Cd[t],r.h=eh.Hn[t];let a=this.rootService;if(!a)return;let n=a.addBlock("affine:embed-linked-doc",{pageId:i,xywh:r.serialize(),style:t,caption:s},a.surface);this.std.command.exec("reassociateConnectors",{oldId:e,newId:n}),a.selection.set({editing:!1,elements:[n]})}else{let e=t.getParent(this.model);(0,H.Z1)(e);let o=e.children.indexOf(this.model);t.addBlock("affine:embed-linked-doc",{pageId:i,caption:s},e,o),this.std.selection.setGroup("note",[])}t.deleteBlock(this.model)},this.covertToInline=()=>{let{doc:e,pageId:t}=this.model,i=e.getParent(this.model);(0,H.Z1)(i);let s=i.children.indexOf(this.model),o=new f.rl.Y.Text;o.insert(0," "),o.format(0,1,{reference:{type:"LinkedPage",pageId:t}});let r=new e.Text(o);e.addBlock("affine:paragraph",{text:r},i,s),e.deleteBlock(this.model)},this.open=()=>{let e=this.model.pageId;if(e===this.doc.id)return;let t=this.std.view.viewFromPath("block",[this.doc.root?.id??""]);(0,H.Z1)(t),t.slots.docLinkClicked.emit({docId:e})},this.refreshData=()=>{this._load().catch(e=>{console.error(e),this._error=!0})},this.#sg=rQ(this,v,!1),this.#sm=(rQ(this,y),rQ(this,b,!1)),this.#sa=(rQ(this,w),rQ(this,x,new Date)),this.#sv=(rQ(this,_),rQ(this,C,!1)),this.#sy=(rQ(this,k),rQ(this,S,!0)),this.#i5=(rQ(this,M),rQ(this,E,!1)),this.#sb=(rQ(this,I),rQ(this,B,"page")),this.#tK=(rQ(this,$),rQ(this,T,0)),this.#sw=(rQ(this,O),rQ(this,P,null)),this.#sx=(rQ(this,A),rQ(this,V,null)),this.#$=(rQ(this,z),!1)}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(m[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.wk)()],a=[(0,D.wk)()],n=[(0,D.wk)()],l=[(0,D.wk)()],c=[(0,D.wk)()],d=[(0,D.P)(":scope > .affine-block-component > .embed-block-container > affine-embed-synced-doc-card")],h=[(0,D.P)(":scope > .affine-block-component > .embed-block-container > .affine-embed-synced-doc-container > .affine-embed-synced-doc-editor > div > editor-host")],rX(this,null,i,{kind:"accessor",name:"_cycle",static:!1,private:!1,access:{has:e=>"_cycle"in e,get:e=>e._cycle,set:(e,t)=>{e._cycle=t}},metadata:p},v,y),rX(this,null,s,{kind:"accessor",name:"_deleted",static:!1,private:!1,access:{has:e=>"_deleted"in e,get:e=>e._deleted,set:(e,t)=>{e._deleted=t}},metadata:p},b,w),rX(this,null,o,{kind:"accessor",name:"_docUpdatedAt",static:!1,private:!1,access:{has:e=>"_docUpdatedAt"in e,get:e=>e._docUpdatedAt,set:(e,t)=>{e._docUpdatedAt=t}},metadata:p},x,_),rX(this,null,r,{kind:"accessor",name:"_error",static:!1,private:!1,access:{has:e=>"_error"in e,get:e=>e._error,set:(e,t)=>{e._error=t}},metadata:p},C,k),rX(this,null,a,{kind:"accessor",name:"_isEmptySyncedDoc",static:!1,private:!1,access:{has:e=>"_isEmptySyncedDoc"in e,get:e=>e._isEmptySyncedDoc,set:(e,t)=>{e._isEmptySyncedDoc=t}},metadata:p},S,M),rX(this,null,n,{kind:"accessor",name:"_loading",static:!1,private:!1,access:{has:e=>"_loading"in e,get:e=>e._loading,set:(e,t)=>{e._loading=t}},metadata:p},E,I),rX(this,null,l,{kind:"accessor",name:"_syncedDocMode",static:!1,private:!1,access:{has:e=>"_syncedDocMode"in e,get:e=>e._syncedDocMode,set:(e,t)=>{e._syncedDocMode=t}},metadata:p},B,$),rX(this,null,c,{kind:"accessor",name:"depth",static:!1,private:!1,access:{has:e=>"depth"in e,get:e=>e.depth,set:(e,t)=>{e.depth=t}},metadata:p},T,O),rX(this,null,d,{kind:"accessor",name:"syncedDocCard",static:!1,private:!1,access:{has:e=>"syncedDocCard"in e,get:e=>e.syncedDocCard,set:(e,t)=>{e.syncedDocCard=t}},metadata:p},P,A),rX(this,null,h,{kind:"accessor",name:"syncedDocEditorHost",static:!1,private:!1,access:{has:e=>"syncedDocEditorHost"in e,get:e=>e.syncedDocEditorHost,set:(e,t)=>{e.syncedDocEditorHost=t}},metadata:p},V,z),rX(null,e={value:t},u,{kind:"class",name:t.name,metadata:p},null,g),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=ro}_checkCycle(){let e=this.host;for(;e&&!this._cycle;)this._cycle=!!e&&e.doc.id===this.model.pageId,e=e.parentElement?.closest("editor-host")??null}_handleClick(e){this.isInSurface||this._selectBlock()}_isClickAtBorder(e,t,i=8){let{x:s,y:o}=e,r=t.getBoundingClientRect();return!!r&&(Math.abs(s-r.left){e.slots.rootAdded.once(()=>t())}),this._loading=!1}get _rootService(){return this.std.spec.getService("affine:page")}_selectBlock(){let e=this.host.selection,t=e.create("block",{blockId:this.blockId});e.setGroup("note",[t])}_setDocUpdatedAt(){let e=this.doc.collection.meta.getDocMeta(this.model.pageId);if(e){let t=e.updatedDate||e.createDate;this._docUpdatedAt=new Date(t)}}get isPageMode(){return"page"===this._syncedDocMode}connectedCallback(){super.connectedCallback(),this.style.display="block",this._load().catch(e=>{console.error(e),this._error=!0}),this.contentEditable="false",this.model.propsUpdated.on(({key:e})=>{("pageId"===e||"style"===e)&&this._load().catch(e=>{console.error(e),this._error=!0})}),this.isInSurface&&this.disposables.add(this.model.propsUpdated.on(()=>{this.requestUpdate()})),this._setDocUpdatedAt(),this.disposables.add(this.doc.collection.meta.docMetaUpdated.on(()=>{this._setDocUpdatedAt()})),this._syncedDocMode=this._rootService.docModeService.getMode(this.model.pageId),this._isEmptySyncedDoc=(0,iV.QH)(this.syncedDoc,this._syncedDocMode),this.disposables.add(this._rootService.docModeService.onModeChange(e=>{this._syncedDocMode=e,this._isEmptySyncedDoc=(0,iV.QH)(this.syncedDoc,e)},this.model.pageId)),this.syncedDoc&&this.disposables.add(this.syncedDoc.slots.blockUpdated.on(()=>{this._isEmptySyncedDoc=(0,iV.QH)(this.syncedDoc,this._syncedDocMode)}))}firstUpdated(){this.disposables.addFromEvent(this,"click",e=>{e.stopPropagation(),this._isClickAtBorder(e,this)&&(e.preventDefault(),this._selectBlock())});let e=this.syncedDocEditorHost?.std.spec.getService("affine:page");e&&this.disposables.add(e.slots.docLinkClicked.on(({docId:e})=>{this._rootService.slots.docLinkClicked.emit({docId:e})})),this._initEdgelessFitEffect()}renderBlock(){delete this.dataset.nestedEditor;let{style:e,xywh:t}=this.model;this._cardStyle=e;let i=p.z.deserialize(t);this._width=this.isInSurface?i.w:eh.Cd[e],this._height=this.isInSurface?i.h:eh.Hn[e];let s=this.syncedDoc,{isLoading:o,isError:r,isDeleted:a,isCycle:n}=this.blockState,l=this.isInSurface,c=this.depth>=1;if(o||r||a||c||n||!s){let t=(0,Z.W)({position:"relative",display:"block",width:"100%"});if(l){let i=p.z.deserialize(this.model.xywh),s=i.w/eh.Cd[e],o=i.h/eh.Hn[e];t=(0,Z.W)({display:"block",width:`${eh.Cd[e]}px`,height:`${eh.Hn[e]}px`,transform:`scale(${s}, ${o})`,transformOrigin:"0 0"})}return this.renderEmbed(()=>(0,L.qy)` `)}return this._renderSyncedView()}updated(e){super.updated(e),this.syncedDocCard?.requestUpdate()}get blockState(){return{isLoading:this._loading,isError:this._error,isDeleted:this._deleted,isCycle:this._cycle}}get docTitle(){return this.syncedDoc?.meta?.title.length?this.syncedDoc.meta.title:"Untitled"}get docUpdatedAt(){return this._docUpdatedAt}get editorMode(){return this._syncedDocMode}get syncedDoc(){return"page"===this._syncedDocMode?this.std.collection.getDoc(this.model.pageId,{readonly:!0,query:this._pageFilter}):this.std.collection.getDoc(this.model.pageId,{readonly:!0})}#sg;get _cycle(){return this.#sg}set _cycle(e){this.#sg=e}#sm;get _deleted(){return this.#sm}set _deleted(e){this.#sm=e}#sa;get _docUpdatedAt(){return this.#sa}set _docUpdatedAt(e){this.#sa=e}#sv;get _error(){return this.#sv}set _error(e){this.#sv=e}#sy;get _isEmptySyncedDoc(){return this.#sy}set _isEmptySyncedDoc(e){this.#sy=e}#i5;get _loading(){return this.#i5}set _loading(e){this.#i5=e}#sb;get _syncedDocMode(){return this.#sb}set _syncedDocMode(e){this.#sb=e}#tK;get depth(){return this.#tK}set depth(e){this.#tK=e}#sw;get syncedDocCard(){return this.#sw}set syncedDocCard(e){this.#sw=e}#sx;get syncedDocEditorHost(){return this.#sx}set syncedDocEditorHost(e){this.#sx=e}#$;get useCaptionEditor(){return this.#$}set useCaptionEditor(e){this.#$=e}static{rQ(t,g)}},t})();var r1=i(55708);let r0=(0,L.AH)` .affine-embed-youtube-block { margin: 0 auto; box-sizing: border-box; width: 100%; height: ${eh.Hn.video}px; display: flex; flex-direction: column; gap: 20px; padding: 12px; border-radius: 8px; border: 1px solid var(--affine-background-tertiary-color); opacity: var(--add, 1); background: var(--affine-background-primary-color); user-select: none; } .affine-embed-youtube-video { width: 100%; height: 100%; opacity: var(--add, 1); } .affine-embed-youtube-video img, .affine-embed-youtube-video object, .affine-embed-youtube-video svg { width: 100%; height: 100%; object-fit: cover; border-radius: 4px 4px var(--1, 0px) var(--1, 0px); } .affine-embed-youtube-video-iframe-container { position: relative; } .affine-embed-youtube-video-iframe-container > iframe { width: 100%; height: 410px; border-radius: 4px 4px var(--1, 0px) var(--1, 0px); } .affine-embed-youtube-video-iframe-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .affine-embed-youtube-video-iframe-overlay.hide { display: none; } .affine-embed-youtube-content { display: flex; flex-direction: column; width: 100%; height: 100%; border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-youtube-content-header { display: flex; flex-direction: row; gap: 8px; align-items: center; align-self: stretch; padding: var(--1, 0px); border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-youtube-content-title-icon { display: flex; width: 20px; height: 20px; justify-content: center; align-items: center; } .affine-embed-youtube-content-title-icon img, .affine-embed-youtube-content-title-icon object, .affine-embed-youtube-content-title-icon svg { width: 20px; height: 20px; fill: var(--affine-background-primary-color); } .affine-embed-youtube-content-title-text { flex: 1 0 0; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-word; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 600; line-height: 22px; } .affine-embed-youtube-content-creator-image { display: flex; width: 16px; height: 16px; flex-direction: column; align-items: flex-start; } .affine-embed-youtube-content-creator-image img, .affine-embed-youtube-content-creator-image object, .affine-embed-youtube-content-creator-image svg { width: 16px; height: 16px; border-radius: 50%; fill: var(--affine-background-primary-color); } .affine-embed-youtube-content-creator-text { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; color: var(--affine-text-primary-color); text-align: justify; font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-youtube-content-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; flex: 1 0 0; align-self: stretch; word-break: break-word; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-youtube-content-url { display: flex; align-items: center; justify-content: flex-start; gap: 4px; width: max-content; max-width: 100%; cursor: pointer; } .affine-embed-youtube-content-url > span { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-all; white-space: normal; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-secondary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-embed-youtube-content-url:hover > span { color: var(--affine-link-color); } .affine-embed-youtube-content-url:hover .open-icon { fill: var(--affine-link-color); } .affine-embed-youtube-content-url-icon { display: flex; align-items: center; justify-content: center; width: 12px; height: 12px; } .affine-embed-youtube-content-url-icon .open-icon { height: 12px; width: 12px; fill: var(--affine-text-secondary-color); } .affine-embed-youtube-block.loading { .affine-embed-youtube-content-title-text { color: var(--affine-placeholder-color); } } .affine-embed-youtube-block.selected { .affine-embed-youtube-content-url > span { color: var(--affine-link-color); } .affine-embed-youtube-content-url .open-icon { fill: var(--affine-link-color); } } `,r2=(0,L.qy)` `;async function r5(e,t,i){let s=e.url,[o,r]=await Promise.all([t.query(s,i),r7(s,i)]),a={...o,...r};if(a.creatorUrl){let e=await t.query(a.creatorUrl,i);a.creatorImage=e.image}return a}async function r7(e,t){let i={},s=`https://youtube.com/oembed?url=${e}&format=json`,o=await fetch(s,{signal:t}).catch(()=>null);if(o&&o.ok){let{title:e,author_name:t,author_url:s}=await o.json();i={title:e,creator:t,creatorUrl:s}}return i}async function r3(e,t){let i=null,s=null,o=null,r=null,a=null,n=null;try{e.loading=!0;let l=e.service?.queryUrlData;(0,H.Z1)(l);let c=await l(e.model,t);if({image:i=null,title:s=null,description:o=null,creator:r=null,creatorUrl:a=null,creatorImage:n=null}=c,t?.aborted)return;e.doc.updateBlock(e.model,{image:i,title:s,description:o,creator:r,creatorUrl:a,creatorImage:n})}catch(e){if(t?.aborted||(0,oA.z)(e))return;throw e}finally{e.loading=!1}}var r4=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},r6=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("affine-embed-youtube-block")],n=[],l=oF,c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];return class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.MZ)({attribute:!1})],r4(this,null,i,{kind:"accessor",name:"_isSelected",static:!1,private:!1,access:{has:e=>"_isSelected"in e,get:e=>e._isSelected,set:(e,t)=>{e._isSelected=t}},metadata:v},c,d),r4(this,null,s,{kind:"accessor",name:"_showImage",static:!1,private:!1,access:{has:e=>"_showImage"in e,get:e=>e._showImage,set:(e,t)=>{e._showImage=t}},metadata:v},h,u),r4(this,null,o,{kind:"accessor",name:"_showOverlay",static:!1,private:!1,access:{has:e=>"_showOverlay"in e,get:e=>e._showOverlay,set:(e,t)=>{e._showOverlay=t}},metadata:v},p,f),r4(this,null,r,{kind:"accessor",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:v},g,m),r4(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=r0}_handleClick(e){e.stopPropagation(),this.isInSurface||this._selectBlock()}_handleDoubleClick(e){e.stopPropagation(),this.open()}_selectBlock(){let e=this.host.selection,t=e.create("block",{blockId:this.blockId});e.setGroup("note",[t])}connectedCallback(){super.connectedCallback(),this.model.videoId||this.doc.withoutTransact(()=>{let e=this.model.url.match(r1.iB);if(e){let[,t]=e;this.doc.updateBlock(this.model,{videoId:t})}}),this.model.description||this.model.title||this.doc.withoutTransact(()=>{this.refreshData()}),this.disposables.add(this.model.propsUpdated.on(({key:e})=>{this.requestUpdate(),"url"===e&&this.refreshData()})),this.disposables.add(this.std.selection.slots.changed.on(()=>{this._isSelected=!!this.selected?.is("block")||!!this.selected?.is("surface"),this._showOverlay=this._isResizing||this._isDragging||!this._isSelected})),this.handleEvent("dragStart",()=>{this._isDragging=!0,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}),this.handleEvent("dragEnd",()=>{this._isDragging=!1,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}),matchMedia("print").addEventListener("change",()=>{this._showImage=matchMedia("print").matches}),this.isInSurface&&(this.disposables.add(this.model.propsUpdated.on(()=>{this.requestUpdate()})),this.rootService?.slots.elementResizeStart.on(()=>{this._isResizing=!0,this._showOverlay=!0}),this.rootService?.slots.elementResizeEnd.on(()=>{this._isResizing=!1,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}))}renderBlock(){let{image:e,title:t="YouTube",description:i,creator:s,creatorImage:o,videoId:r,style:a}=this.model;this._cardStyle=a,this._width=eh.Cd[this._cardStyle],this._height=eh.Hn[this._cardStyle];let n=this.loading,{LoadingIcon:l,EmbedCardBannerIcon:c}=(0,oT.Yr)(),d=n?l:r2,h=n?"Loading...":t,u=n?"":i,p=!n&&e?(0,L.qy)` ${c} `:c,f=!n&&o?(0,L.qy)``:L.s6;return this.renderEmbed(()=>(0,L.qy)`
${r?(0,L.qy)`
YouTube Video
`:p}
${d}
${h}
${f}
${s}
${u}
www.youtube.com
${sv.gb}
`)}#i9;get _isSelected(){return this.#i9}set _isSelected(e){this.#i9=e}#s_;get _showImage(){return this.#s_}set _showImage(e){this.#s_=e}#sr;get _showOverlay(){return this.#sr}set _showOverlay(e){this.#sr=e}#si;get loading(){return this.#si}set loading(e){this.#si=e}constructor(){super(...arguments),this._cardStyle="video",this._isDragging=!1,this._isResizing=!1,this.open=()=>{let e=this.model.url;e.match(/^[a-zA-Z]+:\/\//)||(e="https://"+e),window.open(e,"_blank")},this.refreshData=()=>{r3(this,this.fetchAbortController.signal).catch(console.error)},this.#i9=r6(this,c,!1),this.#s_=(r6(this,d),r6(this,h,!1)),this.#sr=(r6(this,u),r6(this,p,!0)),this.#si=(r6(this,f),r6(this,g,!1)),r6(this,m)}static{r6(t,n)}},t})();var r9=i(48577);i(45378);var ae=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},at=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d,h,u,p,f,g,m,v,y,b=[(0,D.EM)("editor-icon-button")],w=[],x=L.WF,_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],P=[],H=[],A=[],j=[],V=[],z=[],R=[],F=[],N=[],q=[],U=[],W=[],G=[],Y=[],K=[],X=[],Q=[],J=[],ee=[],et=[],ei=[],es=[],eo=[];(class extends x{static{t=this}static{let L="function"==typeof Symbol&&Symbol.metadata?Object.create(x[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({type:Boolean,reflect:!0})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({type:Boolean,reflect:!0})],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],c=[(0,D.MZ)({attribute:!1})],d=[(0,D.MZ)({attribute:!1})],h=[(0,D.MZ)({attribute:!1})],u=[(0,D.MZ)({attribute:!1})],p=[(0,D.MZ)({attribute:!1})],f=[(0,D.MZ)({type:Boolean})],g=[(0,D.MZ)({attribute:!1})],m=[(0,D.MZ)({attribute:!1})],v=[(0,D.MZ)({attribute:!1})],y=[(0,D.MZ)({attribute:!1})],ae(this,null,i,{kind:"accessor",name:"active",static:!1,private:!1,access:{has:e=>"active"in e,get:e=>e.active,set:(e,t)=>{e.active=t}},metadata:L},_,C),ae(this,null,s,{kind:"accessor",name:"activeMode",static:!1,private:!1,access:{has:e=>"activeMode"in e,get:e=>e.activeMode,set:(e,t)=>{e.activeMode=t}},metadata:L},k,S),ae(this,null,o,{kind:"accessor",name:"arrow",static:!1,private:!1,access:{has:e=>"arrow"in e,get:e=>e.arrow,set:(e,t)=>{e.arrow=t}},metadata:L},M,E),ae(this,null,r,{kind:"accessor",name:"coming",static:!1,private:!1,access:{has:e=>"coming"in e,get:e=>e.coming,set:(e,t)=>{e.coming=t}},metadata:L},I,B),ae(this,null,a,{kind:"accessor",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:L},$,T),ae(this,null,n,{kind:"accessor",name:"hover",static:!1,private:!1,access:{has:e=>"hover"in e,get:e=>e.hover,set:(e,t)=>{e.hover=t}},metadata:L},O,P),ae(this,null,l,{kind:"accessor",name:"hoverState",static:!1,private:!1,access:{has:e=>"hoverState"in e,get:e=>e.hoverState,set:(e,t)=>{e.hoverState=t}},metadata:L},H,A),ae(this,null,c,{kind:"accessor",name:"iconContainerPadding",static:!1,private:!1,access:{has:e=>"iconContainerPadding"in e,get:e=>e.iconContainerPadding,set:(e,t)=>{e.iconContainerPadding=t}},metadata:L},j,V),ae(this,null,d,{kind:"accessor",name:"iconContainerWidth",static:!1,private:!1,access:{has:e=>"iconContainerWidth"in e,get:e=>e.iconContainerWidth,set:(e,t)=>{e.iconContainerWidth=t}},metadata:L},z,R),ae(this,null,h,{kind:"accessor",name:"iconSize",static:!1,private:!1,access:{has:e=>"iconSize"in e,get:e=>e.iconSize,set:(e,t)=>{e.iconSize=t}},metadata:L},F,N),ae(this,null,u,{kind:"accessor",name:"justify",static:!1,private:!1,access:{has:e=>"justify"in e,get:e=>e.justify,set:(e,t)=>{e.justify=t}},metadata:L},q,U),ae(this,null,p,{kind:"accessor",name:"labelHeight",static:!1,private:!1,access:{has:e=>"labelHeight"in e,get:e=>e.labelHeight,set:(e,t)=>{e.labelHeight=t}},metadata:L},W,G),ae(this,null,f,{kind:"accessor",name:"showTooltip",static:!1,private:!1,access:{has:e=>"showTooltip"in e,get:e=>e.showTooltip,set:(e,t)=>{e.showTooltip=t}},metadata:L},Y,K),ae(this,null,g,{kind:"accessor",name:"tipPosition",static:!1,private:!1,access:{has:e=>"tipPosition"in e,get:e=>e.tipPosition,set:(e,t)=>{e.tipPosition=t}},metadata:L},X,Q),ae(this,null,m,{kind:"accessor",name:"tooltip",static:!1,private:!1,access:{has:e=>"tooltip"in e,get:e=>e.tooltip,set:(e,t)=>{e.tooltip=t}},metadata:L},J,ee),ae(this,null,v,{kind:"accessor",name:"tooltipOffset",static:!1,private:!1,access:{has:e=>"tooltipOffset"in e,get:e=>e.tooltipOffset,set:(e,t)=>{e.tooltipOffset=t}},metadata:L},et,ei),ae(this,null,y,{kind:"accessor",name:"withHover",static:!1,private:!1,access:{has:e=>"withHover"in e,get:e=>e.withHover,set:(e,t)=>{e.withHover=t}},metadata:L},es,eo),ae(null,e={value:t},b,{kind:"class",name:t.name,metadata:L},null,w),t=e.value,L&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:L})}static{this.styles=(0,L.AH)` :host([disabled]), :host(:disabled) { pointer-events: none; cursor: not-allowed; color: var(--affine-text-disable-color); } .icon-container { position: relative; display: flex; align-items: center; padding: var(--icon-container-padding); color: var(--affine-icon-color); border-radius: 4px; cursor: pointer; white-space: nowrap; box-sizing: border-box; width: var(--icon-container-width, unset); justify-content: var(--justify, unset); user-select: none; } :host([active]) .icon-container.active-mode-color { color: var(--affine-primary-color); } :host([active]) .icon-container.active-mode-background { background: var(--affine-hover-color); } .icon-container[coming] { cursor: not-allowed; color: var(--affine-text-disable-color); } ::slotted(svg) { flex-shrink: 0; width: var(--icon-size, unset); height: var(--icon-size, unset); } ::slotted(.label) { flex: 1; padding: 0 4px; overflow: hidden; white-space: nowrap; line-height: var(--label-height, inherit); } ::slotted(.label.padding0) { padding: 0; } ::slotted(.label.ellipsis) { text-overflow: ellipsis; } ::slotted(.label.medium) { font-weight: 500; } .icon-container[with-hover]::before { content: ''; display: block; background: var(--affine-hover-color); position: absolute; width: 100%; height: 100%; top: 0; left: 0; border-radius: 4px; } `}constructor(){super(),at(this,eo),this.addEventListener("keypress",e=>{!this.disabled&&("Enter"!==e.key||e.isComposing||this.click())}),this.addEventListener("click",e=>{this.disabled&&(e.stopPropagation(),e.preventDefault())},{capture:!0})}connectedCallback(){super.connectedCallback(),this.tabIndex=0,this.role="button"}render(){let e=this.coming?"(Coming soon)":this.tooltip,t=`icon-container active-mode-${this.activeMode} ${this.hoverState?"hovered":""}`,i=this.iconContainerPadding,s=(0,Z.W)({"--icon-container-width":this.iconContainerWidth,"--icon-container-padding":Array.isArray(i)?i.map(e=>`${e}px`).join(" "):`${i}px`,"--icon-size":this.iconSize,"--justify":this.justify,"--label-height":this.labelHeight});return(0,L.qy)`
${(0,r9.P)(this.showTooltip&&e?(0,L.qy)`${e}`:L.s6)}
`}#iN=at(this,_,!1);get active(){return this.#iN}set active(e){this.#iN=e}#sC=(at(this,C),at(this,k,"color"));get activeMode(){return this.#sC}set activeMode(e){this.#sC=e}#ec=(at(this,S),at(this,M,!0));get arrow(){return this.#ec}set arrow(e){this.#ec=e}#sk=(at(this,E),at(this,I,!1));get coming(){return this.#sk}set coming(e){this.#sk=e}#iq=(at(this,B),at(this,$,!1));get disabled(){return this.#iq}set disabled(e){this.#iq=e}#iW=(at(this,T),at(this,O,!0));get hover(){return this.#iW}set hover(e){this.#iW=e}#sS=(at(this,P),at(this,H,!1));get hoverState(){return this.#sS}set hoverState(e){this.#sS=e}#sM=(at(this,A),at(this,j,2));get iconContainerPadding(){return this.#sM}set iconContainerPadding(e){this.#sM=e}#sE=(at(this,V),at(this,z,void 0));get iconContainerWidth(){return this.#sE}set iconContainerWidth(e){this.#sE=e}#sI=(at(this,R),at(this,F,void 0));get iconSize(){return this.#sI}set iconSize(e){this.#sI=e}#sB=(at(this,N),at(this,q,void 0));get justify(){return this.#sB}set justify(e){this.#sB=e}#s$=(at(this,U),at(this,W,void 0));get labelHeight(){return this.#s$}set labelHeight(e){this.#s$=e}#sT=(at(this,G),at(this,Y,!0));get showTooltip(){return this.#sT}set showTooltip(e){this.#sT=e}#sO=(at(this,K),at(this,X,"top"));get tipPosition(){return this.#sO}set tipPosition(e){this.#sO=e}#sP=(at(this,Q),at(this,J,void 0));get tooltip(){return this.#sP}set tooltip(e){this.#sP=e}#sH=(at(this,ee),at(this,et,8));get tooltipOffset(){return this.#sH}set tooltipOffset(e){this.#sH=e}#sA=(at(this,ei),at(this,es,void 0));get withHover(){return this.#sA}set withHover(e){this.#sA=e}static{at(t,w)}})})();var ai=i(72895),as=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ao=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("editor-menu-button")],n=[],l=(0,P.Tm)(L.WF),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.P)("editor-menu-content")],s=[(0,D.P)("editor-icon-button")],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],as(this,null,i,{kind:"accessor",name:"_content",static:!1,private:!1,access:{has:e=>"_content"in e,get:e=>e._content,set:(e,t)=>{e._content=t}},metadata:v},c,d),as(this,null,s,{kind:"accessor",name:"_trigger",static:!1,private:!1,access:{has:e=>"_trigger"in e,get:e=>e._trigger,set:(e,t)=>{e._trigger=t}},metadata:v},h,u),as(this,null,o,{kind:"accessor",name:"button",static:!1,private:!1,access:{has:e=>"button"in e,get:e=>e.button,set:(e,t)=>{e.button=t}},metadata:v},p,f),as(this,null,r,{kind:"accessor",name:"contentPadding",static:!1,private:!1,access:{has:e=>"contentPadding"in e,get:e=>e.contentPadding,set:(e,t)=>{e.contentPadding=t}},metadata:v},g,m),as(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { display: flex; align-items: center; justify-content: center; gap: 8px; } `}firstUpdated(){this._popper=(0,ai.j)(this._trigger,this._content,({display:e})=>{this._trigger.showTooltip="hidden"===e,this.dispatchEvent(new ToggleEvent("toggle",{newState:e,bubbles:!1,cancelable:!1,composed:!0}))},{mainAxis:12,ignoreShift:!0}),this._disposables.addFromEvent(this,"keydown",e=>{e.stopPropagation(),"Escape"===e.key&&this._popper.hide()}),this._disposables.addFromEvent(this._trigger,"click",e=>{this._popper.toggle(),"show"===this._popper.state&&this._content.focus({preventScroll:!0})}),this._disposables.add(this._popper)}hide(){this._popper?.hide()}render(){return(0,L.qy)` ${this.button} `}show(e=!1){this._popper?.show(e)}willUpdate(e){e.has("contentPadding")&&this.style.setProperty("--content-padding",this.contentPadding??"")}#sL=ao(this,c,void 0);get _content(){return this.#sL}set _content(e){this.#sL=e}#sD=(ao(this,d),ao(this,h,void 0));get _trigger(){return this.#sD}set _trigger(e){this.#sD=e}#sZ=(ao(this,u),ao(this,p,void 0));get button(){return this.#sZ}set button(e){this.#sZ=e}#sj=(ao(this,f),ao(this,g,void 0));get contentPadding(){return this.#sj}set contentPadding(e){this.#sj=e}constructor(){super(...arguments),ao(this,m)}static{ao(t,n)}})})(),(()=>{let e,t,i=[(0,D.EM)("editor-menu-content")],s=[],o=L.WF;(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;as(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` :host { --packed-height: 6px; --offset-height: calc(-1 * var(--packed-height)); display: none; outline: none; } :host::before, :host::after { content: ''; display: block; position: absolute; height: var(--packed-height); width: 100%; } :host::before { top: var(--offset-height); } :host::after { bottom: var(--offset-height); } :host([data-show]) { ${sU}; justify-content: center; padding: var(--content-padding, 0 6px); } ::slotted(:not(.custom)) { display: flex; align-items: center; align-self: stretch; gap: 8px; min-height: 36px; } ::slotted([data-size]) { min-width: 146px; } ::slotted([data-size='small']) { min-width: 164px; } ::slotted([data-size='large']) { min-width: 176px; } ::slotted([data-orientation='vertical']) { flex-direction: column; align-items: stretch; gap: unset; min-height: unset; } `}render(){return(0,L.qy)``}static{ao(t,s)}})})(),(()=>{let e,t,i=[(0,D.EM)("editor-menu-action")],s=[],o=L.WF;(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;as(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` :host { display: flex; width: 100%; align-items: center; white-space: nowrap; box-sizing: border-box; padding: 4px 8px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; cursor: pointer; gap: 8px; color: var(--affine-text-primary-color); font-weight: 400; min-height: 30px; // 22 + 8 } :host(:hover), :host([data-selected]) { background-color: var(--affine-hover-color); } :host([data-selected]) { pointer-events: none; } :host(:hover.delete), :host(:hover.delete) ::slotted(svg) { background-color: var(--affine-background-error-color); color: var(--affine-error-color); } :host([disabled]) { pointer-events: none; cursor: not-allowed; color: var(--affine-text-disable-color); } ::slotted(svg) { color: var(--affine-icon-color); } `}connectedCallback(){super.connectedCallback(),this.role="button"}render(){return(0,L.qy)``}static{ao(t,s)}})})();var ar=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},aa=function(e,t,i){for(var s=arguments.length>2,o=0;o`}(()=>{let e,t,i=[(0,D.EM)("editor-toolbar-separator")],s=[],o=L.WF;(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;ar(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` :host { display: flex; align-items: center; justify-content: center; align-self: stretch; flex-shrink: 0; width: 4px; } :host::after { content: ''; display: flex; width: 0.5px; height: 100%; background-color: var(--affine-border-color); } :host([data-orientation='horizontal']) { height: 8px; width: unset; } :host([data-orientation='horizontal'])::after { height: 0.5px; width: 100%; } `}static{aa(t,s)}})})();var al=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ac=function(e,t,i){for(var s=arguments.length>2,o=0;oe.length).map(e=>e.filter(e=>e!==L.s6)).filter(e=>e.length).map(e=>(0,t$.u)(e,e=>e.name,e=>(0,L.qy)` t?.(e)} > ${e.icon}${e.name} `)),()=>(0,L.qy)` `)}(()=>{let e,t,i=[(0,D.EM)("editor-toolbar")],s=[],o=(0,P.Tm)(L.WF);(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;al(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` :host { ${sU}; height: 36px; box-sizing: content-box; } :host([data-without-bg]) { border-color: transparent; background: transparent; box-shadow: none; } ::slotted(*) { display: flex; height: 100%; justify-content: center; align-items: center; gap: 8px; color: var(--affine-text-primary-color); fill: currentColor; } `}connectedCallback(){super.connectedCallback(),this._disposables.addFromEvent(this,"pointerdown",e=>{e.stopPropagation(),e.preventDefault()}),this._disposables.addFromEvent(this,"wheel",sy.dG)}render(){return(0,L.qy)``}static{ac(t,s)}})})();var ah=i(22366);let au=(0,L.AH)` :host { position: absolute; top: 0; left: 0; z-index: var(--affine-z-index-popover); } .affine-link-preview { display: flex; justify-content: flex-start; width: 140px; padding: var(--1, 0px); border-radius: var(--1, 0px); opacity: var(--add, 1); user-select: none; cursor: pointer; color: var(--affine-link-color); font-feature-settings: 'clig' off, 'liga' off; font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 400; text-decoration: none; text-wrap: nowrap; } .affine-link-preview > span { display: inline-block; -webkit-line-clamp: 1; -webkit-box-orient: vertical; text-overflow: ellipsis; overflow: hidden; opacity: var(--add, 1); } .card-style-select icon-button.selected { border: 1px solid var(--affine-brand-color); } `;var ap=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},af=function(e,t,i){for(var s=arguments.length>2,o=0;o{let[s]=function(e,t){let i=function(e,t){let[i]=e.command.chain().isTextStyleActive({key:t}).run();return i}(e,t),s={styles:{[t]:!i||null}};return e.command.chain().try(e=>[e.getTextSelection().formatText(s),e.getBlockSelections().formatBlock(s),e.formatNative(s)]).run()}(t.std,e);return!!s&&i()}}function av(e){let t=[];return(e.forEach(([e,i])=>{if(!i)return;let s=e.getFormat(i);t.push(s)}),0===t.length)?{}:t.reduce((e,t)=>{let i={};for(let s in e)e[s]===t[s]&&(i[s]=e[s]);return i})}function ay(e,t){return e.flatMap(e=>{let i=e.querySelector(`[${A.jN}]`);return i?t(i):[]})}function ab(e,t){return e.try(e=>[e.getTextSelection().getSelectedBlocks({types:["text"],filter:e=>en.includes(e.model.flavour)}).inline((e,i)=>{let{selectedBlocks:s,currentTextSelection:o}=e;if((0,H.Z1)(s),(0,H.Z1)(o),o.isCollapsed())return!1;let r=t("text",ay(s,e=>e.inlineEditor.getInlineRange()?e.inlineEditor:[]));return!!r&&(!0===r?i():i(r))}),e.getBlockSelections().getSelectedBlocks({types:["block"],filter:e=>el.includes(e.model.flavour)}).inline((e,i)=>{let{selectedBlocks:s}=e;(0,H.Z1)(s);let o=t("block",ay(s,e=>e.inlineEditor.yTextLength>0?e.inlineEditor:[]));return!!o&&(!0===o?i():i(o))}),e.inline((e,i)=>{let s=t("native",Array.from(e.std.host.querySelectorAll(`[${A.jN}]`)).filter(e=>{let t=document.getSelection();return!!t&&0!==t.rangeCount&&t.getRangeAt(0).intersectsNode(e)}).filter(e=>{let t=e.closest(`[${eh.u_}]`);return!!t&&ec.includes(t.model.flavour)}).map(e=>e.inlineEditor));return!!s&&(!0===s?i():i(s))})])}function aw(e){return ab(e,(e,t)=>"text"===e?{textStyle:av(t.map(e=>[e,e.getInlineRange()]))}:"block"===e?{textStyle:av(t.map(e=>[e,{index:0,length:e.yTextLength}]))}:"native"===e&&{textStyle:av(t.map(e=>[e,e.getInlineRange()]))})}function ax(e){return ab(e,(e,t)=>t.length>0)}(()=>{let e,t,i,s,o,r,a=[(0,D.EM)(ag)],n=[],l=P.W,c=[],d=[],h=[],u=[],p=[],g=[],m=[],v=[];(class extends l{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.P)(".embed-card-toolbar-button.card-style")],s=[(0,D.P)(".embed-card-toolbar")],o=[(0,D.wk)()],r=[(0,D.P)(".embed-card-toolbar-button.more-button")],ap(this,null,i,{kind:"accessor",name:"cardStyleButton",static:!1,private:!1,access:{has:e=>"cardStyleButton"in e,get:e=>e.cardStyleButton,set:(e,t)=>{e.cardStyleButton=t}},metadata:f},c,d),ap(this,null,s,{kind:"accessor",name:"embedCardToolbarElement",static:!1,private:!1,access:{has:e=>"embedCardToolbarElement"in e,get:e=>e.embedCardToolbarElement,set:(e,t)=>{e.embedCardToolbarElement=t}},metadata:f},h,u),ap(this,null,o,{kind:"accessor",name:"hide",static:!1,private:!1,access:{has:e=>"hide"in e,get:e=>e.hide,set:(e,t)=>{e.hide=t}},metadata:f},p,g),ap(this,null,r,{kind:"accessor",name:"moreButton",static:!1,private:!1,access:{has:e=>"moreButton"in e,get:e=>e.moreButton,set:(e,t)=>{e.moreButton=t}},metadata:f},m,v),ap(null,e={value:t},a,{kind:"class",name:t.name,metadata:f},null,n),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=au}get _canConvertToEmbedView(){return(!(this._focusModel&&(0,tE.C8)(this._focusModel))||!!this.doc.awarenessStore.getFlag("enable_synced_doc_block"))&&!!this._focusBlock&&("convertToEmbed"in this._focusBlock||this._embedOptions?.viewType==="embed")}_canShowCardStylePanel(e){return(0,tE.Cv)(e)||(0,tE.EG)(e)||(0,tE.C8)(e)}get _canShowUrlOptions(){return this._focusModel&&"url"in this._focusModel&&this._isCardView}_cardStyleMenuButton(){if(this._focusModel&&this._canShowCardStylePanel(this._focusModel)){let{EmbedCardHorizontalIcon:e,EmbedCardListIcon:t}=(0,oT.Yr)();return(0,L.qy)` ${G.v1n} `} >
${(0,t$.u)([{type:"horizontal",name:"Large horizontal style",icon:e},{type:"list",name:"Small horizontal style",icon:t}],e=>e.type,({type:e,name:t,icon:i})=>(0,L.qy)` this._setEmbedCardStyle(e)} > ${i} ${t} `)}
`}return L.s6}_convertToCardView(){if(this._isCardView||!this._focusBlock)return;if("convertToCard"in this._focusBlock){this._focusBlock.convertToCard();return}if(!this._focusModel||!("url"in this._focusModel))return;let{doc:e,url:t,style:i,caption:s}=this._focusModel,o="affine:bookmark",r=i;if(this._embedOptions&&"card"===this._embedOptions.viewType){let{flavour:e,styles:t}=this._embedOptions;o=e,r=t.includes(i)?i:t[0]}else r=ah.HO.includes(i)?i:ah.HO.filter(e=>"vertical"!==e&&"cube"!==e)[0];let a=e.getParent(this._focusModel);(0,H.Z1)(a);let n=a.children.indexOf(this._focusModel);e.addBlock(o,{url:t,style:r,caption:s},a,n),this.std.selection.setGroup("note",[]),e.deleteBlock(this._focusModel)}_convertToEmbedView(){if(this._isEmbedView||!this._focusBlock)return;if("convertToEmbed"in this._focusBlock){this._focusBlock.convertToEmbed();return}if(!this._focusModel||!("url"in this._focusModel))return;let{doc:e,url:t,style:i,caption:s}=this._focusModel;if(!this._embedOptions||"embed"!==this._embedOptions.viewType)return;let{flavour:o,styles:r}=this._embedOptions,a=r.includes(i)?i:r.filter(e=>"vertical"!==e&&"cube"!==e)[0],n=e.getParent(this._focusModel);(0,H.Z1)(n);let l=n.children.indexOf(this._focusModel);e.addBlock(o,{url:t,style:a,caption:s},n,l),this.std.selection.setGroup("note",[]),e.deleteBlock(this._focusModel)}async _copyBlock(){if(!this._focusModel)return;let e=f.Ji.fromModels(this.doc,[this._focusModel]);await this.std.clipboard.copySlice(e),(0,e5.o)(this.host,"Copied link to clipboard"),this._abortController.abort()}_copyUrl(){this._focusModel&&"url"in this._focusModel&&(navigator.clipboard.writeText(this._focusModel.url).catch(console.error),(0,e5.o)(this.host,"Copied link to clipboard"))}_duplicateBlock(){if(!this._focusBlock||!this._focusModel)return;let e=this._focusModel,{width:t,height:i,xywh:s,rotate:o,zIndex:r,...a}=(0,i2.i)(e),{doc:n}=e,l=n.getParent(e),c=l?.children.indexOf(e);n.addBlock(e.flavour,a,l,c),this._abortController.abort()}get _embedViewButtonDisabled(){return!!this.doc.readonly||this._focusModel&&this._focusBlock&&(0,tE.C8)(this._focusModel)&&(!!this._focusBlock.closest("affine-embed-synced-doc-block")||this._focusModel.pageId===this.doc.id)}get _focusModel(){return this._focusBlock?.model}_hide(){this._resetAbortController(),this._focusBlock=null,this.hide=!0}get _isCardView(){return this._focusModel&&((0,tE.Cv)(this._focusModel)||(0,tE.C8)(this._focusModel)||this._embedOptions?.viewType==="card")}get _isEmbedView(){return this._focusModel&&!(0,tE.Cv)(this._focusModel)&&((0,tE.v8)(this._focusModel)||this._embedOptions?.viewType==="embed")}_moreActions(){return ad([[{type:"copy",name:"Copy",icon:G.TdU,disabled:this.doc.readonly,handler:()=>{this._copyBlock().catch(console.error)}},{type:"duplicate",name:"Duplicate",icon:G.jaP,disabled:this.doc.readonly,handler:()=>this._duplicateBlock()},this._focusModel&&this._refreshable(this._focusModel)?{type:"reload",name:"Reload",icon:G.fNY,disabled:this.doc.readonly,handler:()=>this._refreshData()}:L.s6],[{type:"delete",name:"Delete",icon:G.d7y,disabled:this.doc.readonly,handler:()=>this._focusModel&&this.doc.deleteBlock(this._focusModel)}]])}get _openButtonDisabled(){return this._focusModel&&(0,tE.C8)(this._focusModel)&&this._focusModel.pageId===this.doc.id}_openMenuButton(){let e=[];this._focusModel&&((0,tE.C8)(this._focusModel)||(0,tE.v8)(this._focusModel))&&e.push({name:"Open this doc",icon:G.UYC,handler:()=>this._focusBlock?.open()});let t=this._focusBlock;return(t&&(0,U.mV)(t)&&e.push({name:"Open in center peek",icon:G.KRn,handler:()=>(0,U.se)(t)}),0===e.length)?L.s6:(0,L.qy)` ${G.gb9}${G.eoI} `} >
${(0,t$.u)(e,e=>e.name,({name:e,icon:t,handler:i,disabled:s})=>(0,L.qy)` ${t}${e} `)}
`}_refreshData(){this._focusBlock?.refreshData(),this._abortController.abort()}_refreshable(e){return(0,tE.TW)(e)||(0,tE.Cv)(e)||(0,tE.BG)(e)||(0,tE.qo)(e)}get _rootService(){return this.std.spec.getService("affine:page")}get _selection(){return this.host.selection}_setEmbedCardStyle(e){this._focusModel?.doc.updateBlock(this._focusModel,{style:e}),this.requestUpdate(),this._abortController.abort()}_show(){this._focusBlock&&(this.hide=!1,this._abortController.signal.addEventListener("abort",(0,sI.ll)(this._focusBlock,this,()=>{this._focusBlock&&(0,sI.rD)(this._focusBlock,this,{placement:"top-start",middleware:[(0,sI.UU)(),(0,sI.cY)(8)]}).then(({x:e,y:t})=>{this.style.left=`${e}px`,this.style.top=`${t}px`}).catch(console.error)})))}_showCaption(){let e=this._focusBlock;if(e){try{e.captionEditor?.show()}catch(t){!function(e){e.host.selection.clear();let t=new sK;t.block=e,document.body.append(t)}(e)}this._resetAbortController()}}_turnIntoInlineView(){if(this._focusBlock&&"covertToInline"in this._focusBlock){this._focusBlock.covertToInline();return}if(!this._focusModel||!("url"in this._focusModel))return;let{doc:e}=this._focusModel,t=e.getParent(this._focusModel),i=t?.children.indexOf(this._focusModel),s=new f.rl.Y.Text,o=this._focusModel.title||this._focusModel.caption||this._focusModel.url;s.insert(0,o),s.format(0,o.length,{link:this._focusModel.url});let r=new e.Text(s);e.addBlock("affine:paragraph",{text:r},t,i),e.deleteBlock(this._focusModel)}_viewMenuButton(){let e=[];return e.push({type:"inline",name:"Inline view",handler:()=>this._turnIntoInlineView(),disabled:this.doc.readonly}),e.push({type:"card",name:"Card view",handler:()=>this._convertToCardView(),disabled:this.doc.readonly}),(this._canConvertToEmbedView||this._isEmbedView)&&e.push({type:"embed",name:"Embed view",handler:()=>this._convertToEmbedView(),disabled:this.doc.readonly&&this._embedViewButtonDisabled}),(0,L.qy)`
${this._viewType} view
${G.eoI} `} >
${(0,t$.u)(e,e=>e.type,({type:e,name:t,handler:i,disabled:s})=>(0,L.qy)` ${t} `)}
`}get _viewType(){return this._isCardView?"card":this._isEmbedView?"embed":"inline"}connectedCallback(){super.connectedCallback(),this.disposables.add(this._selection.slots.changed.on(()=>{if(this._selection.find("text")){this._hide();return}let e=this._selection.filter("block");if(!e||1!==e.length){this._hide();return}let t=this.std.view.getBlock(e[0].blockId);if(!t||!(t instanceof oj||t instanceof rt||t instanceof r8||t instanceof oG||t instanceof rH||t instanceof rJ||t instanceof rU)){this._hide();return}this._focusBlock=t,this._show()}))}render(){if(this.hide)return L.s6;let e=this._focusModel;this._embedOptions=e&&"url"in e?this._rootService.getEmbedBlockOptions(e.url):null;let t=[this._canShowUrlOptions&&e&&"url"in e?(0,L.qy)` ${(0,oT.yz)(e.url)} this._copyUrl()} > ${G.TdU} s1(this.host,e)} > ${G.qUP} `:L.s6,this._openMenuButton(),this._viewMenuButton(),this._cardStyleMenuButton(),(0,L.qy)` this._showCaption()} > ${G.ITz} `,(0,L.qy)` ${G.FHP} `} >
${this._moreActions()}
`];return(0,L.qy)` ${(0,sj.f)(t.filter(e=>e!==L.s6),an)} `}#sV;get cardStyleButton(){return this.#sV}set cardStyleButton(e){this.#sV=e}#sz;get embedCardToolbarElement(){return this.#sz}set embedCardToolbarElement(e){this.#sz=e}#sR;get hide(){return this.#sR}set hide(e){this.#sR=e}#sF;get moreButton(){return this.#sF}set moreButton(e){this.#sF=e}constructor(){super(...arguments),this._abortController=new AbortController,this._embedOptions=null,this._focusBlock=null,this._resetAbortController=()=>{this._abortController.abort(),this._abortController=new AbortController},this.#sV=af(this,c,null),this.#sz=(af(this,d),af(this,h,void 0)),this.#sR=(af(this,u),af(this,p,!0)),this.#sF=(af(this,g),af(this,m,null)),af(this,v)}static{af(t,n)}})})();var a_=i(45601),aC=i(4068);let ak=["red","orange","yellow","green","teal","blue","purple","grey"],aS=[{name:"Default Background",color:null,hotkey:null},...ak.map(e=>({name:`${e[0].toUpperCase()}${e.slice(1)} Background`,color:`var(--affine-text-highlight-${e})`,hotkey:null}))],aM=[{name:"Default Color",color:null,hotkey:null},...ak.map(e=>({name:`${e[0].toUpperCase()}${e.slice(1)}`,color:`var(--affine-text-highlight-foreground-${e})`,hotkey:null}))];!function(e){e[e.Foreground=0]="Foreground",e[e.Background=1]="Background"}(r||(r={}));let aE=null,aI=r.Background,aB=(e,t,i)=>{aE=t,aI=i;let s={styles:{color:i===r.Foreground?t:null,background:i===r.Background?t:null}};e.std.command.chain().try(e=>[e.getTextSelection().formatText(s),e.getBlockSelections().formatBlock(s),e.formatNative(s)]).run()},a$=(e,t)=>(0,L.qy)`
Color
${aM.map(({name:t,color:i})=>(0,L.qy)` ${G.q_Z} ${t} `)}
Background
${aS.map(({name:t,color:i})=>(0,L.qy)` ${G.zcx} ${t} `)}
`,aT=e=>{let t=e.host,{setFloating:i,setReference:s}=(0,aC.H)(t=>{if(!t){let t=e.shadowRoot?.querySelector(".highlight-panel");if(!t)return;t.style.display="none";return}let i=e.shadowRoot?.querySelector(".highlight-button"),s=e.shadowRoot?.querySelector(".highlight-panel");(0,H.Z1)(i),(0,H.Z1)(s),s.style.display="flex",(0,sI.rD)(i,s,{placement:"bottom",middleware:[(0,sI.UU)(),(0,sI.cY)(6),(0,sI.BN)({padding:6})]}).then(({x:e,y:t})=>{s.style.left=`${e}px`,s.style.top=`${t}px`}).catch(console.error)}),o=a$(e,i);return(0,L.qy)`
${G.wlz} ${G.ZLN} ${o}
`},aO=[{flavour:"affine:paragraph",type:"text",name:"Text",description:"Start typing with plain text.",hotkey:["Mod-Alt-0","Mod-Shift-0"],icon:G.N$i},{flavour:"affine:paragraph",type:"h1",name:"Heading 1",description:"Headings in the largest font.",hotkey:["Mod-Alt-1","Mod-Shift-1"],icon:G.BQZ},{flavour:"affine:paragraph",type:"h2",name:"Heading 2",description:"Headings in the 2nd font size.",hotkey:["Mod-Alt-2","Mod-Shift-2"],icon:G.SoJ},{flavour:"affine:paragraph",type:"h3",name:"Heading 3",description:"Headings in the 3rd font size.",hotkey:["Mod-Alt-3","Mod-Shift-3"],icon:G.Nrq},{flavour:"affine:paragraph",type:"h4",name:"Heading 4",description:"Headings in the 4th font size.",hotkey:["Mod-Alt-4","Mod-Shift-4"],icon:G.WXD},{flavour:"affine:paragraph",type:"h5",name:"Heading 5",description:"Headings in the 5th font size.",hotkey:["Mod-Alt-5","Mod-Shift-5"],icon:G.TXg},{flavour:"affine:paragraph",type:"h6",name:"Heading 6",description:"Headings in the 6th font size.",hotkey:["Mod-Alt-6","Mod-Shift-6"],icon:G.ma5},{flavour:"affine:list",type:"bulleted",name:"Bulleted List",description:"Create a bulleted list.",hotkey:["Mod-Alt-8","Mod-Shift-8"],icon:G.RyS},{flavour:"affine:list",type:"numbered",name:"Numbered List",description:"Create a numbered list.",hotkey:["Mod-Alt-9","Mod-Shift-9"],icon:G.gZg},{flavour:"affine:list",type:"todo",name:"To-do List",description:"Add tasks to a to-do list.",hotkey:null,icon:G.lOw},{flavour:"affine:code",type:void 0,name:"Code Block",description:"Code snippet with formatting.",hotkey:["Mod-Alt-c"],icon:G.I5t},{flavour:"affine:paragraph",type:"quote",name:"Quote",description:"Add a blockquote for emphasis.",hotkey:null,icon:G.cyi},{flavour:"affine:divider",type:"divider",name:"Divider",description:"Visually separate content.",hotkey:["Mod-Alt-d","Mod-Shift-d"],icon:G.za1}],aP=({formatBar:e,host:t,ref:i})=>{let s=e.configItems.filter(e=>"paragraph-action"===e.type).filter(({flavour:e})=>t.doc.schema.flavourSchemaMap.has(e)),o=(0,t$.u)(s,t=>(0,L.qy)` ${"function"==typeof t.icon?t.icon():t.icon} ${t.name} `);return(0,L.qy)`
${o}
`},aH=e=>{if("text"!==e.displayType&&"block"!==e.displayType)return null;let t=e.selectedBlocks;if(t.some(e=>!e.model.text))return null;let i=t.length<1?aO[0].icon:aO.find(({flavour:e,type:i})=>t[0].flavour===e&&t[0].model.type===i)?.icon??aO[0].icon;if(!iO(e.block))return console.error("paragraph button host is not a page component"),null;let{setFloating:s,setReference:o}=(0,aC.H)(t=>{if(!t){let t=e.shadowRoot?.querySelector(".paragraph-panel");if(!t)return;t.style.display="none";return}let i=e.formatBarElement,s=e.shadowRoot?.querySelector(".paragraph-button"),o=e.shadowRoot?.querySelector(".paragraph-panel");(0,H.Z1)(s),(0,H.Z1)(o),(0,H.Z1)(i,"format quick bar should exist"),o.style.display="flex",(0,sI.rD)(i,o,{placement:"top-start",middleware:[(0,sI.UU)(),(0,sI.cY)(6),(0,sI.BN)({padding:6})]}).then(({x:e,y:t})=>{o.style.left=`${e}px`,o.style.top=`${t}px`}).catch(console.error)}),r=aP({formatBar:e,host:e.host,ref:s});return(0,L.qy)`
${i} ${G.ZLN} ${r}
`};var aA=i(47590),aL=i(75404);let aD=(0,L.AH)` .paragraph-button-icon > svg:nth-child(2) { transition-duration: 0.3s; } .paragraph-button-icon:is(:hover, :focus-visible, :active) > svg:nth-child(2) { transform: rotate(180deg); } .highlight-icon > svg:nth-child(2) { transition-duration: 0.3s; } .highlight-icon:is(:hover, :focus-visible, :active) > svg:nth-child(2) { transform: rotate(180deg); } .highlight-panel { max-height: 380px; } .highligh-panel-heading { display: flex; color: var(--affine-text-secondary-color); padding: 4px; } editor-menu-content { display: none; position: absolute; padding: 0; z-index: var(--affine-z-index-popover); --packed-height: 6px; } editor-menu-content > div[data-orientation='vertical'] { padding: 8px; overflow-y: auto; } ${(0,aL.kM)('editor-menu-content > div[data-orientation="vertical"]')} `,aZ=(0,L.AH)` .affine-format-bar-widget { position: absolute; display: none; z-index: var(--affine-z-index-popover); user-select: none; } ${aD} `;var aj=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},aV=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n=[(0,D.EM)(az)],l=[],c=P.W,d=[],h=[],u=[],p=[],g=[],m=[],v=[],y=[],b=[],w=[];return class extends c{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.wk)()],a=[(0,D.P)(`.${az}`)],aj(this,null,i,{kind:"accessor",name:"_displayType",static:!1,private:!1,access:{has:e=>"_displayType"in e,get:e=>e._displayType,set:(e,t)=>{e._displayType=t}},metadata:f},d,h),aj(this,null,s,{kind:"accessor",name:"_dragging",static:!1,private:!1,access:{has:e=>"_dragging"in e,get:e=>e._dragging,set:(e,t)=>{e._dragging=t}},metadata:f},u,p),aj(this,null,o,{kind:"accessor",name:"_selectedBlocks",static:!1,private:!1,access:{has:e=>"_selectedBlocks"in e,get:e=>e._selectedBlocks,set:(e,t)=>{e._selectedBlocks=t}},metadata:f},g,m),aj(this,null,r,{kind:"accessor",name:"configItems",static:!1,private:!1,access:{has:e=>"configItems"in e,get:e=>e.configItems,set:(e,t)=>{e.configItems=t}},metadata:f},v,y),aj(this,null,a,{kind:"accessor",name:"formatBarElement",static:!1,private:!1,access:{has:e=>"formatBarElement"in e,get:e=>e.formatBarElement,set:(e,t)=>{e.formatBarElement=t}},metadata:f},b,w),aj(null,e={value:t},n,{kind:"class",name:t.name,metadata:f},null,l),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=aZ}_calculatePlacement(){let e=this.block;this.handleEvent("dragStart",()=>{this._dragging=!0}),this.handleEvent("dragEnd",()=>{this._dragging=!1}),this.disposables.add(this.host.event.add("pointerUp",e=>{let t=null;if("text"===this.displayType||"native"===this.displayType){let e=this.nativeRange;if(!e){this.reset();return}t=e.getBoundingClientRect()}else{if("block"!==this.displayType)return;let e=this._selectedBlocks[0];if(!e)return;t=e.getBoundingClientRect()}let{top:i,bottom:s}=this.host.getBoundingClientRect(),o=e.get("pointerState");s-t.bottom<50?this._placement="top":t.top-Math.max(i,0)<50?this._placement="bottom":o.raw.y{(async()=>{let t=e.selection.find("text"),i=e.selection.filter("block"),s=e.selection.find("cursor");if(s&&(!this._lastCursor||!this._selectionEqual(s,this._lastCursor))){this._lastCursor=s;return}if(await this.host.getUpdateComplete(),t){let i=this.host.view.getBlock(t.blockId);if(!t.isCollapsed()&&i&&"content"===i.model.role){if(this._displayType="text",!e.std.range)return;this.host.std.command.chain().getTextSelection().getSelectedBlocks({types:["text"]}).inline(e=>{let{selectedBlocks:t}=e;t&&(this._selectedBlocks=t)}).run();return}this.reset();return}if(i.length>0){this._displayType="block";let e=i.map(e=>{let t=e.blockId;return this.block.host.view.getBlock(t)}).filter(e=>!!e);this._selectedBlocks=e;return}this.reset()})().catch(console.error)})),this.disposables.addFromEvent(document,"selectionchange",()=>{let e=this.host.selection.find("database");if(!e)return;let t=()=>{this.reset(),this.requestUpdate()},i=e.viewSelection;if("table"===i.type&&("area"!==i.selectionType||!i.isEditing)||"kanban"===i.type&&"cell"!==i.selectionType||!i.isEditing)return t();let s=this.nativeRange;if(!s||s.collapsed)return t();this._displayType="native",this.requestUpdate()})}_listenFloatingElement(){let e=this.formatBarElement;(0,H.Z1)(e,"format quick bar should exist");let t=t=>{let i=t();i&&((0,H.Z1)(this._floatDisposables),U.n9.globalAbortController?.abort(),this._floatDisposables.add((0,sI.ll)(i,e,()=>{let i=t();i&&(0,sI.rD)(i,e,{placement:this._placement,middleware:[(0,sI.cY)(10),(0,sI.mG)(),(0,sI.BN)({padding:6})]}).then(({x:t,y:i})=>{e.style.display="flex",e.style.top=`${i}px`,e.style.left=`${t}px`}).catch(console.error)},{animationFrame:!0})))};switch(this.displayType){case"text":case"native":return t(()=>{let e=this.nativeRange;if(e)return{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects()}});case"block":return t(()=>{let e=this._selectedBlocks[0],t=e?.getBoundingClientRect();if(t)return this._selectedBlocks.forEach(e=>{let i=e.getBoundingClientRect();i.topt.bottom&&(t=new DOMRect(t.left,t.top,t.width,i.bottom)),i.leftt.right&&(t=new DOMRect(t.left,t.top,i.right,t.bottom))}),{getBoundingClientRect:()=>t,getClientRects:()=>this._selectedBlocks.map(e=>e.getBoundingClientRect())}});default:return}}_selectionEqual(e,t){return!!(e===t||e&&t&&e.equals(t))}get _selectionManager(){return this.host.selection}_shouldDisplay(){if(this.doc.awarenessStore.isReadonly(this.doc.blockCollection)||"block"===this.displayType&&this._selectedBlocks?.[0]?.flavour==="affine:surface-ref")return!1;if("block"===this.displayType&&1===this._selectedBlocks.length){let e=this._selectedBlocks[0];if(!(0,tf.o)(e.model,["affine:paragraph","affine:list","affine:code","affine:image"]))return!1}if("none"===this.displayType||this._dragging||"text"===this.displayType&&1===this._selectedBlocks.length&&(()=>{let[e]=this._selectedBlocks,t=e.querySelector("rich-text"),i=t?.inlineEditor;if(!t||!i)return!1;let s=i.getInlineRange();if(!s||s.length>1)return!1;let o=i.getDeltasByInlineRange(s);if(o.length>2)return!1;let r=o?.[1]?.[0];return!!r&&i.isEmbed(r)})())return!1;let e=this.host.doc.root?.id,t=e?this.host.view.getWidget("affine-ai-panel-widget",e):null;return!t||t?.state==="hidden"}addBlockTypeSwitch(e){let{flavour:t,type:i,icon:s}=e;return this.addParagraphAction({id:`${t}/${i??""}`,icon:s,flavour:t,name:e.name??aF(i??t),action:e=>{e.updateBlockType({flavour:t,props:null!=i?{type:i}:void 0}).run()}})}addDivider(){return this.configItems.push({type:"divider"}),this}addHighlighterDropdown(){return this.configItems.push({type:"highlighter-dropdown"}),this}addInlineAction(e){return this.configItems.push({...e,type:"inline-action"}),this}addParagraphAction(e){return this.configItems.push({...e,type:"paragraph-action"}),this}addParagraphDropdown(){return this.configItems.push({type:"paragraph-dropdown"}),this}addRawConfigItems(e,t){return void 0===t?this.configItems.push(...e):this.configItems.splice(t,0,...e),this}addTextStyleToggle(e){let{key:t}=e;return this.addInlineAction({id:t,name:aF(t),icon:e.icon,isActive:e=>{let[i]=e.isTextStyleActive({key:t}).run();return i},action:e.action,showWhen:e=>{let[t]=ax(e).run();return t}})}clearConfig(){return this.configItems=[],this}connectedCallback(){super.connectedCallback(),this._abortController=new AbortController;let e=this.block;if((0,H.Z1)(e),Object.hasOwn(e.widgets,az)){if(!iO(e)){console.error(`format bar not support rootComponent: ${e.constructor.name} but its widgets has format bar`);return}this._calculatePlacement(),0===this.configItems.length&&function(e){e.clearConfig().addParagraphDropdown().addDivider().addTextStyleToggle({key:"bold",action:e=>e.toggleBold().run(),icon:G.$oz}).addTextStyleToggle({key:"italic",action:e=>e.toggleItalic().run(),icon:G.yOR}).addTextStyleToggle({key:"underline",action:e=>e.toggleUnderline().run(),icon:G.qpS}).addTextStyleToggle({key:"strike",action:e=>e.toggleStrike().run(),icon:G.t64}).addTextStyleToggle({key:"code",action:e=>e.toggleCode().run(),icon:G.loI}).addTextStyleToggle({key:"link",action:e=>e.toggleLink().run(),icon:G.qYV}).addDivider().addHighlighterDropdown().addDivider().addInlineAction({id:"convert-to-database",name:"Create Database",icon:G.yni,isActive:()=>!1,action:()=>{(0,sB.p0)({template:(0,L.qy)``})},showWhen:e=>{let t=(e=0)=>(t,i)=>{let{selectedBlocks:s}=t;s&&s.length!==e&&s.every(e=>aA.Z.includes(e.flavour))&&i()},[i]=e.getTextSelection().getSelectedBlocks({types:["text"]}).inline(t(1)).run();return!!i||([i]=e.tryAll(e=>[e.getBlockSelections(),e.getImageSelections()]).getSelectedBlocks({types:["block","image"]}).inline(t(0)).run(),i)}}).addDivider().addInlineAction({id:"convert-to-linked-doc",name:"Create Linked Doc",icon:G.hhn,isActive:()=>!1,action:(e,t)=>{let[i,s]=e.getSelectedModels({types:["block","text"],mode:"highest"}).run(),{selectedModels:o}=s;if((0,H.Z1)(o),!o.length)return;let r=t.host;r.selection.clear();let a=r.doc,n=(0,iV.G6)(o);(0,iV.fG)(r,n).then(e=>{if(null===e)return;let t=(0,iV.B$)(a,o,e);r.spec.getService("affine:embed-linked-doc").slots.linkedDocCreated.emit({docId:t.id}),(0,iV.eD)(r,a),r.spec.getService("affine:page").telemetryService?.track("DocCreated",{control:"create linked doc",page:"doc editor",module:"format toolbar",type:"embed-linked-doc"}),r.spec.getService("affine:page").telemetryService?.track("LinkedDocCreated",{control:"create linked doc",page:"doc editor",module:"format toolbar",type:"embed-linked-doc"})})},showWhen:e=>{let[t,i]=e.getSelectedModels({types:["block","text"],mode:"highest"}).run(),{selectedModels:s}=i;return!!s&&s.length>0}}).addBlockTypeSwitch({flavour:"affine:paragraph",type:"text",name:"Text",icon:G.N$i}).addBlockTypeSwitch({flavour:"affine:paragraph",type:"h1",name:"Heading 1",icon:G.BQZ}).addBlockTypeSwitch({flavour:"affine:paragraph",type:"h2",name:"Heading 2",icon:G.SoJ}).addBlockTypeSwitch({flavour:"affine:paragraph",type:"h3",name:"Heading 3",icon:G.Nrq}).addBlockTypeSwitch({flavour:"affine:paragraph",type:"h4",name:"Heading 4",icon:G.WXD}).addBlockTypeSwitch({flavour:"affine:paragraph",type:"h5",name:"Heading 5",icon:G.TXg}).addBlockTypeSwitch({flavour:"affine:paragraph",type:"h6",name:"Heading 6",icon:G.ma5}).addBlockTypeSwitch({flavour:"affine:list",type:"bulleted",name:"Bulleted List",icon:G.RyS}).addBlockTypeSwitch({flavour:"affine:list",type:"numbered",name:"Numbered List",icon:G.gZg}).addBlockTypeSwitch({flavour:"affine:list",type:"todo",name:"To-do List",icon:G.lOw}).addBlockTypeSwitch({flavour:"affine:code",name:"Code Block",icon:G.loI}).addBlockTypeSwitch({flavour:"affine:paragraph",type:"quote",name:"Quote",icon:G.cyi})}(this)}}disconnectedCallback(){super.disconnectedCallback(),this._abortController.abort(),this.reset(),this._lastCursor=void 0}render(){var e;if(!this._shouldDisplay())return L.s6;let t=(e=this,e.configItems.filter(t=>{if("paragraph-action"===t.type)return!1;if("highlighter-dropdown"===t.type){let[t]=ax(e.std.command.chain()).run();return t}return"inline-action"!==t.type||t.showWhen(e.std.command.chain(),e)}).map(t=>{let i=null;switch(t.type){case"divider":i=an();break;case"highlighter-dropdown":i=aT(e);break;case"paragraph-dropdown":i=aH(e);break;case"inline-action":i=(0,L.qy)` {t.action(e.std.command.chain(),e),e.requestUpdate()}} > ${"function"==typeof t.icon?t.icon():t.icon} `;break;case"custom":i=t.render(e);break;default:i=null}return[i,t]}).filter(([e])=>null!=e).filter(([e,t],i,s)=>"divider"!==t.type||0!==i&&i!==s.length-1&&"divider"!==s[i+1][1].type).map(([e])=>e));return(0,L.qy)` ${t} ${function(e){let t=[[{type:"copy",name:"Copy",icon:G.TdU,disabled:e.doc.readonly,handler:()=>{e.std.command.chain().getSelectedModels().with({onCopy:()=>{(0,U.oR)(e.host,"Copied to clipboard")}}).draftSelectedModels().copySelectedModels().run()}},{type:"duplicate",name:"Duplicate",icon:G.jaP,disabled:e.doc.readonly,handler:()=>{e.std.doc.captureSync(),e.std.command.chain().try(e=>[e.getTextSelection().inline((e,t)=>{let i=e.currentTextSelection;(0,H.Z1)(i),t({currentSelectionPath:(i.to??i.from).blockId})}),e.getBlockSelections().inline((e,t)=>{let i=e.currentBlockSelections;(0,H.Z1)(i);let s=i.at(-1);s&&t({currentSelectionPath:s.blockId})})]).getBlockIndex().getSelectedModels().draftSelectedModels().inline((t,i)=>(t.draftedModels&&t.draftedModels.then(i=>{let s=f.Ji.fromModels(t.std.doc,i);return e.std.clipboard.duplicateSlice(s,t.std.doc,t.parentBlock?.model.id,t.blockIndex?t.blockIndex+1:void 0)}).catch(console.error),i())).run()}}],[{type:"delete",name:"Delete",icon:G.d7y,disabled:e.doc.readonly,handler:()=>{let[t]=e.std.command.chain().getTextSelection().deleteText().run();t||(e.std.command.chain().tryAll(e=>[e.getBlockSelections(),e.getImageSelections()]).getSelectedModels().deleteSelectedModels().run(),e.reset())}}]];return(0,L.qy)` ${G.FHP} `} >
${ad(t)}
`}(this)}
`}reset(){this._displayType="none",this._selectedBlocks=[]}updated(){if(!this._shouldDisplay()){this._floatDisposables&&this._floatDisposables.dispose();return}this._floatDisposables=new eg.K,this._listenFloatingElement()}get displayType(){return this._displayType}get nativeRange(){let e=document.getSelection();return e&&0!==e.rangeCount?e.getRangeAt(0):null}get selectedBlocks(){return this._selectedBlocks}#sN;get _displayType(){return this.#sN}set _displayType(e){this.#sN=e}#sq;get _dragging(){return this.#sq}set _dragging(e){this.#sq=e}#sU;get _selectedBlocks(){return this.#sU}set _selectedBlocks(e){this.#sU=e}#sW;get configItems(){return this.#sW}set configItems(e){this.#sW=e}#sG;get formatBarElement(){return this.#sG}set formatBarElement(e){this.#sG=e}constructor(){super(...arguments),this._abortController=new AbortController,this._floatDisposables=null,this._lastCursor=void 0,this._placement="top",this.#sN=aV(this,d,"none"),this.#sq=(aV(this,h),aV(this,u,!1)),this.#sU=(aV(this,p),aV(this,g,[])),this.#sW=(aV(this,m),aV(this,v,[])),this.#sG=(aV(this,y),aV(this,b,null)),aV(this,w)}static{aV(t,l)}},t})();function aF(e){let t=e.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)}var aN=i(21435);class aq extends v.hJ{constructor(){super(...arguments),this.bound=null}clear(){this.bound=null,this._renderer?.refresh()}highlight(e){let t=p.z.deserialize(e.xywh);this.bound=t,this._renderer?.refresh()}render(e,t){if(!this.bound)return;let{x:i,y:s,w:o,h:r}=this.bound;e.beginPath(),e.strokeStyle="#1E96EB",e.lineWidth=2,e.roundRect(i,s,o,r,8),e.stroke()}}class aU{constructor(e){this._rootService=e,this._disposable=new eg.K}createFrameOnSelected(){let e=this._rootService.frames,t=this._rootService.doc.getBlockByFlavour("affine:surface")[0],i=tS(this._rootService.selection.selectedElements);if((i=i.expand(40)).w<800){let e=(800-i.w)/2;i=i.expand(e,0)}if(i.h<640){let e=(640-i.h)/2;i=i.expand(0,e)}let s=this._rootService.addBlock("affine:frame",{title:new f.rl.Y.Text(`Frame ${e.length+1}`),xywh:i.serialize()},t),o=this._rootService.getElementById(s);return this._rootService.doc.captureSync(),(0,H.Z1)(o),this._rootService.selection.set({elements:[o.id],editing:!1}),this._rootService.getElementById(s)}dispose(){this._disposable.dispose()}getElementsInFrame(e,t=!0){let i=p.z.deserialize(e.xywh);return this._rootService.layer.canvasGrid.search(i,!0).concat(aW(this._rootService.doc,e,t))}selectFrame(e){let t=this._rootService.frames;if(0===t.length)return null;let i=e.filter(e=>(0,tE.X8)(e)),s=tS(e);for(let e=t.length-1;e>=0;e--){let o=t[e];if(!i.includes(o)&&p.z.deserialize(o.xywh).contains(s))return o}return null}}function aW(e,t,i=!0){let s=p.z.deserialize(t.xywh),o=e.getBlockByFlavour(["affine:surface"]);return(function(e,t,i=!0){let s=p.z.deserialize(t.xywh);return e.getBlockByFlavour("affine:note").filter(e=>{let t=p.z.deserialize(e.xywh);return i?s.contains(t):s.isPointInBound([t.x,t.y])})})(e,t,i).concat(o[0].children.filter(e=>{if(e.id!==t.id){if(e instanceof tc.y){let t=p.z.deserialize(e.xywh);return i?s.contains(t):s.containsPoint([t.x,t.y])}return!1}}))}function aG(e){let[t,i,s,o]=(0,h.W)(e.xywh);return{x:t,y:i,w:s,h:o}}let aY={exportFile(e,t){let i=document.createElement("a");i.setAttribute("href",t);let s=function(e){e=function(e,t){let i=" ".replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d"),s=RegExp(`(?:${i}){2,}`,"g");return e.replace(s," ")}(e=e.normalize("NFD").replace(/[<>:"/\\|?*\u0000-\u001F]/g," ").replace(/[\u0000-\u001F\u0080-\u009F]/g," ").replace(/\.+$/,""),0);let t=(e=/^(con|prn|aux|nul|com\d|lpt\d)$/i.test(e)?e+" ":e).lastIndexOf("."),i=e.slice(0,t).trim(),s=e.slice(t);return e=i.slice(0,Math.max(1,50-s.length))+s}(e);i.setAttribute("download",s),i.style.display="none",document.body.append(i),i.click(),i.remove()},exportPng(e,t){let i=e?.trim()||"Untitled";aY.exportFile(i+".png",t)}};class aK{constructor(e,t){this._replaceRichTextWithSvgElement=e=>{Array.from(e.querySelectorAll(".inline-editor")).map(e=>{let t=this._elementToSvgElement(e.cloneNode(!0),e.clientWidth,e.clientHeight+1);e.parentElement?.append(t),e.remove()})},this.replaceImgSrcWithSvg=async e=>{let t=Array.from(e.querySelectorAll("img")).map(e=>(0,ez.aK)(e.src,void 0,this._exportOptions.imageProxyEndpoint).then(e=>e&&e.blob()).then(async t=>{if(t&&"image/svg+xml"===t.type){let i=new DOMParser().parseFromString(await t.text(),"image/svg+xml").documentElement;if(!i.hasAttribute("width")&&!i.hasAttribute("height")){let e=i.viewBox.baseVal;i.setAttribute("width",`${e.width}px`),i.setAttribute("height",`${e.height}px`)}let s=new XMLSerializer().serializeToString(i);e.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(s)}}));await Promise.all(t)},this._exportOptions=t,this._blockService=e}_checkCanContinueToCanvas(e,t){if(location.pathname!==e||(0,O.zU)(this.editorHost)!==t)throw new c.Ss(d.O.EdgelessExportError,"Unable to export content to canvas")}async _checkReady(){let e=location.pathname,t=(0,O.zU)(this.editorHost);return new Promise((i,s)=>{let o=0,r=setInterval(()=>{try{this._checkCanContinueToCanvas(e,t)}catch(e){clearInterval(r),s(e)}let a=this.doc.root,n=this.doc.root?(0,O.DG)(this.editorHost,a):null,l=n?.querySelector("affine-image-block-card"),c=!l||"0"===l.getAttribute("imageState");n&&c&&(clearInterval(r),i(!0)),++o>600&&(clearInterval(r),i(!1))},100)})}_createCanvas(e,t){let i=document.createElement("canvas"),s=window.devicePixelRatio||1,o=i.getContext("2d");return i.width=(e.w+100)*s,i.height=(e.h+100)*s,o.scale(s,s),o.fillStyle=t,o.fillRect(0,0,i.width,i.height),{canvas:i,ctx:o}}_disableMediaPrint(){document.querySelectorAll(".media-print").forEach(e=>{e.classList.add("hide")})}async _docToCanvas(){let e;let t=(await i.e(421).then(i.t.bind(i,72052,19))).default;if(!(t instanceof Function))return;let s=location.pathname,o=(0,O.zU)(this.editorHost),r=(0,O.$n)(this.editorHost);(0,H.Z1)(r);let a=r.viewportElement;(0,H.Z1)(a);let n=a.querySelector(".affine-page-root-block-container"),l=n?.getBoundingClientRect(),{viewport:c}=r;(0,H.Z1)(c);let d=l?.width,h=l?.left??0,u=a?.scrollHeight,p={ignoreElements:function(e){return!!(eh.PT.includes(e.tagName)||e.classList.contains("dg"))||!!(e.classList.contains("close")&&e.parentElement?.classList.contains("meta-data-expanded-title")||e.classList.contains("expand")&&e.parentElement?.classList.contains("meta-data"))},onclone:async(e,t)=>{t.style.height=`${u}px`,this._replaceRichTextWithSvgElement(t),await this.replaceImgSrcWithSvg(t)},backgroundColor:window.getComputedStyle(a).backgroundColor,x:h-c.left,width:d,height:u,useCORS:!this._exportOptions.imageProxyEndpoint,proxy:this._exportOptions.imageProxyEndpoint};try{this._enableMediaPrint(),e=await t(a,p)}finally{this._disableMediaPrint()}return this._checkCanContinueToCanvas(s,o),e}_drawEdgelessBackground(e,{size:t,backgroundColor:i,gridColor:s}){let o=``,r=new Image,a=()=>{r.onload=null,r.onerror=null};return new Promise((t,i)=>{r.onload=()=>{a(),e.drawImage(r,0,0),t()},r.onerror=e=>{a(),i(e)},r.src=`data:image/svg+xml,${encodeURIComponent(o)}`})}_elementToSvgElement(e,t,i){let s="http://www.w3.org/2000/svg",o=document.createElementNS(s,"svg"),r=document.createElementNS(s,"foreignObject");return o.setAttribute("width",`${t}`),o.setAttribute("height",`${i}`),o.setAttribute("viewBox",`0 0 ${t} ${i}`),r.setAttribute("width","100%"),r.setAttribute("height","100%"),r.setAttribute("x","0"),r.setAttribute("y","0"),r.setAttribute("externalResourcesRequired","true"),o.append(r),r.append(e),o}_enableMediaPrint(){document.querySelectorAll(".media-print").forEach(e=>{e.classList.remove("hide")})}async _html2canvas(e,t={}){let s;let o=(await i.e(421).then(i.t.bind(i,72052,19))).default,r={ignoreElements:function(e){return!!(eh.PT.includes(e.tagName)||e.classList.contains("dg"))},onclone:async(e,t)=>{t.style.setProperty("transform","none");let i=t.classList.contains(".affine-edgeless-layer")?t:null;i instanceof HTMLElement&&i.style.setProperty("transform","none"),e.querySelectorAll("[style*='box-shadow']").forEach(function(e){e instanceof HTMLElement&&e.style.setProperty("box-shadow","none")}),this._replaceRichTextWithSvgElement(t),await this.replaceImgSrcWithSvg(t)},useCORS:!this._exportOptions.imageProxyEndpoint,proxy:this._exportOptions.imageProxyEndpoint};try{this._enableMediaPrint(),s=await o(e,Object.assign(r,t))}finally{this._disableMediaPrint()}return s}async _toCanvas(){try{await this._checkReady()}catch(e){console.error("Failed to export to canvas"),console.error(e);return}if((0,O.zU)(this.editorHost))return this._docToCanvas();{let e=this.doc.root;if(!e)return;let t=(0,O.DG)(this.editorHost,e),i=t.getElementsBound();return(0,H.Z1)(i),this.edgelessToCanvas(t.surface.renderer,i,e=>(0,O.Au)(e,this.editorHost.view),t)}}async edgelessToCanvas(e,t,i=()=>null,s,o,r,a){if(!this.doc.root)return;let n=location.pathname,l=(0,O.zU)(this.editorHost),c=(0,O.$n)(this.editorHost);(0,H.Z1)(c);let d=c.viewportElement;(0,H.Z1)(d);let h=window.getComputedStyle(d),u=e=>this._html2canvas(e,{backgroundColor:h.backgroundColor}),f=c.querySelector(".affine-block-children-container");if(!f)return;let{ctx:g,canvas:m}=this._createCanvas(t,window.getComputedStyle(f).backgroundColor);for(let r of(a&&await this._drawEdgelessBackground(g,{backgroundColor:h.getPropertyValue("--affine-background-primary-color"),size:(0,tE.p1)(a.zoom,!0).gap,gridColor:h.getPropertyValue("--affine-edgeless-grid-color")}),o??s?.service.pickElementsByBound(t,"blocks")??[])){if((0,O.op)(r,["affine:image"])){if(!r.sourceId)return;let e=await r.doc.blobSync.get(r.sourceId);if(!e)return;let i=e=>new Promise((t,i)=>{let s=new Image;s.onload=()=>t(s),s.onerror=i,s.src=URL.createObjectURL(e)}),s=aG(r);g.drawImage(await i(e),s.x-t.x,s.y-t.y,s.w,s.h)}let s=i(r)?.parentElement;if((0,O.op)(r,["affine:note"])&&(s=s?.closest(".edgeless-block-portal-note")),s){let e=aG(r),i=await this._html2canvas(s);g.drawImage(i,e.x-t.x+50,e.y-t.y+50,e.w,e.h)}if((0,O.op)(r,["affine:frame"])){let s=aW(this.doc,r,!1),o=p.z.deserialize(r.xywh);for(let e=0;ee instanceof v.$f?e.childElements.filter(e=>e instanceof v.nz):e),s=e.getCanvasByBound(t,i);g.drawImage(s,50,50,t.w,t.h)}return m}async exportPdf(){let e=this.doc.root;if(!e)return;let t=await this._toCanvas();if(!t)return;let s=await Promise.all([i.e(1006),i.e(2394),i.e(8385)]).then(i.bind(i,71442)),o=await s.PDFDocument.create(),r=o.addPage([t.width,t.height]),a=await o.embedPng(t.toDataURL("PNG")),{width:n,height:l}=a.scale(1);r.drawImage(a,{x:0,y:0,width:n,height:l});let c=await o.saveAsBase64({dataUri:!0});aY.exportFile(e.title.toString()+".pdf",c)}async exportPng(){if(!this.doc.root)return;let e=await this._toCanvas();e&&aY.exportPng(this.doc.root.title.toString(),e.toDataURL("image/png"))}get doc(){return this._blockService.std.doc}get editorHost(){return this._blockService.std.host}}function aX(e,t){let i=new s4,s=i.folder("assets");return(0,H.Z1)(e),e.forEach((i,o)=>{t.includes(o)&&s?.file(f.wm(e,o),i)}),i}function aQ(e,t){let i=document.createElement("a");i.setAttribute("download",t);let s=URL.createObjectURL(e);i.setAttribute("href",s),i.style.display="none",document.body.append(i),i.click(),i.remove(),URL.revokeObjectURL(s)}let aJ={exportDoc:async function(e){let t,i;let s=new f._O({collection:e.collection}),o=await s.docToSnapshot(e),r=new eR(s);if(!o)return;let a=await r.fromDocSnapshot({snapshot:o,assets:s.assetsManager}),n=e.meta?.title||"Untitled",l=new Blob([a.file],{type:"plain/text"});if(a.assetsIds.length>0){let e=aX(s.assets,a.assetsIds);e.file("index.html",l),t=await e.generateAsync({type:"blob"}),i=`${n}.zip`}else t=l,i=`${n}.html`;aQ(t,i)}},a1={exportDoc:async function(e){let t,i;let s=new f._O({collection:e.collection}),o=await s.docToSnapshot(e),r=new eN.F(s);if(!o)return;let a=await r.fromDocSnapshot({snapshot:o,assets:s.assetsManager}),n=e.meta?.title||"Untitled",l=new Blob([a.file],{type:"plain/text"});if(a.assetsIds.length>0){let e=aX(s.assets,a.assetsIds);e.file("index.md",l),t=await e.generateAsync({type:"blob"}),i=`${n}.zip`}else t=l,i=`${n}.md`;aQ(t,i)},importMarkdown:async function({doc:e,markdown:t,noteId:i}){let s=new f._O({collection:e.collection,middlewares:[e0]}),o=new eN.F(s),r=await o.toSliceSnapshot({file:t,assets:s.assetsManager,pageVersion:e.collection.meta.pageVersion,workspaceVersion:e.collection.meta.workspaceVersion,workspaceId:e.collection.id,pageId:e.id});for(let t of((0,H.Z1)(r,"import markdown failed, expected to get a snapshot"),r.content.flatMap(e=>e.children)))await s.snapshotToBlock(t,e,i)}},a0={exportDocs:async function(e,t){let i=new s4,s=new f._O({collection:e}),o=await Promise.all(t.map(s.docToSnapshot)),r=s.collectionInfoToSnapshot();i.file("info.json",JSON.stringify(r,null,2)),o.filter(e=>!!e).forEach(e=>{let t=`${e.meta.id}.snapshot.json`;i.file(t,JSON.stringify(e,null,2))});let a=i.folder("assets");(0,H.Z1)(a);let n=s.assets;return n.forEach((e,t)=>{let i=(0,f.wm)(n,t).split(".").at(-1),s=`${t}.${i}`;a.file(s,e)}),i.generateAsync({type:"blob"})},importDocs:async function(e,t){let i,s;let o=new s4,{files:r}=await o.loadAsync(t),a=[],n=[];Object.entries(r).map(([e,t])=>{if(!(e.includes("MACOSX")||e.includes("DS_Store"))){if(e.startsWith("assets/")&&!t.dir){a.push(t);return}if("info.json"===e){i=t;return}if(e.endsWith(".snapshot.json")){n.push(t);return}}});{let e=await i?.async("text");(0,H.Z1)(e),s=JSON.parse(e)}let l=new f._O({collection:e,middlewares:[eK,({slots:e,collection:t})=>{e.afterImport.on(e=>{"page"===e.type&&t.schema.upgradeDoc(s?.pageVersion??0,{},e.page.spaceDoc)})},eQ]}),c=l.assets;return await Promise.all(a.map(async e=>{let t=e.name.replace("assets/",""),i=t.replace(/\.[^/.]+$/,""),s=await e.async("blob"),o=t.split(".").at(-1)??"",r=new File([s],t,{type:f.yf.get(o)??""});c.set(i,r)})),Promise.all(n.map(async e=>{let t=JSON.parse(await e.async("text")),i=[];return l.walk(t,e=>{let t=e.props?.sourceId;if(t&&t.startsWith("/")){let s=t.replace(/^\//,"");if(c.has(s)){let t=c.get(s);i.push(t.arrayBuffer().then(e=>(0,em.h)(e)).then(i=>{c.set(i,t),e.props.sourceId=i}))}}}),await Promise.all(i),l.snapshotToDoc(t)}))}};var a2=i(50620),a5=i(79996),a7=i(67448),a3=i(39099);let a4=a7.z.enum(["None","Arrow","Triangle","Circle","Diamond"]),a6=a7.z.nativeEnum(tI.u1),a8=a7.z.nativeEnum(e$.D9),a9=a7.z.nativeEnum(tI.lH),ne=a7.z.nativeEnum(a3._6),nt=a7.z.nativeEnum(tI.ay),ni=a7.z.nativeEnum(tI.IT),ns=a7.z.nativeEnum(tI.zz),no=a7.z.nativeEnum(tI.nO),nr=a7.z.nativeEnum(tI.f1),na=a7.z.nativeEnum(a3.IO),nn=a7.z.nativeEnum(e$.ko),nl=a7.z.union([a7.z.object({normal:a7.z.string()}),a7.z.object({light:a7.z.string(),dark:a7.z.string()})]),nc=a7.z.union([tA,nl]),nd=a7.z.union([a3.PU,nl]),nh=a7.z.union([a3.qj,nl]),nu=a7.z.union([a7.z.string(),nl]),np=a7.z.union([W.mh,nl]),nf=a7.z.object({connector:a7.z.object({frontEndpointStyle:a4,rearEndpointStyle:a4,strokeStyle:a6,stroke:nc,strokeWidth:a8,rough:a7.z.boolean(),mode:a7.z.number().optional()}),brush:a7.z.object({color:nc,lineWidth:a8}),shape:a7.z.object({shapeType:na,fillColor:nd,strokeColor:nh,shapeStyle:a9,filled:a7.z.boolean(),radius:a7.z.number(),strokeWidth:a7.z.number().optional(),strokeStyle:a6.optional(),color:nu.optional(),fontSize:ne.optional(),fontFamily:nt.optional(),fontWeight:ni.optional(),fontStyle:ns.optional(),textAlign:no.optional(),textHorizontalAlign:no.optional(),textVerticalAlign:nr.optional(),roughness:a7.z.number().optional()}),text:a7.z.object({color:nu,fontFamily:nt,textAlign:no,fontWeight:ni,fontStyle:ns,fontSize:a7.z.number()}),"affine:edgeless-text":a7.z.object({color:nu,fontFamily:nt,textAlign:no,fontWeight:ni,fontStyle:ns}),"affine:note":a7.z.object({background:np,displayMode:nn.optional(),edgeless:a7.z.object({style:a7.z.object({borderRadius:a7.z.number(),borderSize:a7.z.number(),borderStyle:a6,shadowType:W.jJ})})})}),ng=a7.z.object({viewport:a7.z.union([a7.z.object({centerX:a7.z.number(),centerY:a7.z.number(),zoom:a7.z.number()}),a7.z.object({xywh:a7.z.string(),padding:a7.z.tuple([a7.z.number(),a7.z.number(),a7.z.number(),a7.z.number()]).optional()})]),templateCache:a7.z.string(),remoteColor:a7.z.string(),showBidirectional:a7.z.boolean()}),nm=a7.z.object({presentBlackBackground:a7.z.boolean(),presentFillScreen:a7.z.boolean(),presentHideToolbar:a7.z.boolean(),autoHideEmbedHTMLFullScreenToolbar:a7.z.boolean()});function nv(e){return e in ng.shape}class ny{constructor(e){this._service=e,this._disposables=new eg.K,this._lastProps={connector:{frontEndpointStyle:tb.F7,rearEndpointStyle:tb.OM,stroke:tj,strokeStyle:tI.u1.Solid,strokeWidth:e$.D9.Two,rough:!1,mode:tb.B1.Curve},brush:{color:tL(),lineWidth:e$.D9.Four},shape:{color:a3.qV,shapeType:a3.IO.Rect,fillColor:a3.SO,strokeColor:a3.vt,strokeStyle:tI.u1.Solid,strokeWidth:e$.D9.Two,shapeStyle:tI.lH.General,filled:!0,radius:0},text:{color:tD(),fontFamily:tI.ay.Inter,textAlign:tI.nO.Left,fontWeight:tI.IT.Regular,fontStyle:tI.zz.Normal,fontSize:24},"affine:edgeless-text":{color:tD(),fontFamily:tI.ay.Inter,textAlign:tI.nO.Left,fontWeight:tI.IT.Regular,fontStyle:tI.zz.Normal},"affine:note":{background:W.KI,displayMode:e$.ko.DocAndEdgeless,edgeless:{style:{borderRadius:0,borderSize:4,borderStyle:tI.u1.None,shadowType:W.If}}}},this.slots={lastPropsUpdated:new a2.D,storageUpdated:new a2.D};let t=sessionStorage.getItem("blocksuite:prop:record");if(t){let e=nf.safeParse(JSON.parse(t));e.success&&(this._lastProps=e.data)}}_getStorage(e){return nv(e)?sessionStorage:localStorage}_getStorageKey(e){let t=this._service.doc.id;switch(e){case"viewport":return"blocksuite:"+t+":edgelessViewport";case"presentBlackBackground":return"blocksuite:presentation:blackBackground";case"presentFillScreen":return"blocksuite:presentation:fillScreen";case"presentHideToolbar":return"blocksuite:presentation:hideToolbar";case"templateCache":return"blocksuite:"+t+":templateTool";case"remoteColor":return"blocksuite:remote-color";case"showBidirectional":return"blocksuite:"+t+":showBidirectional";case"autoHideEmbedHTMLFullScreenToolbar":return"blocksuite:embedHTML:autoHideFullScreenToolbar";default:return e}}applyLastProps(e,t){nb(e)&&function e(t,i){return Object.keys(i).forEach(s=>{void 0!==i[s]&&(s in t||(t[s]=void 0),void 0===t[s]&&((0,a5.isPlainObject)(i[s])?(t[s]=t[s]??{},e(t[s],i[s])):t[s]=i[s]))}),t}(t,this._lastProps[e])}dispose(){this._disposables.dispose(),this.slots.lastPropsUpdated.dispose()}getLastProps(e){return this._lastProps[e]}getStorage(e){try{let t=this._getStorage(e).getItem(this._getStorageKey(e));if(!t)return null;if(e in nm.shape)return nm.shape[e].parse(JSON.parse(t));if(nv(e))return ng.shape[e].parse(JSON.parse(t));return null}catch{return null}}recordLastProps(e,t){if(!nb(e))return;let i=this._lastProps[e],s=function e(t,i){let s={};return Object.entries(t).forEach(([o,r])=>{if(o in i.shape){if((0,a5.isPlainObject)(r)){if(["background","color","stroke","fill","Color"].some(e=>o.startsWith(e)||o.endsWith(e))&&nl.safeParse(r).success){let e=function(e){let t={};for(let[i,s]of Object.entries(e))t[i]=s.startsWith("#")?s.substring(0,7):s;return t}(r);if(0===Object.keys(e).length)return;s[o]=e;return}s[o]=e(t[o],i.shape[o])}else s[o]=r}}),s}(t,nf.shape[e]);0!==Object.keys(s).length&&((0,a5.merge)(i,s),this.slots.lastPropsUpdated.emit({type:e,props:s}))}setStorage(e,t){let i=this.getStorage(e);this._getStorage(e).setItem(this._getStorageKey(e),JSON.stringify(t)),i!==t&&this.slots.storageUpdated.emit({key:e,value:t})}}function nb(e){return Object.keys(nf.shape).includes(e)}let nw=ij.$M?({font:e,weight:t,url:i,style:s})=>new FontFace(`"${e}"`,`url(${i})`,{weight:t,style:s}):({font:e,weight:t,url:i,style:s})=>new FontFace(e,`url(${i})`,{weight:t,style:s});class nx{constructor(){this.fontFaces=[]}clear(){this.fontFaces.forEach(e=>document.fonts.delete(e)),this.fontFaces.splice(0,this.fontFaces.length)}load(e){this.fontFaces.push(...e.map(e=>{let t=nw(e);return document.fonts.add(t),t.load().catch(console.error),t}))}get ready(){return Promise.all(this.fontFaces.map(e=>e.loaded))}}class n_ extends P.ps{constructor(){super(...arguments),this._embedBlockRegistry=new Set,this._exportOptions={imageProxyEndpoint:eh.$R},this._fileDropOptions={flavour:this.flavour},this._getParentModelBySelection=()=>{let e=this.docModeService.getMode(),t=this.doc.root;if(!t)return{index:void 0,model:null};if("edgeless"===e)return{index:void 0,model:t.children.find(e=>"affine:surface"===e.flavour)??null};if("page"===e){let e,t=this.selectedBlocks[0]?.model;for(t||(t=this._getLastNoteBlock());t&&"affine:note"!==t.flavour;){let i=this.doc.getParent(t.id);e=i?.children.indexOf(t),t=i}return{index:e,model:t}}return{index:void 0,model:null}},this._insertCard=(e,t,i)=>{let s=this.host,o=this.docModeService.getMode(),{model:r,index:a}=this._getParentModelBySelection();if("page"===o){s.doc.addBlock(e,i,r,a);return}if("edgeless"===o){let o=(0,O.$n)(s);if(!o)return;o.service.viewport.smoothZoom(1);let r=o.surface,a=tm.l.toVec(r.renderer.viewport.center),n=o.service.addBlock(e,{...i,xywh:p.z.fromCenter(a,eh.Cd[t],eh.Hn[t]).serialize(),style:t},r.model);o.service.selection.set({elements:[n],editing:!1}),o.tools.setEdgelessTool({type:"default"});return}},this._insertDoc=e=>{let t="affine:embed-linked-doc";return this._insertCard(t,"vertical",{pageId:e}),t},this._insertLink=e=>{let t=this.getEmbedBlockOptions(e),i="affine:bookmark",s="vertical";return t&&(i=t.flavour,s=t.styles[0]),this._insertCard(i,s,{url:e}),i},this.appendParagraph=(e="")=>{let{doc:t}=this;if(!t.root||t.readonly)return;let i=this._getLastNoteBlock()?.id;i||(i=t.addBlock("affine:note",{},t.root.id));let s=t.addBlock("affine:paragraph",{text:new t.Text(e)},i);tp.Km(this.host,s,e.length)?.catch(console.error)},this.docModeService=(0,U.ti)(this.doc.id),this.editPropsStore=new ny(this),this.exportManager=new aK(this,this._exportOptions),this.fileDropManager=new aN.f(this,this._fileDropOptions),this.fontLoader=new nx,this.getEmbedBlockOptions=e=>{for(let[t]of this._embedBlockRegistry.entries())if(t.urlRegex.test(e))return t;return null},this.insertLinkByQuickSearch=async(e,t)=>{if(!this.quickSearchService)return;let i=await this.quickSearchService.searchDoc({action:"insert",userInput:e,skipSelection:t});if(i){if("docId"in i)return this._insertDoc(i.docId),{flavour:"affine:embed-linked-doc",isNewDoc:i.isNewDoc};if("userInput"in i)return this._insertLink(i.userInput),{flavour:"affine:bookmark"}}},this.notificationService=null,this.peekViewService=null,this.quickSearchService=null,this.registerEmbedBlockOptions=e=>{this._embedBlockRegistry.add(e)},this.telemetryService=null,this.themeObserver=j.Q.instance,this.transformers={markdown:a1,html:aJ,zip:a0}}_getLastNoteBlock(){let{doc:e}=this,t=null;if(!e.root)return null;let{children:i}=e.root;for(let e=i.length-1;e>=0;e--){let s=i[e];if((0,tf.o)(s,["affine:note"])&&s.displayMode!==e$.ko.EdgelessOnly){t=s;break}}return t}loadFonts(){this.fontLoader.load(tI.$F)}mounted(){super.mounted(),this.std.command.add("getBlockIndex",Y).add("getNextBlock",K).add("getPrevBlock",X).add("getSelectedBlocks",Q).add("copySelectedModels",J).add("deleteSelectedModels",ee).add("draftSelectedModels",et).add("getSelectedModels",ei).add("getBlockSelections",es).add("getImageSelections",eo).add("getTextSelection",er).add("deleteText",ea).add("formatBlock",ed).add("formatNative",eu).add("formatText",ef).add("peekSelectedBlock",U.tq).add("getSelectedPeekableBlocks",U.Yl),this.loadFonts(),this.disposables.addFromEvent(this.host,"dragover",this.fileDropManager.onDragOver),this.disposables.addFromEvent(this.host,"dragleave",this.fileDropManager.onDragLeave),this.disposables.add(this.std.event.add("pointerDown",e=>{e.get("pointerState").raw.stopPropagation()}))}unmounted(){this.editPropsStore.dispose(),this.fontLoader.clear()}get selectedBlocks(){let e=[];return this.std.command.chain().tryAll(e=>[e.getTextSelection(),e.getImageSelections(),e.getBlockSelections()]).getSelectedBlocks().inline(({selectedBlocks:t})=>{t&&(e=t)}).run(),e}get selectedModels(){return this.selectedBlocks.map(e=>e.model)}get viewportElement(){let e=this.std.view.viewFromPath("block",[this.std.doc.root?.id??""]);(0,H.Z1)(e);let t=e.viewportElement;return(0,H.Z1)(t),t}}class nC extends n_{constructor(){super(...arguments),this.slots={docLinkClicked:new f.DX,tagClicked:new f.DX,viewportUpdated:new f.DX}}}var nk=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},nS=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)(nM)],s=[],o=P.W,r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;nk(this,null,[(0,D.wk)()],{kind:"accessor",name:"_lockViewport",static:!1,private:!1,access:{has:e=>"_lockViewport"in e,get:e=>e._lockViewport,set:(e,t)=>{e._lockViewport=t}},metadata:n},r,a),nk(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` .affine-viewport-overlay-widget { position: absolute; top: 0; left: 0; background: transparent; pointer-events: none; z-index: calc(var(--affine-z-index-popover) - 1); } .affine-viewport-overlay-widget.lock { pointer-events: auto; } `}connectedCallback(){super.connectedCallback(),this.handleEvent("dragStart",()=>this._lockViewport,{global:!0}),this.handleEvent("pointerDown",()=>this._lockViewport,{global:!0}),this.handleEvent("click",()=>this._lockViewport,{global:!0})}lock(){this._lockViewport=!0}render(){let e=(0,sZ.H)({"affine-viewport-overlay-widget":!0,lock:this._lockViewport}),t=(0,Z.W)({width:`${this._lockViewport?"100vw":"0"}`,height:`${this._lockViewport?"100%":"0"}`});return(0,L.qy)`
`}toggleLock(){this._lockViewport=!this._lockViewport}unlock(){this._lockViewport=!1}#sY=nS(this,r,!1);get _lockViewport(){return this.#sY}set _lockViewport(e){this.#sY=e}constructor(){super(...arguments),nS(this,a)}static{nS(t,s)}})})();var nE=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},nI=function(e,t,i){for(var s=arguments.length>2,o=0;o({...t,items:t.items.filter(t=>!t.showWhen||t.showWhen(e.command.chain(),i,e))})).filter(e=>e.items.length>0)}(()=>{let e,t,i=[(0,D.EM)("ai-panel-divider")],s=[],o=(0,P.Tm)(L.WF);(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;nE(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` :host { display: flex; flex-direction: column; align-items: flex-start; align-self: stretch; width: 100%; } .divider { height: 0.5px; background: var(--affine-border-color); width: 100%; } `}render(){return(0,L.qy)`
`}static{nI(t,s)}})})();var n$=i(40495),nT=i(421),nO=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},nP=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("ai-finish-tip")],a=[],n=(0,P.Tm)(L.WF),l=[],c=[],d=[],h=[],u=[],p=[];(class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],nO(this,null,i,{kind:"accessor",name:"copied",static:!1,private:!1,access:{has:e=>"copied"in e,get:e=>e.copied,set:(e,t)=>{e.copied=t}},metadata:f},l,c),nO(this,null,s,{kind:"accessor",name:"copy",static:!1,private:!1,access:{has:e=>"copy"in e,get:e=>e.copy,set:(e,t)=>{e.copy=t}},metadata:f},d,h),nO(this,null,o,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:f},u,p),nO(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` .finish-tip { display: flex; box-sizing: border-box; width: 100%; height: 22px; align-items: center; justify-content: space-between; padding: 0 12px; gap: 4px; color: var(--affine-text-secondary-color); .text { display: flex; align-items: flex-start; flex: 1 0 0; /* light/xs */ font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; /* 166.667% */ } .right { display: flex; align-items: center; .copy, .copied { display: flex; width: 20px; height: 20px; justify-content: center; align-items: center; border-radius: 8px; user-select: none; } .copy:hover { color: var(--affine-icon-color); background: var(--affine-hover-color); cursor: pointer; } .copied { color: var(--affine-brand-color); } } } `}render(){return(0,L.qy)`
${nT.id}
AI outputs can be misleading or wrong
${this.copy?.allowed?(0,L.qy)`
${this.copied?(0,L.qy)`
${n$.Yc}
`:(0,L.qy)`
{if(this.copied=!!await this.copy?.onCopy(),this.copied){let{notificationService:e}=this.host.spec.getService("affine:page");e?.toast("Copied to clipboard")}}} > ${sv.Td} Copy
`}
`:L.s6}
`}#sK=nP(this,l,!1);get copied(){return this.#sK}set copied(e){this.#sK=e}#sX=(nP(this,c),nP(this,d,void 0));get copy(){return this.#sX}set copy(e){this.#sX=e}#n=(nP(this,h),nP(this,u,void 0));get host(){return this.#n}set host(e){this.#n=e}constructor(){super(...arguments),nP(this,p)}static{nP(t,a)}})})();var nH=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},nA=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("ai-panel-answer")],n=[],l=(0,P.Tm)(L.WF),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],nH(this,null,i,{kind:"accessor",name:"config",static:!1,private:!1,access:{has:e=>"config"in e,get:e=>e.config,set:(e,t)=>{e.config=t}},metadata:v},c,d),nH(this,null,s,{kind:"accessor",name:"copy",static:!1,private:!1,access:{has:e=>"copy"in e,get:e=>e.copy,set:(e,t)=>{e.copy=t}},metadata:v},h,u),nH(this,null,o,{kind:"accessor",name:"finish",static:!1,private:!1,access:{has:e=>"finish"in e,get:e=>e.finish,set:(e,t)=>{e.finish=t}},metadata:v},p,f),nH(this,null,r,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:v},g,m),nH(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { width: 100%; display: flex; box-sizing: border-box; flex-direction: column; gap: 8px; padding: 0; } .answer { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; align-self: stretch; font-family: ${(0,L.iz)(iW.$7.fontSansFamily)}; padding: 0 12px; } .answer-head { align-self: stretch; color: var(--affine-text-secondary-color); /* light/xsMedium */ font-size: var(--affine-font-xs); font-style: normal; font-weight: 500; line-height: 20px; /* 166.667% */ height: 20px; } .answer-body { align-self: stretch; color: var(--affine-text-primary-color); font-feature-settings: 'clig' off, 'liga' off; /* light/sm */ font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 22px; /* 157.143% */ } .response-list-container { display: flex; flex-direction: column; gap: 4px; } .response-list-container, .action-list-container { padding: 0 8px; user-select: none; } /* set item style outside ai-item */ .response-list-container ai-item-list, .action-list-container ai-item-list { --item-padding: 4px; } .response-list-container ai-item-list { --item-icon-color: var(--affine-icon-secondary); --item-icon-hover-color: var(--affine-icon-color); } `}render(){let e=nB(this.host,this.config.responses);return(0,L.qy)`
Answer
${this.finish?(0,L.qy)` ${e.length>0?(0,L.qy)` ${e.map((e,t)=>(0,L.qy)` ${0!==t?(0,L.qy)``:L.s6}
`)} `:L.s6} ${e.length>0&&this.config.actions.length>0?(0,L.qy)``:L.s6} ${this.config.actions.length>0?(0,L.qy)`
`:L.s6} `:L.s6} `}#th=nA(this,c,void 0);get config(){return this.#th}set config(e){this.#th=e}#sX=(nA(this,d),nA(this,h,void 0));get copy(){return this.#sX}set copy(e){this.#sX=e}#sQ=(nA(this,u),nA(this,p,!0));get finish(){return this.#sQ}set finish(e){this.#sQ=e}#n=(nA(this,f),nA(this,g,void 0));get host(){return this.#n}set host(e){this.#n=e}constructor(){super(...arguments),nA(this,m)}static{nA(t,n)}})})();var nL=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},nD=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("ai-panel-error")],n=[],l=(0,P.Tm)(L.WF),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],nL(this,null,i,{kind:"accessor",name:"config",static:!1,private:!1,access:{has:e=>"config"in e,get:e=>e.config,set:(e,t)=>{e.config=t}},metadata:v},c,d),nL(this,null,s,{kind:"accessor",name:"copy",static:!1,private:!1,access:{has:e=>"copy"in e,get:e=>e.copy,set:(e,t)=>{e.copy=t}},metadata:v},h,u),nL(this,null,o,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:v},p,f),nL(this,null,r,{kind:"accessor",name:"withAnswer",static:!1,private:!1,access:{has:e=>"withAnswer"in e,get:e=>e.withAnswer,set:(e,t)=>{e.withAnswer=t}},metadata:v},g,m),nL(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { width: 100%; display: flex; flex-direction: column; gap: 8px; padding: 0; font-family: ${(0,L.iz)(iW.$7.fontSansFamily)}; } .error { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; align-self: stretch; padding: 0px 12px; gap: 4px; .answer-tip { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 4px; align-self: stretch; .answer-label { align-self: stretch; color: var(--affine-text-secondary-color); /* light/xsMedium */ font-size: var(--affine-font-xs); font-style: normal; font-weight: 500; line-height: 20px; /* 166.667% */ } } .error-info { align-self: stretch; color: var(--affine-error-color, #eb4335); font-feature-settings: 'clig' off, 'liga' off; /* light/sm */ font-size: var(--affine-font-sm); font-style: normal; font-weight: 400; line-height: 22px; /* 157.143% */ a { color: inherit; } } .action-button-group { display: flex; width: 100%; gap: 16px; align-items: center; justify-content: end; margin-top: 4px; } .action-button { display: flex; box-sizing: border-box; padding: 4px 12px; justify-content: center; align-items: center; gap: 4px; border-radius: 8px; border: 1px solid var(--affine-border-color); background: var(--affine-white); color: var(--affine-text-primary-color); /* light/xsMedium */ font-size: var(--affine-font-xs); font-style: normal; font-weight: 500; line-height: 20px; /* 166.667% */ } .action-button:hover { cursor: pointer; } .action-button.primary { border: 1px solid var(--affine-black-10); background: var(--affine-primary-color); color: var(--affine-pure-white); } .action-button > span { display: flex; align-items: center; justify-content: center; padding: 0 4px; } .action-button:not(.primary):hover { background: var(--affine-hover-color); } } ai-panel-divider { margin-top: 4px; } .response-list-container { display: flex; flex-direction: column; gap: 4px; padding: 0 8px; user-select: none; } .response-list-container ai-item-list { --item-padding: 4px; --item-icon-color: var(--affine-icon-secondary); --item-icon-hover-color: var(--affine-icon-color); } `}render(){let e=this._getResponseGroup(),t=(0,rW.S)(this.config.error?.type,[[U.f.Unauthorized,()=>(0,L.qy)`
You need to login to AFFiNE Cloud to continue using AFFiNE AI.
Cancel
login
`],[U.f.PaymentRequired,()=>(0,L.qy)`
You've reached the current usage cap for AFFiNE AI. You can subscribe to AFFiNE AI to continue the AI experience!
Cancel
Upgrade
`]],()=>{let e=this.config.error?.message,t=e?(0,L.qy)`An error occurred`:"An error occurred";return(0,L.qy)`
${t}. Please try again later. If this issue persists, please let us know at support@toeverything.info
`});return(0,L.qy)`
Answer
${t}
${this.withAnswer?(0,L.qy)``:L.s6} ${e.length>0?(0,L.qy)` ${e.map((e,t)=>(0,L.qy)` ${0!==t?(0,L.qy)``:L.s6}
`)} `:L.s6} `}#th;get config(){return this.#th}set config(e){this.#th=e}#sX;get copy(){return this.#sX}set copy(e){this.#sX=e}#n;get host(){return this.#n}set host(e){this.#n=e}#sJ;get withAnswer(){return this.#sJ}set withAnswer(e){this.#sJ=e}constructor(){super(...arguments),this._getResponseGroup=()=>{let e=[],t=this.config.error?.type;return t&&t!==U.f.GeneralNetworkError?e:e=nB(this.host,this.config.responses)},this.#th=nD(this,c,void 0),this.#sX=(nD(this,d),nD(this,h,void 0)),this.#n=(nD(this,u),nD(this,p,void 0)),this.#sJ=(nD(this,f),nD(this,g,!1)),nD(this,m)}static{nD(t,n)}})})();var nZ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},nj=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("generating-placeholder")],n=[],l=(0,P.Tm)(L.WF),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],nZ(this,null,i,{kind:"accessor",name:"height",static:!1,private:!1,access:{has:e=>"height"in e,get:e=>e.height,set:(e,t)=>{e.height=t}},metadata:v},c,d),nZ(this,null,s,{kind:"accessor",name:"loadingProgress",static:!1,private:!1,access:{has:e=>"loadingProgress"in e,get:e=>e.loadingProgress,set:(e,t)=>{e.loadingProgress=t}},metadata:v},h,u),nZ(this,null,o,{kind:"accessor",name:"showHeader",static:!1,private:!1,access:{has:e=>"showHeader"in e,get:e=>e.showHeader,set:(e,t)=>{e.showHeader=t}},metadata:v},p,f),nZ(this,null,r,{kind:"accessor",name:"stages",static:!1,private:!1,access:{has:e=>"stages"in e,get:e=>e.stages,set:(e,t)=>{e.stages=t}},metadata:v},g,m),nZ(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; margin-bottom: 8px; } .generating-header { width: 100%; font-size: var(--affine-font-xs); font-style: normal; font-weight: 500; line-height: 20px; height: 20px; } .generating-header, .loading-progress { color: var(--affine-text-secondary-color); font-family: ${(0,L.iz)(iW.$7.fontSansFamily)}; } .generating-body { display: flex; flex-direction: column; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; border-radius: 4px; border: 2px solid var(--affine-primary-color, #1e96eb); background: var(--affine-blue-50, #effaff); color: var(--affine-brand-color); gap: 4px; } .generating-icon { display: flex; justify-content: center; align-items: center; height: 24px; } .generating-icon svg { scale: 1.5; } .loading-progress { display: flex; flex-direction: column; font-style: normal; font-weight: 400; text-align: center; gap: 4px; } .loading-text { font-size: var(--affine-font-base); height: 24px; line-height: 24px; } .loading-stage { font-size: var(--affine-font-xs); height: 20px; line-height: 20px; } `}render(){let e=j.Q.mode,t=this.stages[this.loadingProgress-1]||"";return(0,L.qy)` ${this.showHeader?(0,L.qy)`
Answer
`:L.s6}
${"light"===e?sv.ik:sv.i$}
${t}
${this.loadingProgress} / ${this.stages.length}
`}willUpdate(e){e.has("loadingProgress")&&(this.loadingProgress=Math.max(1,Math.min(this.loadingProgress,this.stages.length)))}#iU=nj(this,c,300);get height(){return this.#iU}set height(e){this.#iU=e}#s1=(nj(this,d),nj(this,h,void 0));get loadingProgress(){return this.#s1}set loadingProgress(e){this.#s1=e}#s0=(nj(this,u),nj(this,p,void 0));get showHeader(){return this.#s0}set showHeader(e){this.#s0=e}#s2=(nj(this,f),nj(this,g,void 0));get stages(){return this.#s2}set stages(e){this.#s2=e}constructor(){super(...arguments),nj(this,m)}static{nj(t,n)}})})();var nV=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},nz=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("ai-panel-generating")],n=[],l=(0,P.Tm)(L.WF),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],nV(this,null,i,{kind:"accessor",name:"config",static:!1,private:!1,access:{has:e=>"config"in e,get:e=>e.config,set:(e,t)=>{e.config=t}},metadata:v},c,d),nV(this,null,s,{kind:"accessor",name:"loadingProgress",static:!1,private:!1,access:{has:e=>"loadingProgress"in e,get:e=>e.loadingProgress,set:(e,t)=>{e.loadingProgress=t}},metadata:v},h,u),nV(this,null,o,{kind:"accessor",name:"stopGenerating",static:!1,private:!1,access:{has:e=>"stopGenerating"in e,get:e=>e.stopGenerating,set:(e,t)=>{e.stopGenerating=t}},metadata:v},p,f),nV(this,null,r,{kind:"accessor",name:"withAnswer",static:!1,private:!1,access:{has:e=>"withAnswer"in e,get:e=>e.withAnswer,set:(e,t)=>{e.withAnswer=t}},metadata:v},g,m),nV(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { width: 100%; padding: 0 12px; box-sizing: border-box; font-family: ${(0,L.iz)(iW.$7.fontSansFamily)}; } .generating-tip { display: flex; width: 100%; height: 22px; align-items: center; gap: 8px; color: var(--affine-brand-color); .text { display: flex; align-items: flex-start; gap: 10px; flex: 1 0 0; /* light/smMedium */ font-size: var(--affine-font-sm); font-style: normal; font-weight: 500; line-height: 22px; /* 157.143% */ } .left, .right { display: flex; height: 20px; justify-content: center; align-items: center; } .left { width: 20px; } .right { gap: 6px; } .right:hover { cursor: pointer; } .stop-icon { height: 20px; width: 20px; } .esc-label { font-size: var(--affine-font-xs); font-weight: 500; line-height: 20px; } } `}render(){let{generatingIcon:e=n$.or,stages:t,height:i=300}=this.config;return(0,L.qy)` ${t&&t.length>0?(0,L.qy)``:L.s6}
${e}
AI is generating...
${n$.ON} ESC
`}updateLoadingProgress(e){this.loadingProgress=e}#th=nz(this,c,void 0);get config(){return this.#th}set config(e){this.#th=e}#s1=(nz(this,d),nz(this,h,1));get loadingProgress(){return this.#s1}set loadingProgress(e){this.#s1=e}#s5=(nz(this,u),nz(this,p,void 0));get stopGenerating(){return this.#s5}set stopGenerating(e){this.#s5=e}#sJ=(nz(this,f),nz(this,g,void 0));get withAnswer(){return this.#sJ}set withAnswer(e){this.#sJ=e}constructor(){super(...arguments),nz(this,m)}static{nz(t,n)}})})();var nR=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},nF=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n=[(0,D.EM)("ai-panel-input")],l=[],c=(0,P.Tm)(L.WF),d=[],h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[];(class extends c{static{t=this}static{let w="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.P)(".arrow")],s=[(0,D.wk)()],o=[(0,D.P)("textarea")],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],nR(this,null,i,{kind:"accessor",name:"_arrow",static:!1,private:!1,access:{has:e=>"_arrow"in e,get:e=>e._arrow,set:(e,t)=>{e._arrow=t}},metadata:w},d,h),nR(this,null,s,{kind:"accessor",name:"_hasContent",static:!1,private:!1,access:{has:e=>"_hasContent"in e,get:e=>e._hasContent,set:(e,t)=>{e._hasContent=t}},metadata:w},u,p),nR(this,null,o,{kind:"accessor",name:"_textarea",static:!1,private:!1,access:{has:e=>"_textarea"in e,get:e=>e._textarea,set:(e,t)=>{e._textarea=t}},metadata:w},f,g),nR(this,null,r,{kind:"accessor",name:"onFinish",static:!1,private:!1,access:{has:e=>"onFinish"in e,get:e=>e.onFinish,set:(e,t)=>{e.onFinish=t}},metadata:w},m,v),nR(this,null,a,{kind:"accessor",name:"onInput",static:!1,private:!1,access:{has:e=>"onInput"in e,get:e=>e.onInput,set:(e,t)=>{e.onInput=t}},metadata:w},y,b),nR(null,e={value:t},n,{kind:"class",name:t.name,metadata:w},null,l),t=e.value,w&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:w})}static{this.styles=(0,L.AH)` :host { width: 100%; padding: 0 12px; box-sizing: border-box; } .root { display: flex; align-items: flex-start; gap: 8px; background: var(--affine-background-overlay-panel-color); } .icon { display: flex; align-items: center; } .textarea-container { display: flex; align-items: flex-end; gap: 8px; flex: 1 0 0; textarea { flex: 1 0 0; border: none; outline: none; -webkit-box-shadow: none; -moz-box-shadow: none; box-shadow: none; background-color: transparent; resize: none; overflow: hidden; padding: 0px; color: var(--affine-text-primary-color); /* light/sm */ font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 400; line-height: 22px; /* 157.143% */ } textarea::placeholder { color: var(--affine-placeholder-color); } textarea::-moz-placeholder { color: var(--affine-placeholder-color); } } .arrow { display: flex; align-items: center; padding: 2px; gap: 10px; border-radius: 4px; background: var(--affine-black-10, rgba(0, 0, 0, 0.1)); svg { width: 16px; height: 16px; color: var(--affine-pure-white, #fff); } } .arrow[data-active] { background: var(--affine-brand-color, #1e96eb); } .arrow[data-active]:hover { cursor: pointer; } `}render(){return this.updateComplete.then(()=>{requestAnimationFrame(()=>{this._textarea.focus()})}).catch(console.error),(0,L.qy)`
${n$.O1}
${sv.cE} ${this._hasContent?(0,L.qy)`Send to AI`:L.s6}
`}updated(e){let t=super.updated(e);return this._textarea.style.height=this._textarea.scrollHeight+"px",t}#s7;get _arrow(){return this.#s7}set _arrow(e){this.#s7=e}#s3;get _hasContent(){return this.#s3}set _hasContent(e){this.#s3=e}#s4;get _textarea(){return this.#s4}set _textarea(e){this.#s4=e}#s6;get onFinish(){return this.#s6}set onFinish(e){this.#s6=e}#s8;get onInput(){return this.#s8}set onInput(e){this.#s8=e}constructor(){super(...arguments),this._onInput=()=>{this._textarea.style.height="auto",this._textarea.style.height=this._textarea.scrollHeight+"px",this.onInput?.(this._textarea.value),this._textarea.value.trim().length>0?(this._arrow.dataset.active="",this._hasContent=!0):(delete this._arrow.dataset.active,this._hasContent=!1)},this._onKeyDown=e=>{"Enter"!==e.key||e.shiftKey||e.isComposing||(e.preventDefault(),this._sendToAI())},this._sendToAI=()=>{let e=this._textarea.value.trim();0!==e.length&&(this.onFinish?.(e),this.remove())},this.#s7=nF(this,d,void 0),this.#s3=(nF(this,h),nF(this,u,!1)),this.#s4=(nF(this,p),nF(this,f,void 0)),this.#s6=(nF(this,g),nF(this,m,void 0)),this.#s8=(nF(this,v),nF(this,y,void 0)),nF(this,b)}static{nF(t,l)}})})();var nN=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},nq=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)(nU)],a=[],n=P.W,l=[],c=[],d=[],h=[],u=[],p=[];return class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.P)("ai-panel-generating")],o=[(0,D.MZ)()],nN(this,null,i,{kind:"accessor",name:"config",static:!1,private:!1,access:{has:e=>"config"in e,get:e=>e.config,set:(e,t)=>{e.config=t}},metadata:f},l,c),nN(this,null,s,{kind:"accessor",name:"generatingElement",static:!1,private:!1,access:{has:e=>"generatingElement"in e,get:e=>e.generatingElement,set:(e,t)=>{e.generatingElement=t}},metadata:f},d,h),nN(this,null,o,{kind:"accessor",name:"state",static:!1,private:!1,access:{has:e=>"state"in e,get:e=>e.state,set:(e,t)=>{e.state=t}},metadata:f},u,p),nN(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` :host { display: flex; outline: none; border-radius: var(--8, 8px); border: 1px solid var(--affine-border-color); background: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-overlay-shadow); position: absolute; width: max-content; height: auto; top: 0; left: 0; overflow-y: auto; scrollbar-width: none !important; z-index: var(--affine-z-index-popover); } .ai-panel-container { display: flex; flex-direction: column; box-sizing: border-box; width: 100%; height: fit-content; padding: 8px 0; } .ai-panel-container:not(:has(ai-panel-generating)) { gap: 8px; } .ai-panel-container:has(ai-panel-answer), .ai-panel-container:has(ai-panel-error), .ai-panel-container:has(ai-panel-generating:has(generating-placeholder)) { padding: 12px 0; } :host([data-state='hidden']) { display: none; } `}_autoUpdatePosition(e){{let t=e.querySelector(".affine-block-children-container");t&&t.previousElementSibling&&(e=t.previousElementSibling)}this._stopAutoUpdate?.(),this._stopAutoUpdate=(0,sI.ll)(e,this,()=>{(0,sI.rD)(e,this,this._calcPositionOptions(e)).then(({x:e,y:t})=>{this.style.left=`${e}px`,this.style.top=`${t}px`}).catch(console.error)})}_calcPositionOptions(e){let t;{let e=this.host.std.spec.getService("affine:page");if(e instanceof nC)t=void 0;else{let i=e.viewport;t={x:i.left,y:i.top,width:i.width,height:i.height-100}}}let i={padding:20,rootBoundary:t};return(0,of.NN)(e)?{placement:"bottom-start",middleware:[(0,sI.cY)(8),(0,sI.BN)(i)]}:e.closest("edgeless-block-portal-note")?{middleware:[(0,sI.cY)(8),(0,sI.BN)(i),(0,sI.RK)({...i,allowedPlacements:["top-start","bottom-start"]})]}:{placement:"right-start",middleware:[(0,sI.cY)({mainAxis:16}),(0,sI.UU)({mainAxis:!0,crossAxis:!0,flipAlignment:!0,...i}),(0,sI.BN)({crossAxis:!0,...i})]}}_restoreSelection(){this._selection&&(this.host.selection.set([...this._selection]),"hidden"===this.state&&(this._selection=void 0))}connectedCallback(){super.connectedCallback(),this.tabIndex=-1,this.disposables.addFromEvent(document,"pointerdown",this._onDocumentClick),this.disposables.add(this.block.host.event.add("pointerDown",e=>this._onDocumentClick(e.get("pointerState").event))),this.disposables.add(this.block.host.event.add("click",()=>"hidden"!==this.state)),this.disposables.addFromEvent(this,"wheel",sy.dG),this.disposables.addFromEvent(this,"pointerdown",sy.dG),this.disposables.addFromEvent(this,"pointerup",sy.dG),this.disposables.addFromEvent(this,"keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),this._clearDiscardModal(),this._stopAutoUpdate?.()}render(){if("hidden"===this.state||!this.config)return L.s6;let e=this.config;this.updateComplete.then(()=>{this.focus()}).catch(console.error);let t=(0,rW.S)(this.state,[["input",()=>(0,L.qy)`this.discard()} .onFinish=${this._inputFinish} .onInput=${this.onInput} >`],["generating",()=>(0,L.qy)` ${this.answer?(0,L.qy)` ${this.answer&&e.answerRenderer(this.answer,this.state)} `:L.s6} `],["finished",()=>(0,L.qy)` ${this.answer&&e.answerRenderer(this.answer,this.state)} `],["error",()=>(0,L.qy)` ${this.answer&&e.answerRenderer(this.answer,this.state)} `]]);return(0,L.qy)`
${t}
`}willUpdate(e){let t=e.get("state");if(t){"hidden"===t?(this._selection=this.host.selection.value,requestAnimationFrame(()=>{this.scrollIntoView({block:"center"})})):(this.host.updateComplete.then(()=>{"hidden"!==this.state&&this.focus()}).catch(console.error),this._restoreSelection());let e=this.host.doc.root?.id,i=e?this.host.view.getWidget(az,e):null;i&&i.requestUpdate()}"hidden"!==this.state?this.viewportOverlayWidget?.lock():this.viewportOverlayWidget?.unlock(),this.dataset.state=this.state}get answer(){return this._answer}get inputText(){return this._inputText}get viewportOverlayWidget(){let e=this.host.doc.root?.id;return e?this.host.view.getWidget(nM,e):null}#th;get config(){return this.#th}set config(e){this.#th=e}#s9;get generatingElement(){return this.#s9}set generatingElement(e){this.#s9=e}#oe;get state(){return this.#oe}set state(e){this.#oe=e}constructor(){super(...arguments),this._abortController=new AbortController,this._answer=null,this._cancelCallback=()=>{this.focus()},this._clearDiscardModal=()=>{this._discardModalAbort&&(this._discardModalAbort.abort(),this._discardModalAbort=null)},this._clickOutside=()=>{switch(this.state){case"hidden":return;case"error":case"finished":this._answer?this.discard():this.hide();break;default:this.discard()}},this._discardCallback=()=>{this.hide(),this.config?.discardCallback?.()},this._discardModalAbort=null,this._inputFinish=e=>{this._inputText=e,this.generate()},this._inputText=null,this._onDocumentClick=e=>!("hidden"===this.state||e.target===this||this.contains(e.target))&&(this._clickOutside(),!0),this._onKeyDown=e=>{e.stopPropagation();let{state:t}=this;if("generating"!==t&&"input"!==t)return;let{key:i,isComposing:s}=e;if("Escape"===i){"generating"===t?this.stopGenerating():this.hide();return}if("Delete"===i||"Backspace"===i){if(s)return;"input"!==t||this._inputText||this.hide()}},this._resetAbortController=()=>{"generating"===this.state&&this._abortController.abort(),this._abortController=new AbortController},this.ctx=null,this.discard=()=>{if(("finished"===this.state||"error"===this.state)&&!this.answer){this._discardCallback();return}if("input"===this.state){this.hide();return}this.showDiscardModal().then(e=>{e?this._discardCallback():this._cancelCallback(),this._restoreSelection()}).catch(console.error)},this.generate=()=>{(0,H.Z1)(this.config);let e=this._inputText;(0,H.Z1)(e),(0,H.Z1)(this.config.generateAnswer),this._resetAbortController(),this._answer=null,this.scrollTop=0,this.state="generating",this.config.generateAnswer({input:e,update:e=>{this._answer=e,this.requestUpdate()},finish:(e,t)=>{"aborted"!==e&&((0,H.Z1)(this.config),"error"===e?(this.state="error",this.config.errorStateConfig.error=t):(this.state="finished",this.config.errorStateConfig.error=void 0),this._resetAbortController())},signal:this._abortController.signal})},this.hide=()=>{this._resetAbortController(),this.state="hidden",this._stopAutoUpdate?.(),this._inputText=null,this._answer=null,this._stopAutoUpdate=void 0,this.config?.hideCallback?.(),this.viewportOverlayWidget?.unlock()},this.onInput=e=>{this._inputText=e},this.showDiscardModal=()=>{let e=this.host.std.spec.getService("affine:page").notificationService;return e?(this._clearDiscardModal(),this._discardModalAbort=new AbortController,e.confirm({title:"Discard the AI result",message:"Do you want to discard the results the AI just generated?",cancelText:"Cancel",confirmText:"Discard",abort:this._abortController.signal}).finally(()=>this._discardModalAbort=null)):Promise.resolve(!0)},this.stopGenerating=()=>{this._abortController.abort(),this.state="finished",this.answer||this.hide()},this.toggle=(e,t)=>{t?(this._inputText=t,this.generate()):(this.hide(),this.state="input"),this._autoUpdatePosition(e)},this.#th=nq(this,l,null),this.#s9=(nq(this,c),nq(this,d,null)),this.#oe=(nq(this,h),nq(this,u,"hidden")),nq(this,p)}static{nq(t,a)}},t})();var nG=i(19668);let nY=(0,L.AH)` :host { ${sU}; flex-direction: column; padding: 0; max-height: 100%; pointer-events: auto; overflow: hidden; z-index: var(--affine-z-index-popover); } .affine-filterable-list { display: flex; flex-direction: column; align-items: stretch; justify-content: center; width: 230px; padding: 8px; box-sizing: border-box; overflow: hidden; } .affine-filterable-list.flipped { flex-direction: column-reverse; } .items-container { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: scroll; padding-top: 5px; padding-left: 4px; padding-right: 4px; } editor-toolbar-separator { margin: 8px 0; } .input-wrapper { display: flex; align-items: center; border-radius: 4px; padding: 4px 10px; gap: 4px; border-width: 1px; border-style: solid; border-color: transparent; } .input-wrapper:focus-within { border-color: var(--affine-blue-700); box-shadow: var(--affine-active-shadow); } ${(0,aL.kM)(".items-container")} .filterable-item { display: flex; justify-content: space-between; gap: 4px; padding: 12px; } .filterable-item > div[slot='suffix'] { display: flex; align-items: center; } .filterable-item svg { width: 20px; height: 20px; } .filterable-item.focussed { color: var(--affine-blue-700); background: var(--affine-hover-color-filled); } #filter-input { flex: 1; align-items: center; height: 20px; width: 140px; border-radius: 8px; padding-top: 2px; border: transparent; background: transparent; color: inherit; } #filter-input:focus { outline: none; } #filter-input::placeholder { color: var(--affine-placeholder-color); font-size: var(--affine-font-sm); } `;var nK=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},nX=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d=[(0,D.EM)("affine-filterable-list")],h=[],u=(0,P.Tm)(L.WF),p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[];return class extends u{static{t=this}static{let B="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.P)("#filter-input")],o=[(0,D.wk)()],r=[(0,D.P)(".filterable-item.focussed")],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],c=[(0,D.MZ)({attribute:!1})],nK(this,null,i,{kind:"accessor",name:"_curFocusIndex",static:!1,private:!1,access:{has:e=>"_curFocusIndex"in e,get:e=>e._curFocusIndex,set:(e,t)=>{e._curFocusIndex=t}},metadata:B},p,f),nK(this,null,s,{kind:"accessor",name:"_filterInput",static:!1,private:!1,access:{has:e=>"_filterInput"in e,get:e=>e._filterInput,set:(e,t)=>{e._filterInput=t}},metadata:B},g,m),nK(this,null,o,{kind:"accessor",name:"_filterText",static:!1,private:!1,access:{has:e=>"_filterText"in e,get:e=>e._filterText,set:(e,t)=>{e._filterText=t}},metadata:B},v,y),nK(this,null,r,{kind:"accessor",name:"_focussedItem",static:!1,private:!1,access:{has:e=>"_focussedItem"in e,get:e=>e._focussedItem,set:(e,t)=>{e._focussedItem=t}},metadata:B},b,w),nK(this,null,a,{kind:"accessor",name:"abortController",static:!1,private:!1,access:{has:e=>"abortController"in e,get:e=>e.abortController,set:(e,t)=>{e.abortController=t}},metadata:B},x,_),nK(this,null,n,{kind:"accessor",name:"listFilter",static:!1,private:!1,access:{has:e=>"listFilter"in e,get:e=>e.listFilter,set:(e,t)=>{e.listFilter=t}},metadata:B},C,k),nK(this,null,l,{kind:"accessor",name:"options",static:!1,private:!1,access:{has:e=>"options"in e,get:e=>e.options,set:(e,t)=>{e.options=t}},metadata:B},S,M),nK(this,null,c,{kind:"accessor",name:"placement",static:!1,private:!1,access:{has:e=>"placement"in e,get:e=>e.placement,set:(e,t)=>{e.placement=t}},metadata:B},E,I),nK(null,e={value:t},d,{kind:"class",name:t.name,metadata:B},null,h),t=e.value,B&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:B})}static{this.styles=nY}_buildContent(e){return e.map((e,t)=>{let i=this._curFocusIndex===t;return(0,L.qy)` this._curFocusIndex=t} @click=${()=>this._select(e)} hover=${i} width="100%" height="32px" > ${e.icon??L.s6} ${e.label??e.name}
${this.options.active?.(e)?nG.e:L.s6}
`})}_filterItems(){return(this._filterText?this.options.items.filter(e=>e.name.startsWith(this._filterText.toLowerCase())||e.aliases?.some(e=>e.startsWith(this._filterText.toLowerCase()))):this.options.items).sort((e,t)=>{let i=this.options.active?.(e),s=this.options.active?.(t);return i&&!s?-1/0:!i&&s?1/0:this.listFilter?.(e,t)??1/0})}_scrollFocusedItemIntoView(){this.updateComplete.then(()=>{this._focussedItem?.scrollIntoView({block:"nearest",inline:"start"})}).catch(console.error)}_select(e){this.abortController?.abort(),this.options.onSelect(e)}connectedCallback(){super.connectedCallback(),requestAnimationFrame(()=>{this._filterInput.focus()})}render(){let e=this._filterItems(),t=this._buildContent(e),i=!!this.placement?.startsWith("top");return(0,L.qy)`
${sv.WI}
${t}
`}#ot=nX(this,p,0);get _curFocusIndex(){return this.#ot}set _curFocusIndex(e){this.#ot=e}#oi=(nX(this,f),nX(this,g,void 0));get _filterInput(){return this.#oi}set _filterInput(e){this.#oi=e}#os=(nX(this,m),nX(this,v,""));get _filterText(){return this.#os}set _filterText(e){this.#os=e}#oo=(nX(this,y),nX(this,b,void 0));get _focussedItem(){return this.#oo}set _focussedItem(e){this.#oo=e}#_=(nX(this,w),nX(this,x,null));get abortController(){return this.#_}set abortController(e){this.#_=e}#or=(nX(this,_),nX(this,C,void 0));get listFilter(){return this.#or}set listFilter(e){this.#or=e}#z=(nX(this,k),nX(this,S,void 0));get options(){return this.#z}set options(e){this.#z=e}#ep=(nX(this,M),nX(this,E,void 0));get placement(){return this.#ep}set placement(e){this.#ep=e}constructor(){super(...arguments),nX(this,I)}static{nX(t,h)}},t})();var nJ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},n1=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("language-list-button")],n=[],l=L.WF,c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.P)(".lang-button")],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],nJ(this,null,i,{kind:"accessor",name:"_currentLanguage",static:!1,private:!1,access:{has:e=>"_currentLanguage"in e,get:e=>e._currentLanguage,set:(e,t)=>{e._currentLanguage=t}},metadata:v},c,d),nJ(this,null,s,{kind:"accessor",name:"_langButton",static:!1,private:!1,access:{has:e=>"_langButton"in e,get:e=>e._langButton,set:(e,t)=>{e._langButton=t}},metadata:v},h,u),nJ(this,null,o,{kind:"accessor",name:"blockComponent",static:!1,private:!1,access:{has:e=>"blockComponent"in e,get:e=>e.blockComponent,set:(e,t)=>{e.blockComponent=t}},metadata:v},p,f),nJ(this,null,r,{kind:"accessor",name:"onActiveStatusChange",static:!1,private:!1,access:{has:e=>"onActiveStatusChange"in e,get:e=>e.onActiveStatusChange,set:(e,t)=>{e.onActiveStatusChange=t}},metadata:v},g,m),nJ(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { position: absolute; top: 0; left: 0; z-index: 1; } .lang-button { background-color: var(--affine-background-primary-color); box-shadow: var(--affine-shadow-1); display: flex; gap: 4px; padding: 2px 4px; } .lang-button:hover { background: var(--affine-hover-color-filled); } .lang-button[hover] { background: var(--affine-hover-color-filled); } `}_updateLanguage(){this._currentLanguage=eM(this.blockComponent.model.language)??V.XR}connectedCallback(){super.connectedCallback(),this._updateLanguage()}render(){return(0,th.qy)` ${this.blockComponent.doc.readonly?L.s6:sv.ZL} `}#oa;get _currentLanguage(){return this.#oa}set _currentLanguage(e){this.#oa=e}#on;get _langButton(){return this.#on}set _langButton(e){this.#on=e}#ol;get blockComponent(){return this.#ol}set blockComponent(e){this.#ol=e}#oc;get onActiveStatusChange(){return this.#oc}set onActiveStatusChange(e){this.#oc=e}constructor(){super(...arguments),this._clickLangBtn=()=>{if(!this.blockComponent.doc.readonly){if(this._abortController){this._abortController.abort();return}this._abortController=new AbortController,this._abortController.signal.addEventListener("abort",()=>{this.onActiveStatusChange(!1),this._abortController=void 0}),this.onActiveStatusChange(!0),function({options:e,filter:t,abortController:i=new AbortController,referenceElement:s,container:o,maxHeight:r=440,portalStyles:a}){let n={top:eh.Et+12,bottom:12},l=new nQ;l.options=e,l.listFilter=t,l.abortController=i,(0,sB.cl)({closeOnClickAway:!0,template:({positionSlot:e})=>(e.on(({placement:e})=>{l.placement=e}),l),container:o,portalStyles:a,computePosition:{referenceElement:s,placement:"bottom-start",middleware:[(0,sI.cY)(4),(0,sI.RK)({allowedPlacements:["top-start","bottom-start"],padding:n}),(0,sI.Ej)({padding:n,apply({availableHeight:e,elements:t,placement:i}){Object.assign(t.floating.style,{height:"100%",maxHeight:`${Math.min(r,e)}px`,pointerEvents:"none",...i.startsWith("top")?{display:"flex",alignItems:"flex-end"}:{display:null,alignItems:null}})}})],autoUpdate:{animationFrame:!0}},abortController:i})}({options:{placeholder:"Search for a language",onSelect:e=>{this.blockComponent.setLang(e.name),this._updateLanguage()},active:e=>e.name===this._currentLanguage.id,items:[...ex.WL,V.XR].map(e=>({label:e.name,name:e.id,aliases:e.aliases}))},filter:(e,t)=>(ek[e.name]??1/0)-(ek[t.name]??1/0),referenceElement:this._langButton,container:this.blockComponent.host,abortController:this._abortController,portalStyles:{zIndex:"var(--affine-z-index-popover)"}})}},this.#oa=n1(this,c,V.XR),this.#on=(n1(this,d),n1(this,h,void 0)),this.#ol=(n1(this,u),n1(this,p,void 0)),this.#oc=(n1(this,f),n1(this,g,td.lQ)),n1(this,m)}static{n1(t,n)}})})();var n0=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},n2=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-code-language-list-widget")],s=[],o=P.W;(class extends o{static{t=this}constructor(){super(...arguments),this._hoverController=new U.n9(this,()=>this._shouldDisplay.value?{template:(0,L.qy)`{this._isActivated=e,!e&&!this._hoverController.isHovering&&(await (0,td.yy)(1e3),this._hoverController.isHovering||this._isActivated||this._hoverController.abort())}} > `,portalStyles:{zIndex:"var(--affine-z-index-popover)"},container:this.block,computePosition:{referenceElement:this.block,placement:"left-start",middleware:[(0,sI.cY)({mainAxis:-5,crossAxis:5})],autoUpdate:!0}}:null,{allowMultiple:!0}),this._isActivated=!1,this._shouldDisplay=(0,q.EW)(()=>{let e=this.host.selection,t=e.find("text");if(t&&(t.to||t.from.length))return!1;let i=e.filter("block");return!(i.length>1)&&(1!==i.length||i[0].blockId===this.block.blockId)})}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;n0(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),n2(t,s)}connectedCallback(){super.connectedCallback(),this._hoverController.setReference(this.block),this._hoverController.onAbort=()=>{this._isActivated||this._hoverController.abort()}}})})();var n5=i(76238);let n7=e=>{let t=e.keys,i=t.map(t=>e[t]),{text:s,...o}=Object.fromEntries(t.map((e,t)=>[e,i[t]])),r={flavour:e.flavour,text:e.text.clone(),...o};return e.doc.addSiblingBlocks(e,[r])[0]};var n3=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},n4=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("affine-code-toolbar")],c=[],d=(0,P.Tm)(L.WF),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];(class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.P)(".code-toolbar-button.more")],s=[(0,D.wk)()],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],n3(this,null,i,{kind:"accessor",name:"_moreButton",static:!1,private:!1,access:{has:e=>"_moreButton"in e,get:e=>e._moreButton,set:(e,t)=>{e._moreButton=t}},metadata:C},h,u),n3(this,null,s,{kind:"accessor",name:"_moreMenuOpen",static:!1,private:!1,access:{has:e=>"_moreMenuOpen"in e,get:e=>e._moreMenuOpen,set:(e,t)=>{e._moreMenuOpen=t}},metadata:C},p,f),n3(this,null,o,{kind:"accessor",name:"blockComponent",static:!1,private:!1,access:{has:e=>"blockComponent"in e,get:e=>e.blockComponent,set:(e,t)=>{e.blockComponent=t}},metadata:C},g,m),n3(this,null,r,{kind:"accessor",name:"items",static:!1,private:!1,access:{has:e=>"items"in e,get:e=>e.items,set:(e,t)=>{e.items=t}},metadata:C},v,y),n3(this,null,a,{kind:"accessor",name:"moreItems",static:!1,private:!1,access:{has:e=>"moreItems"in e,get:e=>e.moreItems,set:(e,t)=>{e.moreItems=t}},metadata:C},b,w),n3(this,null,n,{kind:"accessor",name:"onActiveStatusChange",static:!1,private:!1,access:{has:e=>"onActiveStatusChange"in e,get:e=>e.onActiveStatusChange,set:(e,t)=>{e.onActiveStatusChange=t}},metadata:C},x,_),n3(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}static{this.styles=(0,L.AH)` :host { position: absolute; top: 0; right: 0; } .code-toolbar-container { height: 24px; gap: 4px; padding: 4px; margin: 0; } .code-toolbar-button { color: var(--affine-icon-color); background-color: var(--affine-background-primary-color); box-shadow: var(--affine-shadow-1); border-radius: 4px; } `}_toggleMoreMenu(){var e,t;if(this._currentOpenMenu&&!this._currentOpenMenu.signal.aborted&&this._currentOpenMenu===this._popMenuAbortController){this.closeCurrentMenu(),this._moreMenuOpen=!1;return}this.closeCurrentMenu(),this._popMenuAbortController=new AbortController,this._popMenuAbortController.signal.addEventListener("abort",()=>{this._moreMenuOpen=!1,this.onActiveStatusChange(!1)}),this.onActiveStatusChange(!0),this._currentOpenMenu=this._popMenuAbortController,(0,H.Z1)(this._moreButton),(0,U.cl)({template:(0,L.qy)`
${(e=this.blockComponent,t=this._popMenuAbortController,this.moreItems.filter(t=>"divider"===t.type||t.showWhen(e)).map(i=>{let s=null;switch(i.type){case"more":{let o=i.name instanceof Function?i.name(e):i.name,r=i.icon instanceof Function?i.icon(e):i.icon,a=`menu-item ${o.toLocaleLowerCase().split(" ").join("-")}`;s=(0,L.qy)` {s.stopPropagation(),i.action(e,t)}} > ${r} ${o} `;break}case"divider":s=(0,L.qy)` `;break;default:s=null}return s}).filter(e=>null!==e).map(e=>e))}
`,portalStyles:{zIndex:"var(--affine-z-index-popover)"},container:this.blockComponent.host,computePosition:{referenceElement:this._moreButton,placement:"bottom-start",middleware:[(0,sI.UU)(),(0,sI.cY)(4)],autoUpdate:{animationFrame:!0}},abortController:this._popMenuAbortController,closeOnClickAway:!0}),this._moreMenuOpen=!0}disconnectedCallback(){super.disconnectedCallback(),this.closeCurrentMenu()}render(){var e,t,i;let s=(e=this.items,t=this.blockComponent,i=this.closeCurrentMenu,e.filter(e=>e.showWhen(t)).map(e=>{switch(e.type){case"action":return(0,L.qy)` e.action(t,i)} > ${e.icon} `;case"custom":return e.render(t,i);default:return null}}).filter(e=>null!==e));return(0,L.qy)` ${s} this._toggleMoreMenu()} > ${sm.FH} `}#od;get _moreButton(){return this.#od}set _moreButton(e){this.#od=e}#oh;get _moreMenuOpen(){return this.#oh}set _moreMenuOpen(e){this.#oh=e}#ol;get blockComponent(){return this.#ol}set blockComponent(e){this.#ol=e}#t4;get items(){return this.#t4}set items(e){this.#t4=e}#ou;get moreItems(){return this.#ou}set moreItems(e){this.#ou=e}#oc;get onActiveStatusChange(){return this.#oc}set onActiveStatusChange(e){this.#oc=e}constructor(){super(...arguments),this._currentOpenMenu=null,this._popMenuAbortController=null,this.closeCurrentMenu=()=>{this._currentOpenMenu&&!this._currentOpenMenu.signal.aborted&&(this._currentOpenMenu.abort(),this._currentOpenMenu=null)},this.#od=n4(this,h,void 0),this.#oh=(n4(this,u),n4(this,p,!1)),this.#ol=(n4(this,f),n4(this,g,void 0)),this.#t4=(n4(this,m),n4(this,v,void 0)),this.#ou=(n4(this,y),n4(this,b,void 0)),this.#oc=(n4(this,w),n4(this,x,td.lQ)),n4(this,_)}static{n4(t,c)}})})();let n6=[{type:"action",name:"copy-code",icon:sv.Td,tooltip:"Copy Code",showWhen:()=>!0,action:(e,t)=>{e.copyCode(),t?.()}},{type:"action",name:"caption",icon:sv.IT,tooltip:"Caption",showWhen:e=>!e.doc.readonly,action:(e,t)=>{e.captionEditor?.show(),t?.()}}],n8=[{type:"more",name:e=>e.model.wrap?"Cancel Wrap":"Wrap",tooltip:"",icon:e=>e.model.wrap?sv.E:sv.w$,showWhen:()=>!0,action:(e,t)=>{e.setWrap(!e.model.wrap),t.abort()}},{type:"more",name:"Duplicate",tooltip:"",icon:sv.j,showWhen:()=>!0,action:(e,t)=>{let i=n7(e.model),s=e.host;s.updateComplete.then(()=>{if(s.selection.setGroup("note",[s.selection.create("block",{blockId:i})]),(0,of.zU)(s)){let e=s.view.getBlock(i);e&&e.scrollIntoView({block:"nearest"})}}).catch(console.error),t.abort()}},{type:"divider"},{type:"more",name:"Delete",tooltip:"",icon:sv.d7,showWhen:()=>!0,action:(e,t)=>{e.doc.deleteBlock(e.model),t.abort()}}];var n9=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},le=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-code-toolbar-widget")],s=[],o=P.W;(class extends o{static{t=this}constructor(){super(...arguments),this._hoverController=null,this._isActivated=!1,this._setHoverController=()=>{this._hoverController=null,this._hoverController=new n5.n(this,({abortController:e})=>{let t=this.block,i=this.host.selection,s=i.find("text");if(s&&(s.to||s.from.length))return null;let o=i.filter("block");return o.length>1||1===o.length&&o[0].blockId!==t.blockId?null:{template:(0,L.qy)`{this._isActivated=e,e||this._hoverController?.isHovering||this._hoverController?.abort()}} >`,container:this.block,portalStyles:{zIndex:"var(--affine-z-index-popover)"},computePosition:{referenceElement:t,placement:"right-start",middleware:[(0,sI.BN)({crossAxis:!0,padding:{top:eh.Et+12,bottom:12,right:12},limiter:(0,sI.ER)()})],autoUpdate:!0}}},{allowMultiple:!0});let e=this.block;this._hoverController.setReference(e),this._hoverController.onAbort=()=>{this._isActivated||this._hoverController?.abort()}},this.items=[],this.moreItems=[]}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;n9(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),le(t,s)}addItems(e,t){return void 0===t?this.items.push(...e):this.items.splice(t,0,...e),this}addMoreItems(e,t){return void 0===t?this.moreItems.push(...e):this.moreItems.splice(t,0,...e),this}clearConfig(){return this.items=[],this.moreItems=[],this}firstUpdated(){this.items.length&&this.moreItems.length||this.setupDefaultConfig(),this._setHoverController()}setupDefaultConfig(){return this.clearConfig().addItems(n6).addMoreItems(n8),this}})})(),i(87419);var lt=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},li=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n=[(0,D.EM)("edgeless-copilot-panel")],l=[],c=(0,P.Tm)(L.WF),d=[],h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[];return class extends c{static{t=this}static{let w="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],lt(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:w},d,h),lt(this,null,s,{kind:"accessor",name:"entry",static:!1,private:!1,access:{has:e=>"entry"in e,get:e=>e.entry,set:(e,t)=>{e.entry=t}},metadata:w},u,p),lt(this,null,o,{kind:"accessor",name:"groups",static:!1,private:!1,access:{has:e=>"groups"in e,get:e=>e.groups,set:(e,t)=>{e.groups=t}},metadata:w},f,g),lt(this,null,r,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:w},m,v),lt(this,null,a,{kind:"accessor",name:"onClick",static:!1,private:!1,access:{has:e=>"onClick"in e,get:e=>e.onClick,set:(e,t)=>{e.onClick=t}},metadata:w},y,b),lt(null,e={value:t},n,{kind:"class",name:t.name,metadata:w},null,l),t=e.value,w&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:w})}static{this.styles=(0,L.AH)` :host { display: flex; position: absolute; } .edgeless-copilot-panel { box-sizing: border-box; padding: 8px 4px 8px 8px; min-width: 330px; max-height: 374px; overflow-y: auto; background: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-shadow-2); border-radius: 8px; z-index: var(--affine-z-index-popover); } ${(0,aL.kM)(".edgeless-copilot-panel")} .edgeless-copilot-panel:hover::-webkit-scrollbar-thumb { background-color: var(--affine-black-30); } `}_getChain(){return this.edgeless.service.std.command.chain()}connectedCallback(){super.connectedCallback(),this._disposables.add((0,sy.on)(this,"wheel",sy.dG)),this._disposables.add((0,sy.on)(this,"pointerdown",sy.dG))}hide(){this.remove()}render(){let e=this._getChain(),t=this.groups.reduce((t,i)=>{let s=i.items.filter(t=>t.showWhen?.(e,"edgeless",this.host));return s.length>0&&t.push({...i,items:s}),t},[]);return t.every(e=>0===e.items.length)?L.s6:(0,L.qy)`
{this.onClick?.()}} .host=${this.host} .groups=${t} >
`}#i_=li(this,d,void 0);get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#op=(li(this,h),li(this,u,void 0));get entry(){return this.#op}set entry(e){this.#op=e}#M=(li(this,p),li(this,f,void 0));get groups(){return this.#M}set groups(e){this.#M=e}#n=(li(this,g),li(this,m,void 0));get host(){return this.#n}set host(e){this.#n=e}#k=(li(this,v),li(this,y,void 0));get onClick(){return this.#k}set onClick(e){this.#k=e}constructor(){super(...arguments),li(this,b)}static{li(t,l)}},t})();var lo=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},lr=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)(la)],a=[],n=P.W,l=[],c=[],d=[],h=[],u=[],f=[];return class extends n{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.P)(".copilot-selection-rect")],lo(this,null,i,{kind:"accessor",name:"_selectionRect",static:!1,private:!1,access:{has:e=>"_selectionRect"in e,get:e=>e._selectionRect,set:(e,t)=>{e._selectionRect=t}},metadata:p},l,c),lo(this,null,s,{kind:"accessor",name:"_visible",static:!1,private:!1,access:{has:e=>"_visible"in e,get:e=>e._visible,set:(e,t)=>{e._visible=t}},metadata:p},d,h),lo(this,null,o,{kind:"accessor",name:"selectionElem",static:!1,private:!1,access:{has:e=>"selectionElem"in e,get:e=>e.selectionElem,set:(e,t)=>{e.selectionElem=t}},metadata:p},u,f),lo(null,e={value:t},r,{kind:"class",name:t.name,metadata:p},null,a),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=(0,L.AH)` .copilot-selection-rect { position: absolute; box-sizing: border-box; border-radius: 4px; border: 2px dashed var(--affine-brand-color, #1e96eb); } `}_showCopilotPanel(){(0,sy.Ak)(()=>{if(!this._copilotPanel){let e=new ls;e.host=this.host,e.groups=this.groups,e.edgeless=this.edgeless,this.renderRoot.append(e),this._copilotPanel=e}let e=this.selectionElem,t=this._copilotPanel,i=this.edgeless.service.viewport;e&&e.isConnected&&(0,sI.ll)(e,t,()=>{(0,sI.rD)(e,t,{placement:"right-start",middleware:[(0,sI.cY)({mainAxis:16}),(0,sI.UU)({mainAxis:!0,crossAxis:!0,flipAlignment:!0}),(0,sI.BN)(()=>{let{left:e,top:t,width:s,height:o}=i;return{padding:20,crossAxis:!0,rootBoundary:{x:e,y:t,width:s,height:o-100}}}),(0,sI.Ej)({apply:({elements:e})=>{let{height:t}=i;e.floating.style.maxHeight=`${t-140}px`}})]}).then(({x:e,y:i})=>{t.style.left=`${e}px`,t.style.top=`${i}px`}).catch(e=>{console.warn("Can't compute EdgelessCopilotPanel position",e)})})},this)}_updateSelection(e){this._selectionModelRect=e;let t=this.edgeless.service.viewport.zoom,[i,s]=this.edgeless.service.viewport.toViewCoord(e.left,e.top),[o,r]=[e.width*t,e.height*t];this._selectionRect={x:i,y:s,width:o,height:r}}_watchClickOutside(){this._clickOutsideOff?.();let{width:e,height:t}=this._selectionRect;e&&t&&(this._listenClickOutsideId&&cancelAnimationFrame(this._listenClickOutsideId),this._listenClickOutsideId=(0,sy.Ak)(()=>{if(!this.isConnected)return;let e=this.block.dispatcher.add("pointerDown",t=>{let i=t.get("pointerState").raw,s=this.host.view.getWidget(nU,this.doc.root.id);i.button!==sy.fh.MAIN||this.contains(i.target)||s&&"hidden"!==s.state||(e(),this._visible=!1,this.hideCopilotPanel())});this._listenClickOutsideId=null,this._clickOutsideOff=e},this))}connectedCallback(){super.connectedCallback();let e=this.edgeless.tools.controllers.copilot;this._disposables.add(e.draggingAreaUpdated.on(t=>{this._visible=!0,this._updateSelection(e.area),t?(this._showCopilotPanel(),this._watchClickOutside()):this.hideCopilotPanel()})),this._disposables.add(this.edgeless.service.viewport.viewportUpdated.on(()=>{this._visible&&this._updateSelection(e.area)})),this._disposables.add(this.edgeless.slots.edgelessToolUpdated.on(({type:e})=>{this._visible&&"copilot"!==e&&(this._visible=!1,this._clickOutsideOff=null,this._copilotPanel?.remove(),this._copilotPanel=null)}))}determineInsertionBounds(e=800,t=95){let i=this.edgeless.service.selection.selectedElements,s=20/this.edgeless.service.viewport.zoom,o=new p.z(0,0,e,t);if(i.length){let{x:e,y:t,h:r}=(0,v.qZ)(i.map(e=>e.elementBound));o.x=e,o.y=t+r+s}else{let{x:e,y:t,height:i}=this.selectionModelRect;o.x=e,o.y=t+i+s}return o}hideCopilotPanel(){this._copilotPanel?.hide(),this._copilotPanel=null,this._clickOutsideOff=null}lockToolbar(e){this.edgeless.slots.toolbarLocked.emit(e)}render(){if(!this._visible)return L.s6;let e=this._selectionRect;return(0,L.qy)`
`}get edgeless(){return this.block}get selectionModelRect(){return this._selectionModelRect}get selectionRect(){return this._selectionRect}get visible(){return!!(this._visible&&this._selectionRect.width&&this._selectionRect.height)}set visible(e){this._visible=e}#of;get _selectionRect(){return this.#of}set _selectionRect(e){this.#of=e}#og;get _visible(){return this.#og}set _visible(e){this.#og=e}#om;get selectionElem(){return this.#om}set selectionElem(e){this.#om=e}constructor(){super(...arguments),this._clickOutsideOff=null,this._listenClickOutsideId=null,this.groups=[],this.#of=lr(this,l,{x:0,y:0,width:0,height:0}),this.#og=(lr(this,c),lr(this,d,!1)),this.#om=(lr(this,h),lr(this,u,void 0)),lr(this,f)}static{lr(t,a)}},t})();var ll=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},lc=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("edgeless-copilot-toolbar-entry")],a=[],n=(0,P.Tm)(L.WF),l=[],c=[],d=[],h=[],u=[],p=[];return class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],ll(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:f},l,c),ll(this,null,s,{kind:"accessor",name:"groups",static:!1,private:!1,access:{has:e=>"groups"in e,get:e=>e.groups,set:(e,t)=>{e.groups=t}},metadata:f},d,h),ll(this,null,o,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:f},u,p),ll(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` .copilot-icon-button { line-height: 20px; .label.medium { color: var(--affine-brand-color); } } `}_showCopilotPanel(){let e=this.edgeless.service.selection.selectedElements,t=new Set(e);e.forEach(e=>{(0,tE.X8)(e)?this.edgeless.service.frame.getElementsInFrame(e).forEach(e=>t.add(e)):e instanceof ty.$b&&e.descendants().forEach(e=>t.add(e))}),this.edgeless.service.tool.setEdgelessTool({type:"copilot"}),this.edgeless.tools.controllers.copilot.updateSelectionWith(Array.from(t),10)}render(){return(0,L.qy)` ${n$.O1} Ask AI `}#i_=lc(this,l,void 0);get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#M=(lc(this,c),lc(this,d,void 0));get groups(){return this.#M}set groups(e){this.#M=e}#n=(lc(this,h),lc(this,u,void 0));get host(){return this.#n}set host(e){this.#n=e}constructor(){super(...arguments),lc(this,p)}static{lc(t,a)}},t})();var lh=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},lu=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-add-frame-button")],s=[],o=(0,P.Tm)(L.WF),r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;lh(this,null,[(0,D.MZ)({attribute:!1})],{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:n},r,a),lh(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` .label { padding-left: 4px; } `}render(){return(0,L.qy)` ${G.H0W}Frame `}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}constructor(){super(...arguments),this._createFrame=()=>{let e=this.edgeless.service.frame.createFrameOnSelected();e&&(this.edgeless.service.telemetryService?.track("CanvasElementAdded",{control:"context-menu",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"frame"}),this.edgeless.surface.fitToViewport(p.z.deserialize(e.xywh)))},this.#i_=lu(this,r,void 0),lu(this,a)}static{lu(t,s)}})})();var lp=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},lf=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-add-group-button")],s=[],o=(0,P.Tm)(L.WF),r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;lp(this,null,[(0,D.MZ)({attribute:!1})],{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:n},r,a),lp(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` .label { padding-left: 4px; } `}render(){return(0,L.qy)` ${G.nFg}Group `}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}constructor(){super(...arguments),this._createGroup=()=>{this.edgeless.service.createGroupFromSelected()},this.#i_=lf(this,r,void 0),lf(this,a)}static{lf(t,s)}})})();var lg=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},lm=function(e,t,i){for(var s=arguments.length>2,o=0;o`},{name:a.Top,content:G.mib},{name:a.Vertically,content:G.gaN},{name:a.Bottom,content:G.uYI},{name:a.DistributeVertically,content:G.HH6}];(()=>{let e,t,i=[(0,D.EM)("edgeless-align-button")],s=[],o=(0,P.Tm)(L.WF),r=[],n=[];(class extends o{static{t=this}static{let a="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;lg(this,null,[(0,D.MZ)({attribute:!1})],{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:a},r,n),lg(null,e={value:t},i,{kind:"class",name:t.name,metadata:a},null,s),t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a}),lm(t,s)}_align(e){switch(e){case a.Left:this._alignLeft();break;case a.Horizontally:this._alignHorizontally();break;case a.Right:this._alignRight();break;case a.DistributeHorizontally:this._alignDistributeHorizontally();break;case a.Top:this._alignTop();break;case a.Vertically:this._alignVertically();break;case a.Bottom:this._alignBottom();break;case a.DistributeVertically:this._alignDistributeVertically()}}_alignBottom(){let{elements:e}=this,t=e.map(e=>e.elementBound),i=Math.max(...t.map(e=>e.maxY));e.forEach((e,s)=>{let o=t[s],r=p.z.deserialize(e.xywh),a=r.maxY-o.maxY;r.y=i-r.h+a,this._updateXYWH(e,r)})}_alignDistributeHorizontally(){let{elements:e}=this;e.sort((e,t)=>e.elementBound.minX-t.elementBound.minX);let t=e.map(e=>e.elementBound),i=t[0].minX,s=(t[t.length-1].maxX-i-e.reduce((e,t)=>e+t.elementBound.w,0))/(e.length-1),o=t[0].maxX+s;for(let i=1;ie.elementBound.minY-t.elementBound.minY);let t=e.map(e=>e.elementBound),i=t[0].minY,s=(t[t.length-1].maxY-i-e.reduce((e,t)=>e+t.elementBound.h,0))/(e.length-1),o=t[0].maxY+s;for(let i=1;ie.elementBound),i=(Math.min(...t.map(e=>e.minX))+Math.max(...t.map(e=>e.maxX)))/2;e.forEach(e=>{let t=p.z.deserialize(e.xywh);t.x=i-t.w/2,this._updateXYWH(e,t)})}_alignLeft(){let{elements:e}=this,t=e.map(e=>e.elementBound),i=Math.min(...t.map(e=>e.minX));e.forEach((e,s)=>{let o=t[s],r=p.z.deserialize(e.xywh),a=r.minX-o.minX;r.x=i+a,this._updateXYWH(e,r)})}_alignRight(){let{elements:e}=this,t=e.map(e=>e.elementBound),i=Math.max(...t.map(e=>e.maxX));e.forEach((e,s)=>{let o=t[s],r=p.z.deserialize(e.xywh),a=r.maxX-o.maxX;r.x=i-r.w+a,this._updateXYWH(e,r)})}_alignTop(){let{elements:e}=this,t=e.map(e=>e.elementBound),i=Math.min(...t.map(e=>e.minY));e.forEach((e,s)=>{let o=t[s],r=p.z.deserialize(e.xywh),a=r.minY-o.minY;r.y=i+a,this._updateXYWH(e,r)})}_alignVertically(){let{elements:e}=this,t=e.map(e=>e.elementBound),i=(Math.min(...t.map(e=>e.minY))+Math.max(...t.map(e=>e.maxY)))/2;e.forEach(e=>{let t=p.z.deserialize(e.xywh);t.y=i-t.h/2,this._updateXYWH(e,t)})}_updateXYWH(e,t){if(e instanceof v.lw)e.moveTo(t);else if(e instanceof v.$f){let i=p.z.deserialize(e.xywh);e.childElements.forEach(e=>{let s=p.z.deserialize(e.xywh);s.x+=t.x-i.x,s.y+=t.y-i.y,this._updateXYWH(e,s)})}else this.edgeless.service.updateElement(e.id,{xywh:t.serialize()})}get elements(){return this.edgeless.service.selection.selectedElements}firstUpdated(){this._disposables.add(this.edgeless.service.selection.slots.updated.on(()=>this.requestUpdate()))}render(){return(0,L.qy)` ${G.SBc}${G.eoI} `} >
${(0,t$.u)(lv,(e,t)=>e.name+t,({name:e,content:t})=>"separator"===e?t:(0,L.qy)` this._align(e)} > ${t} `)}
`}#i_=lm(this,r,void 0);get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}constructor(){super(...arguments),lm(this,n)}})})();var ly=i(49077),lb=i(7489);function lw(e,t,i){let s=e.doc,o=s.getParent(e);(0,H.Z1)(o);let r={text:e?.text?.clone(),children:e.children,...i},a=o.children.indexOf(e),n=s.addBlock(t,r,o,a);return s.deleteBlock(e,{deleteChildren:!1}),n}let lx=[{name:"image",check:e=>e.doc.schema.flavourSchemaMap.has("affine:image")&&e.type.startsWith("image/"),action:e=>(function(e){if(!e.doc.schema.flavourSchemaMap.has("affine:image")){console.error("The image flavour is not supported!");return}let t=e.sourceId;if(!t)return;let{saveAttachmentData:i,getImageData:s}=(0,lb.YF)();i(t,{name:e.name});let o=e.sourceId?s(e.sourceId):void 0,r={sourceId:t,caption:e.caption,size:e.size,...o};lw(e,"affine:image",r)})(e)},{name:"pdf",check:(e,t)=>"application/pdf"===e.type&&e.size<=t,template:(e,t)=>(0,L.qy)``},{name:"video",check:(e,t)=>e.type.startsWith("video/")&&e.size<=t,template:(e,t)=>(0,L.qy)``},{name:"audio",check:(e,t)=>e.type.startsWith("audio/")&&e.size<=t,template:(e,t)=>(0,L.qy)``}];function l_(e,t=10485760){return lx.some(i=>i.check(e,t))}let lC=new Set;async function lk(e,t,i){let s;if(lC.has(t))return;let o=e.doc;try{lC.add(t),s=await o.blobSync.set(i)}catch(t){console.error(t),t instanceof Error&&(0,e5.o)(e,`Failed to upload attachment! ${t.message||t.toString()}`)}finally{lC.delete(t);let e=o.getBlockById(t);o.withoutTransact(()=>{e&&o.updateBlock(e,{sourceId:s})})}}async function lS(e){let t=e.sourceId;if(!t)return null;let i=e.doc,s=await i.blobSync.get(t);return s&&(s=new Blob([s],{type:e.type})),s}async function lM(e){let t=e.model,{id:i,sourceId:s}=t;if(lC.has(i)){e.loading=!0,e.error=!1,e.allowEmbed=!1,e.blobUrl&&(URL.revokeObjectURL(e.blobUrl),e.blobUrl=void 0);return}try{if(!s)return;let i=await lS(t);if(!i)return;e.loading=!1,e.error=!1,e.allowEmbed=l_(t,e.service.maxFileSize),e.blobUrl&&URL.revokeObjectURL(e.blobUrl),e.blobUrl=URL.createObjectURL(i)}catch(i){console.warn(i,t,s),e.loading=!1,e.error=!0,e.allowEmbed=!1,e.blobUrl&&(URL.revokeObjectURL(e.blobUrl),e.blobUrl=void 0)}}function lE(e){let{host:t,model:i,loading:s,error:o,downloading:r,blobUrl:a}=e;if(r){(0,e5.o)(t,"Download in progress...");return}if(s){(0,e5.o)(t,"Please wait, file is loading...");return}let n=i.name,l=n.length<20?n:n.slice(0,20)+"...";if(o||!a){(0,e5.o)(t,`Failed to download ${l}!`);return}e.downloading=!0,(0,e5.o)(t,`Downloading ${l}`);let c=document.createElement("a"),d=new MouseEvent("click");c.download=n,c.href=a,c.dispatchEvent(d),c.remove(),e.downloading=!1}async function lI(e){if(e.type)return e.type;let t=await e.arrayBuffer(),s=await Promise.resolve().then(i.bind(i,81208)),o=await s.fileTypeFromBuffer(t);return o?o.mime:""}async function lB(e,t,i,s,o="after"){if(!t.length)return;if(t.some(e=>e.size>i)){(0,e5.o)(e,`You can only upload files less than ${(0,tv.bn)(i,!0,0)}`);return}let r=s.doc,a=await Promise.all(t.map(e=>lI(e))),n=t.map((e,t)=>({flavour:"affine:attachment",name:e.name,size:e.size,type:a[t]})),l=r.addSiblingBlocks(s,n,o);return l.map((i,s)=>void lk(e,i,t[s])),l}var l$=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},lT=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("card-style-panel")],a=[],n=(0,P.Tm)(L.WF),l=[],c=[],d=[],h=[],u=[],p=[];(class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],l$(this,null,i,{kind:"accessor",name:"onSelect",static:!1,private:!1,access:{has:e=>"onSelect"in e,get:e=>e.onSelect,set:(e,t)=>{e.onSelect=t}},metadata:f},l,c),l$(this,null,s,{kind:"accessor",name:"options",static:!1,private:!1,access:{has:e=>"options"in e,get:e=>e.options,set:(e,t)=>{e.options=t}},metadata:f},d,h),l$(this,null,o,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:f},u,p),l$(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` :host { display: flex; align-items: center; justify-content: center; gap: 8px; } icon-button { padding: var(--1, 0px); justify-content: center; } icon-button.selected { border: 1px solid var(--affine-brand-color); } `}render(){let e=this.options;return e?.length?(0,t$.u)(e,e=>e.style,({style:e,Icon:t,tooltip:i})=>(0,L.qy)` {this.onSelect(e),this.value=e}} > ${t} ${i} `):L.s6}#ov=lT(this,l,void 0);get onSelect(){return this.#ov}set onSelect(e){this.#ov=e}#z=(lT(this,c),lT(this,d,void 0));get options(){return this.#z}set options(e){this.#z=e}#eJ=(lT(this,h),lT(this,u,void 0));get value(){return this.#eJ}set value(e){this.#eJ=e}constructor(){super(...arguments),lT(this,p)}static{lT(t,a)}})})();var lO=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},lP=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("edgeless-change-attachment-button")],r=[],a=(0,P.Tm)(L.WF),n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],lO(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:h},n,l),lO(this,null,s,{kind:"accessor",name:"model",static:!1,private:!1,access:{has:e=>"model"in e,get:e=>e.model,set:(e,t)=>{e.model=t}},metadata:h},c,d),lO(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h}),lP(t,r)}get _block(){let e=this.edgeless.service.selection.surfaceSelections.filter(e=>e.elements.includes(this.model.id));if(1!==e.length)return;let t=this.std.view.getBlock(e[0].blockId);return(0,H.Z1)(t),t}get _doc(){return this.model.doc}get _getCardStyleOptions(){let{EmbedCardListIcon:e,EmbedCardCubeIcon:t}=(0,oT.Yr)();return[{style:"horizontalThin",Icon:e,tooltip:"Horizontal style"},{style:"cubeThick",Icon:t,tooltip:"Vertical style"}]}render(){return(0,L.qy)` ${sv.v1} `} > ${sv.s3} ${sv.IT} `}get std(){return this.edgeless.std}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#iJ;get model(){return this.#iJ}set model(e){this.#iJ=e}constructor(){super(...arguments),this._download=()=>{this._block&&lE(this._block)},this._setCardStyle=e=>{let t=p.z.deserialize(this.model.xywh);t.w=eh.Cd[e],t.h=eh.Hn[e];let i=t.serialize();this.model.doc.updateBlock(this.model,{style:e,xywh:i})},this._showCaption=()=>{this._block?.captionEditor?.show()},this.#i_=lP(this,n,void 0),this.#iJ=(lP(this,l),lP(this,c,void 0)),lP(this,d)}})})();var lH=i(94423);let lA=[[{r:1,g:0,b:0},0],[{r:1,g:1,b:0},1/6],[{r:0,g:1,b:0},2/6],[{r:0,g:1,b:1},.5],[{r:0,g:0,b:1},4/6],[{r:1,g:0,b:1},5/6],[{r:1,g:0,b:0},1]],lL=lA[0][0],lD={hex3:/^#?([0-9a-fA-F]{3})$/,hex6:/^#?([0-9a-fA-F]{6})$/,other:/[^0-9a-fA-F]/},lZ=()=>({...lR(lL),a:1}),lj=(e,t,i)=>e+i*(t-e),lV=(e,t,i)=>Math.min(Math.max(e,t),i),lz=(e,t)=>1e-6>Math.abs((e=lV(0,e,t))-t)?1:e%t/t,lR=({r:e,g:t,b:i})=>{let s=Math.max(e,t,i),o=s-Math.min(e,t,i);return 0===o?{h:0,s:0,v:s}:{h:(s===e?(t-i)/o+(t{e<0&&(e=(e+1)%1),e*=6,t=lV(0,t,1);let s=Math.floor(e),o=e-s,r=i*(1-t),a=i*(1-o*t),n=i*(1-(1-o)*t),l=s%6,c=[0,0,0];0===l?c=[i,n,r]:1===l?c=[a,i,r]:2===l?c=[r,i,n]:3===l?c=[r,a,i]:4===l?c=[n,r,i]:5===l&&(c=[i,r,a]);let[d,h,u]=c;return{r:d,g:h,b:u}},lN=e=>({...lR(e),a:e.a}),lq=e=>({...lF(e),a:e.a}),lU=({r:e,g:t,b:i})=>[e,t,i].map(e=>255*e).map(Math.round).map(e=>e.toString(16).padStart(2,"0")).join(""),lW=({r:e,g:t,b:i,a:s})=>{let o=[e,t,i,s].map(e=>255*e).map(Math.round).map(e=>e.toString(16).padStart(2,"0")).join("");return`#${o}`},lG=e=>lW(lq(e)),lY=e=>{e.startsWith("#")&&(e=e.substring(1));let t=e.length,i=[];3===t||4===t?i=e.split("").map(e=>e.repeat(2)):(6===t||8===t)&&(i=Array.from({length:t/2}).fill(0).map((e,t)=>e+2*t).map(t=>e.substring(t,t+2)));let[s,o,r,a=1]=i.map(e=>parseInt(e,16)).map(e=>lz(e,255));return{r:s,g:o,b:r,a}},lK=e=>lN(lY(e)),lX=(e,t)=>e.h===t.h&&e.s===t.s&&e.v===t.v,lQ=(e,t)=>{let{width:i,height:s}=e,o=e.getContext("2d");o.globalCompositeOperation="color",o.clearRect(0,0,i,s);let r=o.createLinearGradient(0,0,0,s);r.addColorStop(0,"#0000"),r.addColorStop(1,"#000"),o.fillStyle=r,o.fillRect(0,0,i,s);let a=o.createLinearGradient(0,0,i,0);a.addColorStop(0,"#fff"),a.addColorStop(1,`#${lU(t)}`),o.fillStyle=a,o.fillRect(0,0,i,s)},lJ=e=>e.length>7&&!e.endsWith("transparent")?e.substring(0,7):e,l1=e=>{if((e=e.trim()).endsWith("transparent"))return{r:1,g:1,b:1,a:0};if(e.startsWith("#"))return lY(e);if(e.startsWith("rgb")){let[t,i,s,o=1]=e.replace(/^rgba?/,"").replace(/\(|\)/,"").split(",").map(e=>parseFloat(e.trim())).map((e,t)=>lz(e,3===t?1:255));return{r:t,g:i,b:s,a:o}}return{r:0,g:0,b:0,a:1}},l0=e=>({type:t,value:i})=>(i.startsWith("--")&&(i=i.endsWith("transparent")?"transparent":e.getPropertyValue(i)),{type:t,rgba:l1(i)}),l2=(e,t)=>({[e]:t.palette??t}),l5=(e,t,i)=>{let s=[{type:"normal",value:t},{type:"light",value:t},{type:"dark",value:t}],o="palette";return"object"==typeof i&&(o=e in i?e:"normal",s[0].value=i.normal??t,s[1].value=i.light??t,s[2].value=i.dark??t),{type:o,colors:s}};var l7=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},l3=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d=[(0,D.EM)("edgeless-line-width-panel")],h=[],u=(0,P.Tm)(L.WF),p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[];(class extends u{static{t=this}static{let B="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;i=[(0,D.P)(".bottom-line")],s=[(0,D.P)(".drag-handle")],o=[(0,D.YG)(".line-width-icon")],r=[(0,D.P)(".line-width-overlay")],a=[(0,D.P)(".line-width-panel")],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],c=[(0,D.MZ)({attribute:!1})],l7(this,null,i,{kind:"accessor",name:"_bottomLine",static:!1,private:!1,access:{has:e=>"_bottomLine"in e,get:e=>e._bottomLine,set:(e,t)=>{e._bottomLine=t}},metadata:B},p,f),l7(this,null,s,{kind:"accessor",name:"_dragHandle",static:!1,private:!1,access:{has:e=>"_dragHandle"in e,get:e=>e._dragHandle,set:(e,t)=>{e._dragHandle=t}},metadata:B},g,m),l7(this,null,o,{kind:"accessor",name:"_lineWidthIcons",static:!1,private:!1,access:{has:e=>"_lineWidthIcons"in e,get:e=>e._lineWidthIcons,set:(e,t)=>{e._lineWidthIcons=t}},metadata:B},v,y),l7(this,null,r,{kind:"accessor",name:"_lineWidthOverlay",static:!1,private:!1,access:{has:e=>"_lineWidthOverlay"in e,get:e=>e._lineWidthOverlay,set:(e,t)=>{e._lineWidthOverlay=t}},metadata:B},b,w),l7(this,null,a,{kind:"accessor",name:"_lineWidthPanel",static:!1,private:!1,access:{has:e=>"_lineWidthPanel"in e,get:e=>e._lineWidthPanel,set:(e,t)=>{e._lineWidthPanel=t}},metadata:B},x,_),l7(this,null,n,{kind:"accessor",name:"disable",static:!1,private:!1,access:{has:e=>"disable"in e,get:e=>e.disable,set:(e,t)=>{e.disable=t}},metadata:B},C,k),l7(this,null,l,{kind:"accessor",name:"hasTooltip",static:!1,private:!1,access:{has:e=>"hasTooltip"in e,get:e=>e.hasTooltip,set:(e,t)=>{e.hasTooltip=t}},metadata:B},S,M),l7(this,null,c,{kind:"accessor",name:"selectedSize",static:!1,private:!1,access:{has:e=>"selectedSize"in e,get:e=>e.selectedSize,set:(e,t)=>{e.selectedSize=t}},metadata:B},E,I),l7(null,e={value:t},d,{kind:"class",name:t.name,metadata:B},null,h),t=e.value,B&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:B})}static{this.styles=(0,L.AH)` :host { display: flex; align-items: center; justify-content: center; align-self: stretch; } .line-width-panel { width: 108px; height: 24px; display: flex; flex-direction: row; align-items: center; justify-content: space-between; position: relative; cursor: default; } .line-width-button { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; z-index: 2; } .line-width-icon { width: 4px; height: 4px; border-radius: 50%; background-color: var(--affine-border-color); } .line-width-button:nth-child(1) { margin-right: 0; } .line-width-button:nth-child(6) { margin-left: 0; } .drag-handle { position: absolute; left: 0; top: 50%; width: 8px; height: 8px; transform: translateY(-50%) translateX(4px); border-radius: 50%; background-color: var(--affine-icon-color); z-index: 3; } .bottom-line, .line-width-overlay { left: 8px; top: 50%; transform: translateY(-50%); height: 1px; background-color: var(--affine-border-color); position: absolute; } .bottom-line { width: calc(100% - 16px); background-color: var(--affine-border-color); } .line-width-overlay { width: 0; background-color: var(--affine-icon-color); z-index: 1; } `}_onSelect(e){e!==this.selectedSize&&(this.dispatchEvent(new l4("select",{detail:e,composed:!0,bubbles:!0})),this.selectedSize=e)}_updateLineWidthPanel(e){if(!this._lineWidthOverlay)return;let t=0,i=0;switch(e){case e$.D9.Two:t=0;break;case e$.D9.Four:t=16,i=1;break;case e$.D9.Six:t=32,i=2;break;case e$.D9.Eight:t=48,i=3;break;case e$.D9.Ten:t=64,i=4;break;default:t=80,i=4}i+=4,this._lineWidthOverlay.style.width=`${t}%`,this._dragHandle.style.left=`${t}%`,this._dragHandle.style.transform=`translateY(-50%) translateX(${i}px)`,this._updateIconsColor()}_updateLineWidthPanelByDragHandlePosition(e){let t=this.selectedSize;t=e<=12?e$.D9.Two:e>12&&e<=26?e$.D9.Four:e>26&&e<=40?e$.D9.Six:e>40&&e<=54?e$.D9.Eight:e>54&&e<=68?e$.D9.Ten:e$.D9.Twelve,this._updateLineWidthPanel(t),this._onSelect(t)}disconnectedCallback(){this._disposables.dispose()}firstUpdated(){this._updateLineWidthPanel(this.selectedSize),this._disposables.addFromEvent(this,"pointerdown",this._onPointerDown),this._disposables.addFromEvent(this,"pointermove",this._onPointerMove),this._disposables.addFromEvent(this,"pointerup",this._onPointerUp),this._disposables.addFromEvent(this,"pointerout",this._onPointerOut)}render(){return(0,L.qy)`
${this.hasTooltip?(0,L.qy)`Thickness`:L.s6}
`}willUpdate(e){e.has("selectedSize")&&this._updateLineWidthPanel(this.selectedSize)}#oy;get _bottomLine(){return this.#oy}set _bottomLine(e){this.#oy=e}#ob;get _dragHandle(){return this.#ob}set _dragHandle(e){this.#ob=e}#ow;get _lineWidthIcons(){return this.#ow}set _lineWidthIcons(e){this.#ow=e}#ox;get _lineWidthOverlay(){return this.#ox}set _lineWidthOverlay(e){this.#ox=e}#o_;get _lineWidthPanel(){return this.#o_}set _lineWidthPanel(e){this.#o_=e}#oC;get disable(){return this.#oC}set disable(e){this.#oC=e}#ok;get hasTooltip(){return this.#ok}set hasTooltip(e){this.#ok=e}#oS;get selectedSize(){return this.#oS}set selectedSize(e){this.#oS=e}constructor(){super(...arguments),this._dragConfig=null,this._getDragHandlePosition=(e,t)=>{let i=e.clientX,{boundLeft:s,bottomLineWidth:o,stepWidth:r,containerWidth:a}=t;return(o-4)/100*(i<=s?0:i-s>=a?100:Math.floor((i-s)/r))},this._onPointerDown=e=>{if(e.preventDefault(),this.disable)return;let{left:t,width:i}=this._lineWidthPanel.getBoundingClientRect(),s=this._bottomLine.getBoundingClientRect().width;this._dragConfig={stepWidth:i/100,boundLeft:t,containerWidth:i,bottomLineWidth:s},this._onPointerMove(e)},this._onPointerMove=e=>{if(e.preventDefault(),!this._dragConfig)return;let t=this._getDragHandlePosition(e,this._dragConfig);this._dragHandle.style.left=`${t}%`,this._lineWidthOverlay.style.width=`${t}%`,this._updateIconsColor()},this._onPointerOut=e=>{if(e.preventDefault(),!this._dragConfig)return;let t=this._getDragHandlePosition(e,this._dragConfig);this._updateLineWidthPanelByDragHandlePosition(t),this._dragConfig=null},this._onPointerUp=e=>{if(e.preventDefault(),!this._dragConfig)return;let t=this._getDragHandlePosition(e,this._dragConfig);this._updateLineWidthPanelByDragHandlePosition(t),this._dragConfig=null},this._updateIconsColor=()=>{if(!this._dragHandle.offsetParent){(0,sy.Ak)(()=>this._updateIconsColor(),this);return}let e=this._dragHandle.getBoundingClientRect(),t=e.left+e.width/2,i=[],s=[];for(let e of this._lineWidthIcons){let{left:o,width:r}=e.getBoundingClientRect();o+r/2e.style.backgroundColor="var(--affine-icon-color)"),s.forEach(e=>e.style.backgroundColor="var(--affine-border-color)")},this.#oy=l3(this,p,void 0),this.#ob=(l3(this,f),l3(this,g,void 0)),this.#ow=(l3(this,m),l3(this,v,void 0)),this.#ox=(l3(this,y),l3(this,b,void 0)),this.#o_=(l3(this,w),l3(this,x,void 0)),this.#oC=(l3(this,_),l3(this,C,!1)),this.#ok=(l3(this,k),l3(this,S,!0)),this.#oS=(l3(this,M),l3(this,E,e$.D9.Two)),l3(this,I)}static{l3(t,h)}})})();var l6=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},l8=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n=[(0,D.EM)("edgeless-change-brush-button")],l=[],c=(0,P.Tm)(L.WF),d=[],h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[];(class extends c{static{t=this}static{let w="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.P)("edgeless-color-picker-button.color")],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],l6(this,null,i,{kind:"accessor",name:"_selectedColor",static:!1,private:!1,access:{has:e=>"_selectedColor"in e,get:e=>e._selectedColor,set:(e,t)=>{e._selectedColor=t}},metadata:w},d,h),l6(this,null,s,{kind:"accessor",name:"_selectedSize",static:!1,private:!1,access:{has:e=>"_selectedSize"in e,get:e=>e._selectedSize,set:(e,t)=>{e._selectedSize=t}},metadata:w},u,p),l6(this,null,o,{kind:"accessor",name:"colorButton",static:!1,private:!1,access:{has:e=>"colorButton"in e,get:e=>e.colorButton,set:(e,t)=>{e.colorButton=t}},metadata:w},f,g),l6(this,null,r,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:w},m,v),l6(this,null,a,{kind:"accessor",name:"elements",static:!1,private:!1,access:{has:e=>"elements"in e,get:e=>e.elements,set:(e,t)=>{e.elements=t}},metadata:w},y,b),l6(null,e={value:t},n,{kind:"class",name:t.name,metadata:w},null,l),t=e.value,w&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:w}),l8(t,l)}_setBrushProp(e,t){this.doc.captureSync(),this.elements.filter(i=>i[e]!==t).forEach(i=>this.service.updateElement(i.id,{[e]:t}))}render(){let e=this.edgeless.surface.renderer.getColorScheme(),t=this.elements,{selectedSize:i,selectedColor:s}=this;return(0,L.qy)` ${(0,lH.z)(this.edgeless.doc.awarenessStore.getFlag("enable_color_picker"),()=>{let{type:i,colors:o}=l5(e,s,t[0].color);return(0,L.qy)` `},()=>(0,L.qy)` `} > `)} `}get doc(){return this.edgeless.doc}get selectedColor(){let e=this.edgeless.surface.renderer.getColorScheme();return this._selectedColor??function(e,t){let i=(0,sk.Tr)(e,e=>"object"==typeof e.color?e.color[t]??e.color.normal??null:e.color),s=(0,sk.Sk)(Object.entries(i),([e,t])=>t);return s?s[0]:tL()}(this.elements,e)}get selectedSize(){return this._selectedSize??function(e){let t=(0,sk.Tr)(e,e=>e.lineWidth),i=(0,sk.Sk)(Object.entries(t),([e,t])=>t);return i?Number(i[0]):e$.D9.Four}(this.elements)}get service(){return this.surface.edgeless.service}get surface(){return this.edgeless.surface}#oM;get _selectedColor(){return this.#oM}set _selectedColor(e){this.#oM=e}#oE;get _selectedSize(){return this.#oE}set _selectedSize(e){this.#oE=e}#oI;get colorButton(){return this.#oI}set colorButton(e){this.#oI=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#oB;get elements(){return this.#oB}set elements(e){this.#oB=e}constructor(){super(...arguments),this._setBrushColor=({detail:e})=>{this._setBrushProp("color",e),this._selectedColor=e},this._setLineWidth=({detail:e})=>{this._setBrushProp("lineWidth",e),this._selectedSize=e},this.pickColor=e=>{if("pick"===e.type){this.elements.forEach(t=>this.service.updateElement(t.id,l2("color",{...e.detail})));return}this.elements.forEach(t=>t["start"===e.type?"stash":"pop"]("color"))},this.#oM=l8(this,d,null),this.#oE=(l8(this,h),l8(this,u,null)),this.#oI=(l8(this,p),l8(this,f,void 0)),this.#i_=(l8(this,g),l8(this,m,void 0)),this.#oB=(l8(this,v),l8(this,y,[])),l8(this,b)}})})();let l9=[{name:"Solid",value:tI.u1.Solid,icon:sm.OS},{name:"Dash",value:tI.u1.Dash,icon:sm.y3},{name:"None",value:tI.u1.None,icon:sm.tP}];function ce({onClick:e,selectedLineSize:t,selectedLineStyle:i,lineStyles:s=[tI.u1.Solid,tI.u1.Dash,tI.u1.None]}={}){let o=(0,L.qy)` {e?.({type:"size",value:t.detail})}} > `,r=(0,t$.u)(l9.filter(e=>s.includes(e.value)),e=>e.value,({name:t,icon:s,value:o})=>{let r=i===o,a={"line-style-button":!0,[`mode-${o}`]:!0};return r&&(a.active=!0),(0,L.qy)` e?.({type:"lineStyle",value:o})} > ${s} `});return(0,L.qy)` ${o} ${r} `}var ct=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ci=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("stroke-style-panel")],c=[],d=(0,P.Tm)(L.WF),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];(class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],ct(this,null,i,{kind:"accessor",name:"hollowCircle",static:!1,private:!1,access:{has:e=>"hollowCircle"in e,get:e=>e.hollowCircle,set:(e,t)=>{e.hollowCircle=t}},metadata:C},h,u),ct(this,null,s,{kind:"accessor",name:"setStrokeColor",static:!1,private:!1,access:{has:e=>"setStrokeColor"in e,get:e=>e.setStrokeColor,set:(e,t)=>{e.setStrokeColor=t}},metadata:C},p,f),ct(this,null,o,{kind:"accessor",name:"setStrokeStyle",static:!1,private:!1,access:{has:e=>"setStrokeStyle"in e,get:e=>e.setStrokeStyle,set:(e,t)=>{e.setStrokeStyle=t}},metadata:C},g,m),ct(this,null,r,{kind:"accessor",name:"strokeColor",static:!1,private:!1,access:{has:e=>"strokeColor"in e,get:e=>e.strokeColor,set:(e,t)=>{e.strokeColor=t}},metadata:C},v,y),ct(this,null,a,{kind:"accessor",name:"strokeStyle",static:!1,private:!1,access:{has:e=>"strokeStyle"in e,get:e=>e.strokeStyle,set:(e,t)=>{e.strokeStyle=t}},metadata:C},b,w),ct(this,null,n,{kind:"accessor",name:"strokeWidth",static:!1,private:!1,access:{has:e=>"strokeWidth"in e,get:e=>e.strokeWidth,set:(e,t)=>{e.strokeWidth=t}},metadata:C},x,_),ct(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}static{this.styles=(0,L.AH)` :host { display: flex; flex-direction: column; align-items: center; gap: 8px; } .line-styles { display: flex; flex-direction: row; gap: 8px; align-items: center; } `}render(){return(0,L.qy)`
${ce({selectedLineSize:this.strokeWidth,selectedLineStyle:this.strokeStyle,onClick:e=>this.setStrokeStyle(e),lineStyles:[tI.u1.Solid,tI.u1.Dash]})}
this.setStrokeColor(e)} > `}#im=ci(this,h,void 0);get hollowCircle(){return this.#im}set hollowCircle(e){this.#im=e}#o$=(ci(this,u),ci(this,p,void 0));get setStrokeColor(){return this.#o$}set setStrokeColor(e){this.#o$=e}#oT=(ci(this,f),ci(this,g,void 0));get setStrokeStyle(){return this.#oT}set setStrokeStyle(e){this.#oT=e}#oO=(ci(this,m),ci(this,v,void 0));get strokeColor(){return this.#oO}set strokeColor(e){this.#oO=e}#oP=(ci(this,y),ci(this,b,void 0));get strokeStyle(){return this.#oP}set strokeStyle(e){this.#oP=e}#oH=(ci(this,w),ci(this,x,void 0));get strokeWidth(){return this.#oH}set strokeWidth(e){this.#oH=e}constructor(){super(...arguments),ci(this,_)}static{ci(t,c)}})})();var cs=i(19155);let co=(0,L.AH)` :host { display: flex; flex-direction: column; align-items: normal; gap: 12px; min-width: 198px; padding: 16px; } nav { display: flex; padding: 2px; align-items: flex-start; gap: 4px; align-self: stretch; border-radius: 8px; background: var(--affine-hover-color); } nav button { display: flex; padding: 4px 8px; flex-direction: column; justify-content: center; align-items: center; flex: 1 0 0; ${sN}; color: var(--affine-text-secondary-color); font-weight: 600; border-radius: 8px; background: transparent; border: none; } nav button[active] { color: var(--affine-text-primary-color, #121212); background: var(--affine-white); box-shadow: var(--affine-shadow-1); pointer-events: none; } .modes { display: none; gap: 8px; align-self: stretch; } .modes[active] { display: flex; } .modes .mode { display: flex; padding: 2px; flex-direction: column; flex: 1 0 0; } .modes .mode button { position: relative; display: flex; height: 60px; padding: 12px 12px 8px; flex-direction: column; justify-content: center; align-items: center; gap: 4px; align-self: stretch; border-radius: 8px; border: 1px solid var(--affine-border-color); box-sizing: border-box; ${sN}; font-weight: 400; color: #8e8d91; } .modes .mode.light button { background: white; } .modes .mode.dark button { background: #141414; } .modes .mode button .color { background: var(--c); flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; overflow: hidden; } .modes .mode button[active] { pointer-events: none; outline: 2px solid var(--affine-brand-color); } .content { display: flex; flex-direction: column; gap: 16px; } .color-palette-wrapper { position: relative; width: 100%; height: 170px; } .color-palette-wrapper canvas { position: absolute; width: 100%; height: 100%; border-radius: 8px; } .color-palette-wrapper::after { content: ''; position: absolute; top: 0; right: 0; left: 0; bottom: 0; border: 1px solid rgba(0, 0, 0, 0.1); box-sizing: border-box; border-radius: 8px; overflow: hidden; pointer-events: none; } .color-circle { position: absolute; display: flex; align-items: center; justify-content: center; width: var(--size); height: var(--size); left: calc(-1 * var(--size) / 2); transform: translate(var(--x, 0), var(--y, 0)); background: transparent; border: 0.5px solid #e3e2e4; border-radius: 50%; box-sizing: border-box; box-shadow: 0px 0px 0px 0.5px #e3e3e4 inset; filter: drop-shadow(0px 0px 12px rgba(66, 65, 73, 0.14)); pointer-events: none; z-index: 2; } .color-circle::before { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-sizing: border-box; } .color-circle::after { content: ''; position: absolute; width: calc(var(--size) - 1px); height: calc(var(--size) - 1px); background: transparent; border-style: solid; border-color: white; border-radius: 50%; box-sizing: border-box; } .color-palette-wrapper { --size: calc(var(--r, 12.5px) * 2); } .color-palette-wrapper .color-circle { top: calc(-1 * var(--size) / 2); } .color-palette-wrapper .color-circle::before { opacity: var(--o, 1); } .color-palette-wrapper .color-circle::after { border-width: 4px; } .color-palette, .color-slider { position: absolute; inset: calc(-1 * var(--size) / 2); } .color-slider-wrapper:last-of-type { margin-bottom: 12px; } .color-slider-wrapper { display: flex; align-items: center; position: relative; width: 100%; height: 12px; } .color-slider-wrapper::before { content: ''; position: absolute; top: 0; right: 0; left: 0; bottom: 0; border-radius: 12px; overflow: hidden; } .color-slider-wrapper { --size: calc(var(--r, 10.5px) * 2); } .color-slider-wrapper .color-circle::after { border-width: 2px; } .color-slider-wrapper.hue::before { background: linear-gradient( to right, #f00 0%, #ff0 calc(100% / 6), #0f0 calc(200% / 6), #0ff 50%, #00f calc(400% / 6), #f0f calc(500% / 6), #f00 100% ); } .color-slider-wrapper.alpha::before { background: linear-gradient(to right, var(--s) 0%, var(--c) 100%), conic-gradient( #fff 25%, #d9d9d9 0deg, #d9d9d9 50%, #fff 0deg, #fff 75%, #d9d9d9 0deg ) 0% 0% / 8px 8px; } .color-slider-wrapper.alpha .color-circle::before { opacity: var(--o, 1); } footer { display: flex; justify-content: space-between; } .field { display: flex; padding: 7px 9px; align-items: center; gap: 4px; border-radius: 8px; border: 1px solid var(--affine-border-color); background: var(--affine-white-30); box-sizing: border-box; } .field.color { width: 134px; } .field.alpha { width: 56px; gap: 0; } input { display: flex; width: 100%; padding: 0; background: transparent; border: none; outline: none; ${sF}; font-weight: 400; color: var(--affine-text-primary-color); } /* Chrome, Safari, Edge, Opera */ input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } /* Firefox */ input[type='number'] { -moz-appearance: textfield; } `;var cr=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ca=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("edgeless-color-picker")],c=[],d=(0,q.Jb)((0,P.Tm)(L.WF)),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];(class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.P)(".color-slider-wrapper.alpha .color-slider")],s=[(0,D.P)("canvas")],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.P)(".color-slider-wrapper.hue .color-slider")],a=[(0,D.P)(".color-palette")],n=[(0,D.MZ)({attribute:!1})],cr(this,null,i,{kind:"accessor",name:"alphaControl",static:!1,private:!1,access:{has:e=>"alphaControl"in e,get:e=>e.alphaControl,set:(e,t)=>{e.alphaControl=t}},metadata:C},h,u),cr(this,null,s,{kind:"accessor",name:"canvas",static:!1,private:!1,access:{has:e=>"canvas"in e,get:e=>e.canvas,set:(e,t)=>{e.canvas=t}},metadata:C},p,f),cr(this,null,o,{kind:"accessor",name:"colors",static:!1,private:!1,access:{has:e=>"colors"in e,get:e=>e.colors,set:(e,t)=>{e.colors=t}},metadata:C},g,m),cr(this,null,r,{kind:"accessor",name:"hueControl",static:!1,private:!1,access:{has:e=>"hueControl"in e,get:e=>e.hueControl,set:(e,t)=>{e.hueControl=t}},metadata:C},v,y),cr(this,null,a,{kind:"accessor",name:"paletteControl",static:!1,private:!1,access:{has:e=>"paletteControl"in e,get:e=>e.paletteControl,set:(e,t)=>{e.paletteControl=t}},metadata:C},b,w),cr(this,null,n,{kind:"accessor",name:"pick",static:!1,private:!1,access:{has:e=>"pick"in e,get:e=>e.pick,set:(e,t)=>{e.pick=t}},metadata:C},x,_),cr(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}#oA=new DOMRect;#oL=e=>{let t=e.target,i=t.value,s=i.trim().replace(/[^0-9]/,""),o=lV(0,Number(s),100),r=lz(o,100),a=this.hsva$.peek();if(i!==(s=`${o}`)&&(t.value=s),a.a===r)return;let n=this.#oA.width*r;this.alphaPosX$.value=n,this.#oD()};#oZ=e=>{e.stopPropagation();let t=e.target;if("Enter"===e.key){let e;let i=t.value,s=i.trim().replace(lD.other,"");if((e=s.match(lD.hex3))||(e=s.match(lD.hex6))){let o=this.hsva$.peek(),r=lK(e[1]),a={...o,...r};if(i!==(s=lU(lq(a)))&&(t.value=s),lX(a,o))return;this.#oj(a),this.#oD()}else t.value=this.hex6WithoutHash$.peek()}};#oV=new DOMRect;#oz=new DOMRect;static{this.styles=co}#oD(){let e=this.hsva$.peek(),t=this.modeType$.peek(),i={[t]:lG(e)};if("normal"!==t){let e="light"===t?"dark":"light",{hsva:s}=this[`${e}$`].peek();i[e]=lG(s)}this.pick?.({type:"pick",detail:i})}#oR(){this.pick?.({type:"end"})}#oF(){this.pick?.({type:"start"})}#oN(e){let{left:t,width:i}=this.#oA,s=lV(0,e-t,i);this.alphaPosX$.value=s}#oq(e){let{width:t}=this.#oA,i=lV(0,this.alphaPosX$.peek()+e*t/100,t);this.alphaPosX$.value=i}#oj({h:e,s:t,v:i,a:s}){let o=this.#oV.width*e,r=this.#oz.width*t,a=this.#oz.height*(1-i),n=this.#oA.width*s;(0,q.vA)(()=>{this.huePosX$.value=o,this.alphaPosX$.value=n,this.palettePos$.value={x:r,y:a}})}#oU(e){let{left:t,width:i}=this.#oV,s=lV(0,e-t,i);this.huePosX$.value=s}#oW(e){let{width:t}=this.#oV,i=lV(0,this.huePosX$.peek()+e*t/100,t);this.huePosX$.value=i}#oG(e,t){let{left:i,top:s,width:o,height:r}=this.#oz,a=lV(0,e-i,o),n=lV(0,t-s,r);this.palettePos$.value={x:a,y:n}}#oY(e,t){let{width:i,height:s}=this.#oz,o=this.palettePos$.peek(),r=lV(0,o.x+e*i/100,i),a=lV(0,o.y+t*s/100,s);this.palettePos$.value={x:r,y:a}}#oK({left:e,top:t,width:i,height:s},o){return new DOMRect(e+o,t+o,Math.round(i-2*o),Math.round(s-2*o))}#oX(){this.#oz=this.#oK(this.paletteControl.getBoundingClientRect(),12.5),this.#oV=this.#oK(this.hueControl.getBoundingClientRect(),10.5),this.#oA=this.#oK(this.alphaControl.getBoundingClientRect(),10.5)}#oQ(e){this.modeType$.value=e,this.#oj(this.mode$.peek().hsva)}#oJ(e){if(this.navType$.value=e,"colors"===e){let e=this.mode$.peek();this.modes$.value[0].hsva={...e.hsva},this.modeType$.value="normal"}else{let[e,t,i]=this.modes$.value;t.hsva={...e.hsva},i.hsva={...e.hsva},this.modeType$.value="light"}}firstUpdated(){let e,t,i,s=!1,o=!1,r=!1,a=!1,n=0;this.disposables.addFromEvent(this,"wheel",e=>{e.stopPropagation();let t=e.composedPath()[0],i=t===this.hueControl,s=!i&&t===this.alphaControl,o=!s&&t===this.paletteControl;a=i||s||o,n&&clearTimeout(n),a&&(n||this.#oF(),n=window.setTimeout(()=>{this.#oR(),n=0},110)),((e,t)=>{if(!a)return;let r=Math.abs(e),n=Math.abs(t);0!==Math.hypot(e=Math.sign(e),t=Math.sign(t))&&(e*=-1*Math.max(1,Math.log10(r)),t*=-1*Math.max(1,Math.log10(n)),i&&this.#oW(e|t),s&&this.#oq(e|t),o&&this.#oY(e,t),this.#oD())})(e.deltaX,e.deltaY)}),this.disposables.addFromEvent(this,"pointerdown",l=>{l.stopPropagation(),n&&(clearTimeout(n),n=0),e=(0,sy.on)(this,"pointerenter",()=>r=!1),i=(0,sy.on)(this,"pointerout",()=>r=!0),(0,sy.Oo)(document,"pointerup",()=>{e?.(),t?.(),i?.(),a&&this.#oR(),o&&r&&(0,sy.Oo)(document,"click",sy.dG,!0),e=t=i=null,s=o=r=a=!1}),s=!0;let c=l.composedPath()[0],d=c===this.hueControl,h=!d&&c===this.alphaControl,u=!h&&c===this.paletteControl;if(a=d||h||u){this.#oF();let e=c.getBoundingClientRect();d?this.#oV=this.#oK(e,10.5):h?this.#oA=this.#oK(e,10.5):u&&(this.#oz=this.#oK(e,12.5))}let p=(e,t)=>{a&&(d&&this.#oU(e),h&&this.#oN(e),u&&this.#oG(e,t),this.#oD())};p(l.x,l.y),t=(0,sy.on)(document,"pointermove",e=>{s&&(o||(o=!0),p(e.x,e.y))})}),this.disposables.addFromEvent(this,"click",sy.dG);let l=[],{type:c,modes:d}=this.colors;["dark","light"].includes(c)&&l.push(()=>{this.modeType$.value=c,this.navType$.value="custom"}),d?.length&&l.push(()=>{this.modes$.value.reduce((e,t,i)=>{let s=d[i];return t.hsva=s?lN(s.rgba):e,{...t.hsva}},lZ())}),l.push(()=>{let e=this.mode$.peek();this.#oj(e.hsva)}),this.#oX(),(0,q.vA)(()=>l.forEach(e=>e())),this.updateComplete.then(()=>{this.disposables.add(this.hsva$.subscribe(e=>{let t=this.modeType$.peek(),i=this.modes$.value.find(e=>e.type===t);i&&(i.hsva={...e})})),this.disposables.add(this.huePosX$.subscribe(e=>{let{width:t}=this.#oV,i=function(e){if(e<0)return lA[0][0];if(e>1)return lA[lA.length-1][0];let t=0,i=lA.length;for(;t{let t=this.hsva$.peek(),i=lR(e).h;this.hsva$.value={...t,h:i}})),this.disposables.add(this.alphaPosX$.subscribe(e=>{let t=this.hsva$.peek(),{width:i}=this.#oA,s=lz(e,i);this.hsva$.value={...t,a:s}})),this.disposables.add(this.palettePos$.subscribe(({x:e,y:t})=>{let i=this.hsva$.peek(),{width:s,height:o}=this.#oz,r=lz(e,s),a=lz(o-t,o);this.hsva$.value={...i,s:r,v:a}}))}).catch(console.error)}render(){return(0,L.qy)`
${(0,t$.u)([this.light$.value,this.dark$.value],e=>e.type,({type:e,name:t,hsva:i})=>(0,L.qy)`
`)}
`}#o1=(0,q.EW)(()=>`${Math.round(100*this.hsva$.value.a)}`);get alpha100$(){return this.#o1}set alpha100$(e){this.#o1=e}#o0=ca(this,h,void 0);get alphaControl(){return this.#o0}set alphaControl(e){this.#o0=e}#o2=(ca(this,u),(0,q.vP)(0));get alphaPosX$(){return this.#o2}set alphaPosX$(e){this.#o2=e}#o5=(0,q.EW)(()=>{let e=this.alphaPosX$.value,t=this.rgba$.value,i=`#${lU(t)}`;return{"--o":t.a,"--s":`${i}00`,"--c":`${i}ff`,"--x":`${e}px`,"--r":"10.5px"}});get alphaStyle$(){return this.#o5}set alphaStyle$(e){this.#o5=e}#o7=ca(this,p,void 0);get canvas(){return this.#o7}set canvas(e){this.#o7=e}#o3=(ca(this,f),ca(this,g,{type:"normal"}));get colors(){return this.#o3}set colors(e){this.#o3=e}#o4=(ca(this,m),(0,q.EW)(()=>this.modes$.value[2]));get dark$(){return this.#o4}set dark$(e){this.#o4=e}#o6=(0,q.EW)(()=>this.hex8$.value.substring(0,7));get hex6$(){return this.#o6}set hex6$(e){this.#o6=e}#o8=(0,q.EW)(()=>this.hex6$.value.substring(1));get hex6WithoutHash$(){return this.#o8}set hex6WithoutHash$(e){this.#o8=e}#o9=(0,q.EW)(()=>lW(this.rgba$.value));get hex8$(){return this.#o9}set hex8$(e){this.#o9=e}#re=(0,q.vP)(lZ());get hsva$(){return this.#re}set hsva$(e){this.#re=e}#rt=(0,q.vP)({r:0,g:0,b:0});get hue$(){return this.#rt}set hue$(e){this.#rt=e}#ri=ca(this,v,void 0);get hueControl(){return this.#ri}set hueControl(e){this.#ri=e}#rs=(ca(this,y),(0,q.vP)(0));get huePosX$(){return this.#rs}set huePosX$(e){this.#rs=e}#ro=(0,q.EW)(()=>{let e=this.huePosX$.value,t=this.hue$.value;return{"--x":`${e}px`,"--c":`#${lU(t)}`,"--r":"10.5px"}});get hueStyle$(){return this.#ro}set hueStyle$(e){this.#ro=e}#rr=(0,q.EW)(()=>this.modes$.value[1]);get light$(){return this.#rr}set light$(e){this.#rr=e}#ra=(0,q.EW)(()=>{let e=this.modeType$.value;return this.modes$.value.find(t=>t.type===e)});get mode$(){return this.#ra}set mode$(e){this.#ra=e}#rn=(0,q.vP)("normal");get modeType$(){return this.#rn}set modeType$(e){this.#rn=e}#rl=(0,q.vP)([{type:"normal",name:"Normal",hsva:lZ()},{type:"light",name:"Light",hsva:lZ()},{type:"dark",name:"Dark",hsva:lZ()}]);get modes$(){return this.#rl}set modes$(e){this.#rl=e}#rc=(0,q.vP)("colors");get navType$(){return this.#rc}set navType$(e){this.#rc=e}#rd=ca(this,b,void 0);get paletteControl(){return this.#rd}set paletteControl(e){this.#rd=e}#rh=(ca(this,w),(0,q.vP)({x:0,y:0}));get palettePos$(){return this.#rh}set palettePos$(e){this.#rh=e}#ru=(0,q.EW)(()=>{let{x:e,y:t}=this.palettePos$.value;return{"--c":this.hex6$.value,"--x":`${e}px`,"--y":`${t}px`,"--r":"12.5px"}});get paletteStyle$(){return this.#ru}set paletteStyle$(e){this.#ru=e}#rp=ca(this,x,void 0);get pick(){return this.#rp}set pick(e){this.#rp=e}#rf=(ca(this,_),(0,q.EW)(()=>lq(this.hsva$.value)));get rgba$(){return this.#rf}set rgba$(e){this.#rf=e}static{ca(t,c)}})})();var cl=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},cc=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-color-custom-button")],s=[],o=L.WF,r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;cl(this,null,[(0,D.MZ)({attribute:!1})],{kind:"accessor",name:"active",static:!1,private:!1,access:{has:e=>"active"in e,get:e=>e.active,set:(e,t)=>{e.active=t}},metadata:n},r,a),cl(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` ${tN} .color-custom { display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; box-sizing: border-box; overflow: hidden; padding: 2px; border: 2px solid transparent; background: linear-gradient(var(--c, transparent), var(--c, transparent)) content-box, linear-gradient(var(--b, transparent), var(--b, transparent)) padding-box, conic-gradient( from 180deg at 50% 50%, #d21c7e 0deg, #c240f0 30.697514712810516deg, #434af5 62.052921652793884deg, #3cb5f9 93.59999656677246deg, #3ceefa 131.40000343322754deg, #37f7bd 167.40000128746033deg, #2df541 203.39999914169312deg, #e7f738 239.40000772476196deg, #fbaf3e 273.07027101516724deg, #fd904e 300.73712825775146deg, #f64545 329.47510957717896deg, #f040a9 359.0167021751404deg ) border-box; } `}render(){return(0,L.qy)`
`}#iN=cc(this,r,void 0);get active(){return this.#iN}set active(e){this.#iN=e}constructor(){super(...arguments),cc(this,a)}static{cc(t,s)}})})();var cd=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ch=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d,h,u,p=[(0,D.EM)("edgeless-color-picker-button")],f=[],g=(0,P.Tm)(L.WF),m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],H=[],A=[],j=[],V=[],z=[];(class extends g{static{t=this}static{let P="function"==typeof Symbol&&Symbol.metadata?Object.create(g[Symbol.metadata]??null):void 0;i=[(0,D.MZ)()],s=[(0,D.MZ)()],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)()],l=[(0,D.P)("editor-menu-button")],c=[(0,D.MZ)({attribute:!1})],d=[(0,D.MZ)({attribute:!1})],h=[(0,D.wk)()],u=[(0,D.MZ)()],cd(this,null,i,{kind:"accessor",name:"color",static:!1,private:!1,access:{has:e=>"color"in e,get:e=>e.color,set:(e,t)=>{e.color=t}},metadata:P},m,v),cd(this,null,s,{kind:"accessor",name:"colorType",static:!1,private:!1,access:{has:e=>"colorType"in e,get:e=>e.colorType,set:(e,t)=>{e.colorType=t}},metadata:P},y,b),cd(this,null,o,{kind:"accessor",name:"colors",static:!1,private:!1,access:{has:e=>"colors"in e,get:e=>e.colors,set:(e,t)=>{e.colors=t}},metadata:P},w,x),cd(this,null,r,{kind:"accessor",name:"hollowCircle",static:!1,private:!1,access:{has:e=>"hollowCircle"in e,get:e=>e.hollowCircle,set:(e,t)=>{e.hollowCircle=t}},metadata:P},_,C),cd(this,null,a,{kind:"accessor",name:"isText",static:!1,private:!1,access:{has:e=>"isText"in e,get:e=>e.isText,set:(e,t)=>{e.isText=t}},metadata:P},k,S),cd(this,null,n,{kind:"accessor",name:"label",static:!1,private:!1,access:{has:e=>"label"in e,get:e=>e.label,set:(e,t)=>{e.label=t}},metadata:P},M,E),cd(this,null,l,{kind:"accessor",name:"menuButton",static:!1,private:!1,access:{has:e=>"menuButton"in e,get:e=>e.menuButton,set:(e,t)=>{e.menuButton=t}},metadata:P},I,B),cd(this,null,c,{kind:"accessor",name:"palettes",static:!1,private:!1,access:{has:e=>"palettes"in e,get:e=>e.palettes,set:(e,t)=>{e.palettes=t}},metadata:P},$,T),cd(this,null,d,{kind:"accessor",name:"pick",static:!1,private:!1,access:{has:e=>"pick"in e,get:e=>e.pick,set:(e,t)=>{e.pick=t}},metadata:P},O,H),cd(this,null,h,{kind:"accessor",name:"tabType",static:!1,private:!1,access:{has:e=>"tabType"in e,get:e=>e.tabType,set:(e,t)=>{e.tabType=t}},metadata:P},A,j),cd(this,null,u,{kind:"accessor",name:"tooltip",static:!1,private:!1,access:{has:e=>"tooltip"in e,get:e=>e.tooltip,set:(e,t)=>{e.tooltip=t}},metadata:P},V,z),cd(null,e={value:t},p,{kind:"class",name:t.name,metadata:P},null,f),t=e.value,P&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:P}),ch(t,f)}#rg;#oD(e){this.pick?.({type:"start"}),this.pick?.({type:"pick",detail:e}),this.pick?.({type:"end"})}firstUpdated(){this.disposables.addFromEvent(this.menuButton,"toggle",e=>{"hidden"===e.newState&&"normal"!==this.tabType&&(this.tabType="normal")})}render(){return(0,L.qy)` ${this.isText?(0,L.qy)` `:(0,L.qy)` `} `} > ${(0,rW.S)(this.tabType,[["normal",()=>(0,L.qy)`
`],["custom",()=>(0,L.qy)` `]])}
`}get colorWithoutAlpha(){return this.isCSSVariable?this.color:lJ(this.color)}get customButtonStyle(){let e="transparent",t="transparent";return this.isCSSVariable||(e="var(--affine-background-overlay-panel-color)",t=lJ(this.color)),{"--b":e,"--c":t}}get isCSSVariable(){return this.color.startsWith("--")}get tabContentPadding(){return`${"custom"===this.tabType?0:8}px`}#ig;get color(){return this.#ig}set color(e){this.#ig=e}#rm;get colorType(){return this.#rm}set colorType(e){this.#rm=e}#o3;get colors(){return this.#o3}set colors(e){this.#o3=e}#im;get hollowCircle(){return this.#im}set hollowCircle(e){this.#im=e}#rv;get isText(){return this.#rv}set isText(e){this.#rv=e}#ry;get label(){return this.#ry}set label(e){this.#ry=e}#rb;get menuButton(){return this.#rb}set menuButton(e){this.#rb=e}#rw;get palettes(){return this.#rw}set palettes(e){this.#rw=e}#rp;get pick(){return this.#rp}set pick(e){this.#rp=e}#rx;get tabType(){return this.#rx}set tabType(e){this.#rx=e}#sP;get tooltip(){return this.#sP}set tooltip(e){this.#sP=e}constructor(){super(...arguments),this.#rg=e=>{this.#oD({palette:e.detail})},this.switchToCustomTab=e=>{e.stopPropagation(),"palette"===this.colorType&&(this.colorType="normal"),this.tabType="custom",this.menuButton.show(!0)},this.#ig=ch(this,m,void 0),this.#rm=(ch(this,v),ch(this,y,"palette")),this.#o3=(ch(this,b),ch(this,w,[])),this.#im=(ch(this,x),ch(this,_,!1)),this.#rv=(ch(this,C),ch(this,k,void 0)),this.#ry=(ch(this,S),ch(this,M,void 0)),this.#rb=(ch(this,E),ch(this,I,void 0)),this.#rw=(ch(this,B),ch(this,$,[])),this.#rp=(ch(this,T),ch(this,O,void 0)),this.#rx=(ch(this,H),ch(this,A,"normal")),this.#sP=(ch(this,j),ch(this,V,void 0)),ch(this,z)}})})();var cu=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},cp=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("edgeless-align-panel")],r=[],a=L.WF,n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],cu(this,null,i,{kind:"accessor",name:"onSelect",static:!1,private:!1,access:{has:e=>"onSelect"in e,get:e=>e.onSelect,set:(e,t)=>{e.onSelect=t}},metadata:h},n,l),cu(this,null,s,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:h},c,d),cu(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` :host { display: flex; align-items: center; justify-content: center; gap: 8px; } `}_onSelect(e){this.value=e,this.onSelect&&this.onSelect(e)}render(){return(0,t$.u)(cf,e=>e.name,({name:e,value:t,icon:i})=>(0,L.qy)` this._onSelect(t)} > ${i} `)}#ov=cp(this,n,void 0);get onSelect(){return this.#ov}set onSelect(e){this.#ov=e}#eJ=(cp(this,l),cp(this,c,tI.nO.Left));get value(){return this.#eJ}set value(e){this.#eJ=e}constructor(){super(...arguments),cp(this,d)}static{cp(t,r)}})})();var cg=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},cm=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("edgeless-font-family-panel")],r=[],a=L.WF,n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],cg(this,null,i,{kind:"accessor",name:"onSelect",static:!1,private:!1,access:{has:e=>"onSelect"in e,get:e=>e.onSelect,set:(e,t)=>{e.onSelect=t}},metadata:h},n,l),cg(this,null,s,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:h},c,d),cg(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` :host { display: flex; align-items: start; flex-direction: column; min-width: 136px; } edgeless-tool-icon-button { width: 100%; } `}_onSelect(e){this.value=e,this.onSelect&&this.onSelect(e)}render(){return(0,t$.u)(tI.i,e=>e[0],([e,t])=>{let i=this.value===e;return(0,L.qy)` this._onSelect(e)} > ${t} ${i?sm.Sr:L.s6} `})}#ov=cm(this,n,void 0);get onSelect(){return this.#ov}set onSelect(e){this.#ov=e}#eJ=(cm(this,l),cm(this,c,tI.ay.Inter));get value(){return this.#eJ}set value(e){this.#eJ=e}constructor(){super(...arguments),cm(this,d)}static{cm(t,r)}})})();var cv=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},cy=function(e,t,i){for(var s=arguments.length>2,o=0;o"Light"],[tI.IT.Regular,()=>"Regular"],[tI.IT.SemiBold,()=>"Semibold"]];(()=>{let e,t,i,s,o,r,a=[(0,D.EM)("edgeless-font-weight-and-style-panel")],n=[],l=L.WF,c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],cv(this,null,i,{kind:"accessor",name:"fontFamily",static:!1,private:!1,access:{has:e=>"fontFamily"in e,get:e=>e.fontFamily,set:(e,t)=>{e.fontFamily=t}},metadata:v},c,d),cv(this,null,s,{kind:"accessor",name:"fontStyle",static:!1,private:!1,access:{has:e=>"fontStyle"in e,get:e=>e.fontStyle,set:(e,t)=>{e.fontStyle=t}},metadata:v},h,u),cv(this,null,o,{kind:"accessor",name:"fontWeight",static:!1,private:!1,access:{has:e=>"fontWeight"in e,get:e=>e.fontWeight,set:(e,t)=>{e.fontWeight=t}},metadata:v},p,f),cv(this,null,r,{kind:"accessor",name:"onSelect",static:!1,private:!1,access:{has:e=>"onSelect"in e,get:e=>e.onSelect,set:(e,t)=>{e.onSelect=t}},metadata:v},g,m),cv(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { display: flex; align-items: start; flex-direction: column; min-width: 124px; } edgeless-tool-icon-button { width: 100%; } `}_isActive(e,t=tI.zz.Normal){return this.fontWeight===e&&this.fontStyle===t}_isDisabled(e,t=tI.zz.Normal){return this.fontFamily in tI._9&&!(0,t7.AF)().filter((0,t7.yp)(this.fontFamily)).find(i=>i.weight===e&&i.style===t)}_onSelect(e,t=tI.zz.Normal){this.fontWeight=e,this.fontStyle=t,this.onSelect&&this.onSelect(e,t)}render(){let e=(0,t7.e4)(this.fontFamily);0===e.length&&(e=(0,t7.e4)(tI.ay.Inter));let t=e.filter(e=>e.style===tI.zz.Normal),i=e.filter(e=>e.style===tI.zz.Italic);return(0,sj.f)([t.length>0?(0,t$.u)(t,e=>e.weight,e=>{let t=this._isActive(e.weight);return(0,L.qy)` this._onSelect(e.weight)} > ${(0,rW.S)(e.weight,cb)} ${t?sm.Sr:L.s6} `}):L.s6,i.length>0?(0,t$.u)(i,e=>e.weight,e=>{let t=this._isActive(e.weight,tI.zz.Italic);return(0,L.qy)` this._onSelect(e.weight,tI.zz.Italic)} > ${(0,rW.S)(e.weight,cb)} Italic ${t?sm.Sr:L.s6} `}):L.s6].filter(e=>e!==L.s6),()=>(0,L.qy)` `)}#r_=cy(this,c,tI.ay.Inter);get fontFamily(){return this.#r_}set fontFamily(e){this.#r_=e}#rC=(cy(this,d),cy(this,h,tI.zz.Normal));get fontStyle(){return this.#rC}set fontStyle(e){this.#rC=e}#rk=(cy(this,u),cy(this,p,tI.IT.Regular));get fontWeight(){return this.#rk}set fontWeight(e){this.#rk=e}#ov=(cy(this,f),cy(this,g,void 0));get onSelect(){return this.#ov}set onSelect(e){this.#ov=e}constructor(){super(...arguments),cy(this,m)}static{cy(t,n)}})})();var cw=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},cx=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d,h,u,p,f,g,m,v,y,b=[(0,D.EM)("edgeless-tool-icon-button")],w=[],x=L.WF,_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],P=[],H=[],A=[],j=[],V=[],z=[],R=[],F=[],N=[],q=[],U=[],W=[],G=[],Y=[],K=[],X=[],Q=[],J=[],ee=[],et=[],ei=[],es=[],eo=[];return class extends x{static{t=this}static{let L="function"==typeof Symbol&&Symbol.metadata?Object.create(x[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],c=[(0,D.MZ)({attribute:!1})],d=[(0,D.MZ)({attribute:!1})],h=[(0,D.MZ)({attribute:!1})],u=[(0,D.MZ)({attribute:!1})],p=[(0,D.MZ)({attribute:!1})],f=[(0,D.MZ)({type:Boolean})],g=[(0,D.MZ)({attribute:!1})],m=[(0,D.MZ)({attribute:!1})],v=[(0,D.MZ)({attribute:!1})],y=[(0,D.MZ)({attribute:!1})],cw(this,null,i,{kind:"accessor",name:"active",static:!1,private:!1,access:{has:e=>"active"in e,get:e=>e.active,set:(e,t)=>{e.active=t}},metadata:L},_,C),cw(this,null,s,{kind:"accessor",name:"activeMode",static:!1,private:!1,access:{has:e=>"activeMode"in e,get:e=>e.activeMode,set:(e,t)=>{e.activeMode=t}},metadata:L},k,S),cw(this,null,o,{kind:"accessor",name:"arrow",static:!1,private:!1,access:{has:e=>"arrow"in e,get:e=>e.arrow,set:(e,t)=>{e.arrow=t}},metadata:L},M,E),cw(this,null,r,{kind:"accessor",name:"coming",static:!1,private:!1,access:{has:e=>"coming"in e,get:e=>e.coming,set:(e,t)=>{e.coming=t}},metadata:L},I,B),cw(this,null,a,{kind:"accessor",name:"disabled",static:!1,private:!1,access:{has:e=>"disabled"in e,get:e=>e.disabled,set:(e,t)=>{e.disabled=t}},metadata:L},$,T),cw(this,null,n,{kind:"accessor",name:"hover",static:!1,private:!1,access:{has:e=>"hover"in e,get:e=>e.hover,set:(e,t)=>{e.hover=t}},metadata:L},O,P),cw(this,null,l,{kind:"accessor",name:"hoverState",static:!1,private:!1,access:{has:e=>"hoverState"in e,get:e=>e.hoverState,set:(e,t)=>{e.hoverState=t}},metadata:L},H,A),cw(this,null,c,{kind:"accessor",name:"iconContainerPadding",static:!1,private:!1,access:{has:e=>"iconContainerPadding"in e,get:e=>e.iconContainerPadding,set:(e,t)=>{e.iconContainerPadding=t}},metadata:L},j,V),cw(this,null,d,{kind:"accessor",name:"iconContainerWidth",static:!1,private:!1,access:{has:e=>"iconContainerWidth"in e,get:e=>e.iconContainerWidth,set:(e,t)=>{e.iconContainerWidth=t}},metadata:L},z,R),cw(this,null,h,{kind:"accessor",name:"iconSize",static:!1,private:!1,access:{has:e=>"iconSize"in e,get:e=>e.iconSize,set:(e,t)=>{e.iconSize=t}},metadata:L},F,N),cw(this,null,u,{kind:"accessor",name:"justify",static:!1,private:!1,access:{has:e=>"justify"in e,get:e=>e.justify,set:(e,t)=>{e.justify=t}},metadata:L},q,U),cw(this,null,p,{kind:"accessor",name:"labelHeight",static:!1,private:!1,access:{has:e=>"labelHeight"in e,get:e=>e.labelHeight,set:(e,t)=>{e.labelHeight=t}},metadata:L},W,G),cw(this,null,f,{kind:"accessor",name:"showTooltip",static:!1,private:!1,access:{has:e=>"showTooltip"in e,get:e=>e.showTooltip,set:(e,t)=>{e.showTooltip=t}},metadata:L},Y,K),cw(this,null,g,{kind:"accessor",name:"tipPosition",static:!1,private:!1,access:{has:e=>"tipPosition"in e,get:e=>e.tipPosition,set:(e,t)=>{e.tipPosition=t}},metadata:L},X,Q),cw(this,null,m,{kind:"accessor",name:"tooltip",static:!1,private:!1,access:{has:e=>"tooltip"in e,get:e=>e.tooltip,set:(e,t)=>{e.tooltip=t}},metadata:L},J,ee),cw(this,null,v,{kind:"accessor",name:"tooltipOffset",static:!1,private:!1,access:{has:e=>"tooltipOffset"in e,get:e=>e.tooltipOffset,set:(e,t)=>{e.tooltipOffset=t}},metadata:L},et,ei),cw(this,null,y,{kind:"accessor",name:"withHover",static:!1,private:!1,access:{has:e=>"withHover"in e,get:e=>e.withHover,set:(e,t)=>{e.withHover=t}},metadata:L},es,eo),cw(null,e={value:t},b,{kind:"class",name:t.name,metadata:L},null,w),t=e.value,L&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:L})}static{this.styles=(0,L.AH)` .icon-container { position: relative; display: flex; align-items: center; padding: var(--icon-container-padding); color: var(--affine-icon-color); border-radius: 4px; cursor: pointer; white-space: nowrap; box-sizing: border-box; width: var(--icon-container-width, unset); justify-content: var(--justify, unset); } .icon-container.active-mode-color[active] { color: var(--affine-primary-color); } .icon-container.active-mode-background[active] { background: var(--affine-hover-color); } .icon-container[disabled] { pointer-events: none; cursor: not-allowed; color: var(--affine-text-disable-color); } .icon-container[coming] { cursor: not-allowed; color: var(--affine-text-disable-color); } ::slotted(svg) { flex-shrink: 0; height: var(--icon-size, unset); } ::slotted(.label) { flex: 1; padding: 0 4px; overflow: hidden; white-space: nowrap; line-height: var(--label-height, inherit); } ::slotted(.label.padding0) { padding: 0; } ::slotted(.label.ellipsis) { text-overflow: ellipsis; } ::slotted(.label.medium) { font-weight: 500; } .icon-container[with-hover]::before { content: ''; display: block; background: var(--affine-hover-color); position: absolute; width: 100%; height: 100%; top: 0; left: 0; border-radius: 4px; } `}constructor(){super(),cx(this,eo),this.addEventListener("click",e=>{this.disabled&&(e.stopPropagation(),e.preventDefault())},{capture:!0})}connectedCallback(){super.connectedCallback(),this.role="button"}render(){let e=this.coming?"(Coming soon)":this.tooltip,t=`icon-container active-mode-${this.activeMode} ${this.hoverState?"hovered":""}`,i=this.iconContainerPadding,s=(0,Z.W)({"--icon-container-width":this.iconContainerWidth,"--icon-container-padding":Array.isArray(i)?i.map(e=>`${e}px`).join(" "):`${i}px`,"--icon-size":this.iconSize,"--justify":this.justify,"--label-height":this.labelHeight});return(0,L.qy)`
${(0,r9.P)(this.showTooltip&&e?(0,L.qy)`${e}`:L.s6)}
`}#iN=cx(this,_,!1);get active(){return this.#iN}set active(e){this.#iN=e}#sC=(cx(this,C),cx(this,k,"color"));get activeMode(){return this.#sC}set activeMode(e){this.#sC=e}#ec=(cx(this,S),cx(this,M,!0));get arrow(){return this.#ec}set arrow(e){this.#ec=e}#sk=(cx(this,E),cx(this,I,!1));get coming(){return this.#sk}set coming(e){this.#sk=e}#iq=(cx(this,B),cx(this,$,!1));get disabled(){return this.#iq}set disabled(e){this.#iq=e}#iW=(cx(this,T),cx(this,O,!0));get hover(){return this.#iW}set hover(e){this.#iW=e}#sS=(cx(this,P),cx(this,H,!1));get hoverState(){return this.#sS}set hoverState(e){this.#sS=e}#sM=(cx(this,A),cx(this,j,2));get iconContainerPadding(){return this.#sM}set iconContainerPadding(e){this.#sM=e}#sE=(cx(this,V),cx(this,z,void 0));get iconContainerWidth(){return this.#sE}set iconContainerWidth(e){this.#sE=e}#sI=(cx(this,R),cx(this,F,void 0));get iconSize(){return this.#sI}set iconSize(e){this.#sI=e}#sB=(cx(this,N),cx(this,q,void 0));get justify(){return this.#sB}set justify(e){this.#sB=e}#s$=(cx(this,U),cx(this,W,void 0));get labelHeight(){return this.#s$}set labelHeight(e){this.#s$=e}#sT=(cx(this,G),cx(this,Y,!0));get showTooltip(){return this.#sT}set showTooltip(e){this.#sT=e}#sO=(cx(this,K),cx(this,X,"top"));get tipPosition(){return this.#sO}set tipPosition(e){this.#sO=e}#sP=(cx(this,Q),cx(this,J,void 0));get tooltip(){return this.#sP}set tooltip(e){this.#sP=e}#sH=(cx(this,ee),cx(this,et,8));get tooltipOffset(){return this.#sH}set tooltipOffset(e){this.#sH=e}#sA=(cx(this,ei),cx(this,es,void 0));get withHover(){return this.#sA}set withHover(e){this.#sA=e}static{cx(t,w)}},t})();var cC=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ck=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c=[(0,D.EM)("edgeless-size-panel")],d=[],h=L.WF,u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[];(class extends h{static{t=this}static{let M="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:"data-type"})],cC(this,null,i,{kind:"accessor",name:"maxSize",static:!1,private:!1,access:{has:e=>"maxSize"in e,get:e=>e.maxSize,set:(e,t)=>{e.maxSize=t}},metadata:M},u,p),cC(this,null,s,{kind:"accessor",name:"minSize",static:!1,private:!1,access:{has:e=>"minSize"in e,get:e=>e.minSize,set:(e,t)=>{e.minSize=t}},metadata:M},f,g),cC(this,null,o,{kind:"accessor",name:"onPopperCose",static:!1,private:!1,access:{has:e=>"onPopperCose"in e,get:e=>e.onPopperCose,set:(e,t)=>{e.onPopperCose=t}},metadata:M},m,v),cC(this,null,r,{kind:"accessor",name:"onSelect",static:!1,private:!1,access:{has:e=>"onSelect"in e,get:e=>e.onSelect,set:(e,t)=>{e.onSelect=t}},metadata:M},y,b),cC(this,null,a,{kind:"accessor",name:"size",static:!1,private:!1,access:{has:e=>"size"in e,get:e=>e.size,set:(e,t)=>{e.size=t}},metadata:M},w,x),cC(this,null,n,{kind:"accessor",name:"sizeList",static:!1,private:!1,access:{has:e=>"sizeList"in e,get:e=>e.sizeList,set:(e,t)=>{e.sizeList=t}},metadata:M},_,C),cC(this,null,l,{kind:"accessor",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:M},k,S),cC(null,e={value:t},c,{kind:"class",name:t.name,metadata:M},null,d),t=e.value,M&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:M})}static{this.styles=(0,L.AH)` :host { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 68px; } edgeless-tool-icon-button { align-self: stretch; } .size-input { display: flex; align-self: stretch; width: 100%; border: 0.5px solid var(--affine-border-color); border-radius: 8px; padding: 4px 8px; box-sizing: border-box; } .size-input::placeholder { color: var(--affine-placeholder-color); } .size-input:focus { outline-color: var(--affine-primary-color); outline-width: 0.5px; } :host([data-type='check']) { gap: 0; } :host([data-type='check']) .size-input { margin-top: 4px; } `}_onPopperClose(){this.onPopperCose?.()}_onSelect(e){this.onSelect?.(e)}render(){return(0,L.qy)` ${(0,t$.u)(this.sizeList,e=>e.name,this.renderItem())} `}renderItem(){return"normal"===this.type?this.renderItemWithNormal:this.renderItemWithCheck}#rS;get maxSize(){return this.#rS}set maxSize(e){this.#rS=e}#rM;get minSize(){return this.#rM}set minSize(e){this.#rM=e}#rE;get onPopperCose(){return this.#rE}set onPopperCose(e){this.#rE=e}#ov;get onSelect(){return this.#ov}set onSelect(e){this.#ov=e}#eQ;get size(){return this.#eQ}set size(e){this.#eQ=e}#rI;get sizeList(){return this.#rI}set sizeList(e){this.#rI=e}#tW;get type(){return this.#tW}set type(e){this.#tW=e}constructor(){super(...arguments),this._onKeydown=e=>{if(e.stopPropagation(),"Enter"===e.key&&!e.isComposing){e.preventDefault();let t=e.target,i=parseInt(t.value.trim());if(isNaN(i)){t.value="";return}this._onSelect((0,tv.qE)(i,this.minSize,this.maxSize)),t.value="",this._onPopperClose()}},this.renderItemWithCheck=({name:e,value:t})=>{let i=this.size===t;return(0,L.qy)` this._onSelect(t)} > ${e??t} ${i?sm.Sr:L.s6} `},this.renderItemWithNormal=({name:e,value:t})=>(0,L.qy)` this._onSelect(t)} > ${e??t} `,this.#rS=ck(this,u,200),this.#rM=(ck(this,p),ck(this,f,1)),this.#rE=(ck(this,g),ck(this,m,void 0)),this.#ov=(ck(this,v),ck(this,y,void 0)),this.#eQ=(ck(this,b),ck(this,w,void 0)),this.#rI=(ck(this,x),ck(this,_,void 0)),this.#tW=(ck(this,C),ck(this,k,"normal")),ck(this,S)}static{ck(t,d)}})})();var cS=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},cM=function(e,t,i){for(var s=arguments.length>2,o=0;o"Light"],[tI.IT.Regular,()=>"Regular"],[tI.IT.SemiBold,()=>"Semibold"]],cB=[[tI.zz.Normal,()=>L.s6],[tI.zz.Italic,()=>"Italic"]],c$=[[tI.nO.Left,()=>G.VNq],[tI.nO.Center,()=>G.L0c],[tI.nO.Right,()=>G.Ui8]];function cT(e,t){let i=(0,sk.Tr)(e,e=>e instanceof tu.Q?"fontSize"===t?null:e[t]:e instanceof v.lw?e.labelStyle[t]:e[t]);return(0,sk.Sk)(Object.entries(i),([e,t])=>t)}function cO(e){let t=cT(e,"fontStyle");return t?t[0]:tI.zz.Normal}function cP(e){let t=cT(e,"fontWeight");return t?t[0]:tI.IT.Regular}function cH(e,t){return e instanceof v.lw?{labelStyle:{...e.labelStyle,...t}}:{...t}}(()=>{let e,t,i,s,o,r,a=[(0,D.EM)("edgeless-change-text-menu")],n=[],l=(0,P.Tm)(L.WF),c=[],d=[],h=[],u=[],f=[],m=[],y=[],b=[];(class extends l{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.P)("edgeless-color-picker-button.text-color")],cS(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:p},c,d),cS(this,null,s,{kind:"accessor",name:"elementType",static:!1,private:!1,access:{has:e=>"elementType"in e,get:e=>e.elementType,set:(e,t)=>{e.elementType=t}},metadata:p},h,u),cS(this,null,o,{kind:"accessor",name:"elements",static:!1,private:!1,access:{has:e=>"elements"in e,get:e=>e.elements,set:(e,t)=>{e.elements=t}},metadata:p},f,m),cS(this,null,r,{kind:"accessor",name:"textColorButton",static:!1,private:!1,access:{has:e=>"textColorButton"in e,get:e=>e.textColorButton,set:(e,t)=>{e.textColorButton=t}},metadata:p},y,b),cS(null,e={value:t},a,{kind:"class",name:t.name,metadata:p},null,n),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=(0,L.AH)` :host { display: inherit; align-items: inherit; justify-content: inherit; gap: inherit; height: 100%; } `}render(){let e=this.edgeless.surface.renderer.getColorScheme(),t=this.elements,i=function(e){let t=cT(e,"textAlign");return t?t[0]:tI.nO.Left}(t),s=function(e,t){let i=(0,sk.Tr)(e,e=>{let i=e instanceof v.lw?e.labelStyle.color:e.color;return"object"==typeof i?i[t]??i.normal??null:i}),s=(0,sk.Sk)(Object.entries(i),([e,t])=>t);return s?s[0]:tL()}(t,e),o=function(e){let t=cT(e,"fontFamily");return t?t[0]:tI.ay.Inter}(t),r=Math.trunc(function(e){let t=cT(e,"fontSize");return t?Number(t[0]):cE[0].value}(t)),a=cO(t),n=cP(t),l=(0,t7.e4)(o),c=1===l.length&&l[0].style===a&&l[0].weight===n;return(0,sj.f)([(0,L.qy)` Aa${G.eoI} `} > `,(0,lH.z)(this.edgeless.doc.awarenessStore.getFlag("enable_color_picker"),()=>{let{type:i,colors:o}=l5(e,s,t[0]instanceof v.lw?t[0].labelStyle.color:t[0].color);return(0,L.qy)` `},()=>(0,L.qy)` `} > `),(0,L.qy)` ${(0,rW.S)(n,cI)} ${(0,rW.S)(a,cB)} ${G.eoI} `} > `,"edgeless-text"===this.elementType?L.s6:(0,L.qy)` ${r} ${G.eoI} `} > `,(0,L.qy)` ${(0,rW.S)(i,c$)}${G.eoI} `} > `].filter(e=>e!==L.s6),an)}get service(){return this.edgeless.service}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#rB;get elementType(){return this.#rB}set elementType(e){this.#rB=e}#oB;get elements(){return this.#oB}set elements(e){this.#oB=e}#r$;get textColorButton(){return this.#r$}set textColorButton(e){this.#r$=e}constructor(){super(...arguments),this._setFontFamily=e=>{let t=cP(this.elements),i=(0,g.I)(e,t)?t:tI.IT.Regular,s=cO(this.elements),o=(0,g.r$)(e,s)?s:tI.zz.Normal,r={fontFamily:e,fontWeight:i,fontStyle:o};this.elements.forEach(e=>{this.service.updateElement(e.id,cH(e,r)),this._updateElementBound(e)})},this._setFontSize=e=>{let t={fontSize:e};this.elements.forEach(e=>{this.service.updateElement(e.id,cH(e,t)),this._updateElementBound(e)})},this._setFontWeightAndStyle=(e,t)=>{let i={fontWeight:e,fontStyle:t};this.elements.forEach(e=>{this.service.updateElement(e.id,cH(e,i)),this._updateElementBound(e)})},this._setTextAlign=e=>{let t={textAlign:e};this.elements.forEach(e=>{this.service.updateElement(e.id,cH(e,t))})},this._setTextColor=({detail:e})=>{let t={color:e};this.elements.forEach(e=>{this.service.updateElement(e.id,cH(e,t))})},this._updateElementBound=e=>{let t=this.elementType;if("text"===t&&e instanceof tB.n){let{text:t,fontFamily:i,fontStyle:s,fontSize:o,fontWeight:r,hasMaxWidth:a}=e,n=(0,g.JO)({yText:t,fontFamily:i,fontStyle:s,fontSize:o,fontWeight:r,hasMaxWidth:a},p.z.fromXYWH(e.deserializedXYWH));this.service.updateElement(e.id,{xywh:n.serialize()})}else if("connector"===t&&(0,tb.yp)(e)){let{text:t,labelXYWH:i,labelStyle:{fontFamily:s,fontStyle:o,fontSize:r,fontWeight:a},labelConstraints:{hasMaxWidth:n,maxWidth:l}}=e,c=p.z.fromXYWH(i||[0,0,16,16]),d=c.center,h=(0,g.JO)({yText:t,fontFamily:s,fontStyle:o,fontSize:r,fontWeight:a,hasMaxWidth:n,maxWidth:l},c);h.center=d,this.service.updateElement(e.id,{labelXYWH:h.toXYWH()})}else if("shape"===t&&e instanceof v.B5){let t=(0,v.dN)(e,p.z.fromXYWH(e.deserializedXYWH));this.service.updateElement(e.id,{xywh:t.serialize()})}},this.pickColor=e=>{if("pick"===e.type){this.elements.forEach(t=>{if(t instanceof v.lw){this.service.updateElement(t.id,{labelStyle:{...t.labelStyle,...l2("color",{...e.detail})}}),this._updateElementBound(t);return}this.service.updateElement(t.id,l2("color",{...e.detail})),this._updateElementBound(t)});return}let t="connector"===this.elementType?"labelStyle":"color";this.elements.forEach(i=>{i["start"===e.type?"stash":"pop"](t)})},this.#i_=cM(this,c,void 0),this.#rB=(cM(this,d),cM(this,h,void 0)),this.#oB=(cM(this,u),cM(this,f,void 0)),this.#r$=(cM(this,m),cM(this,y,void 0)),cM(this,b)}static{cM(t,n)}})})();var cA=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},cL=function(e,t,i){for(var s=arguments.length>2,o=0;oe[i]),o=(0,sk.Sk)(Object.entries(s),([e,t])=>t);return o?o[0]:null}let cZ=[{name:"General",value:!1,icon:G.$JY},{name:"Scribbled",value:!0,icon:G.tgi}],cj=[[!1,()=>G.$JY],[!0,()=>G.tgi]],cV=[{value:"None",icon:G.sGb},{value:"Arrow",icon:G.n4k},{value:"Triangle",icon:G.IRZ},{value:"Circle",icon:G.gZ8},{value:"Diamond",icon:G.wCH}],cz=[{value:"Diamond",icon:G.Hmh},{value:"Circle",icon:G.Bjt},{value:"Triangle",icon:G.vEB},{value:"Arrow",icon:G.YsG},{value:"None",icon:G.sGb}],cR=[{name:"Curve",icon:G.Rjd,value:v.B1.Curve},{name:"Elbowed",icon:G.CW5,value:v.B1.Orthogonal},{name:"Straight",icon:G._Uo,value:v.B1.Straight}],cF=[[v.B1.Curve,()=>G.Rjd],[v.B1.Orthogonal,()=>G.CW5],[v.B1.Straight,()=>G._Uo]];(()=>{let e,t,i,s,o,r=[(0,D.EM)("edgeless-change-connector-button")],a=[],n=(0,P.Tm)(L.WF),l=[],c=[],d=[],h=[],u=[],p=[];(class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.P)("edgeless-color-picker-button.stroke-color")],cA(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:f},l,c),cA(this,null,s,{kind:"accessor",name:"elements",static:!1,private:!1,access:{has:e=>"elements"in e,get:e=>e.elements,set:(e,t)=>{e.elements=t}},metadata:f},d,h),cA(this,null,o,{kind:"accessor",name:"strokeColorButton",static:!1,private:!1,access:{has:e=>"strokeColorButton"in e,get:e=>e.strokeColorButton,set:(e,t)=>{e.strokeColorButton=t}},metadata:f},u,p),cA(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f}),cL(t,a)}_addLabel(){iv(this.elements[0],this.edgeless)}_flipEndpointStyle(e,t){e!==t&&this.elements.forEach(i=>this.service.updateElement(i.id,{frontEndpointStyle:t,rearEndpointStyle:e}))}_getEndpointIcon(e,t){return e.find(({value:e})=>e===t)?.icon||G.sGb}_setConnectorColor(e){this._setConnectorProp("stroke",e)}_setConnectorMode(e){this._setConnectorProp("mode",e)}_setConnectorPointStyle(e,t){let i={[e===v.Re.Front?"frontEndpointStyle":"rearEndpointStyle"]:t};this.elements.forEach(e=>this.service.updateElement(e.id,{...i}))}_setConnectorProp(e,t){this.doc.captureSync(),this.elements.filter(i=>i[e]!==t).forEach(i=>this.service.updateElement(i.id,{[e]:t}))}_setConnectorRough(e){this._setConnectorProp("rough",e)}_setConnectorStroke({type:e,value:t}){if("size"===e){this._setConnectorStrokeWidth(t);return}this._setConnectorStrokeStyle(t)}_setConnectorStrokeStyle(e){this._setConnectorProp("strokeStyle",e)}_setConnectorStrokeWidth(e){this._setConnectorProp("strokeWidth",e)}_showAddButtonOrTextMenu(){return 1!==this.elements.length||this.elements[0].text?this.elements.some(e=>!e.text)?"nothing":"menu":"button"}render(){let e=this.edgeless.surface.renderer.getColorScheme(),t=this.elements,i=function(e,t){let i=(0,sk.Tr)(e,e=>"object"==typeof e.stroke?e.stroke[t]??e.stroke.normal??null:e.stroke),s=(0,sk.Sk)(Object.entries(i),([e,t])=>t);return s?s[0]:null}(t,e)??tL(),s=function(e){let t=(0,sk.Tr)(e,e=>e.mode),i=(0,sk.Sk)(Object.entries(t),([e,t])=>t);return i?Number(i[0]):null}(t),o=function(e){let t=(0,sk.Tr)(e,e=>e.strokeWidth),i=(0,sk.Sk)(Object.entries(t),([e,t])=>t);return i?Number(i[0]):e$.D9.Four}(t)??e$.D9.Four,r=function(e){let{trueCount:t,falseCount:i}=e.reduce((e,t)=>(t.rough?e.trueCount++:e.falseCount++,e),{trueCount:0,falseCount:0});return t>i}(t),a=function(e){let t=(0,sk.Tr)(e,e=>e.strokeStyle),i=(0,sk.Sk)(Object.entries(t),([e,t])=>t);return i?i[0]:null}(t)??v.u1.Solid,n=cD(t,v.Re.Front)??v.F7,l=cD(t,v.Re.Rear)??v.OM;return(0,sj.f)([(0,lH.z)(this.edgeless.doc.awarenessStore.getFlag("enable_color_picker"),()=>{let{type:s,colors:r}=l5(e,i,t[0].stroke);return(0,L.qy)`
${ce({selectedLineSize:o,selectedLineStyle:a,onClick:e=>this._setConnectorStroke(e),lineStyles:[v.u1.Solid,v.u1.Dash]})}
`},()=>(0,L.qy)` `} > this._setConnectorStroke(e)} .setStrokeColor=${e=>this._setConnectorColor(e.detail)} > `),(0,L.qy)` ${(0,rW.S)(r,cj)}${G.eoI} `} >
${(0,t$.u)(cZ,e=>e.name,({name:e,value:t,icon:i})=>(0,L.qy)` this._setConnectorRough(t)} > ${i} `)}
`,(0,L.qy)` ${this._getEndpointIcon(cV,n)}${G.eoI} `} >
${(0,t$.u)(cV,e=>e.value,({value:e,icon:t})=>(0,L.qy)` this._setConnectorPointStyle(v.Re.Front,e)} > ${t} `)}
this._flipEndpointStyle(n,l)} > ${G.M80} ${this._getEndpointIcon(cz,l)}${G.eoI} `} >
${(0,t$.u)(cz,e=>e.value,({value:e,icon:t})=>(0,L.qy)` this._setConnectorPointStyle(v.Re.Rear,e)} > ${t} `)}
${(0,rW.S)(s,cF)}${G.eoI} `} >
${(0,t$.u)(cR,e=>e.name,({name:e,value:t,icon:i})=>(0,L.qy)` this._setConnectorMode(t)} > ${i} `)}
`,(0,rW.S)(this._showAddButtonOrTextMenu(),[["button",()=>(0,L.qy)` ${G.Y2f} `],["menu",()=>(0,L.qy)` `],["nothing",()=>L.s6]])].filter(e=>e!==L.s6),an)}get doc(){return this.edgeless.doc}get service(){return this.edgeless.service}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#oB;get elements(){return this.#oB}set elements(e){this.#oB=e}#rT;get strokeColorButton(){return this.#rT}set strokeColorButton(e){this.#rT=e}constructor(){super(...arguments),this.pickColor=e=>{if("pick"===e.type){this.elements.forEach(t=>this.service.updateElement(t.id,l2("stroke",{...e.detail})));return}this.elements.forEach(t=>t["start"===e.type?"stash":"pop"]("stroke"))},this.#i_=cL(this,l,void 0),this.#oB=(cL(this,c),cL(this,d,[])),this.#rT=(cL(this,h),cL(this,u,void 0)),cL(this,p)}})})();var cN=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},cq=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("edgeless-change-embed-card-button")],n=[],l=(0,P.Tm)(L.WF),c=[],d=[],h=[],u=[],f=[],g=[],m=[],v=[];(class extends l{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],cN(this,null,i,{kind:"accessor",name:"_embedScale",static:!1,private:!1,access:{has:e=>"_embedScale"in e,get:e=>e._embedScale,set:(e,t)=>{e._embedScale=t}},metadata:p},c,d),cN(this,null,s,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:p},h,u),cN(this,null,o,{kind:"accessor",name:"model",static:!1,private:!1,access:{has:e=>"model"in e,get:e=>e.model,set:(e,t)=>{e.model=t}},metadata:p},f,g),cN(this,null,r,{kind:"accessor",name:"quickConnectButton",static:!1,private:!1,access:{has:e=>"quickConnectButton"in e,get:e=>e.quickConnectButton,set:(e,t)=>{e.quickConnectButton=t}},metadata:p},m,v),cN(null,e={value:t},a,{kind:"class",name:t.name,metadata:p},null,n),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=(0,L.AH)` .affine-link-preview { display: flex; justify-content: flex-start; width: 140px; padding: var(--1, 0px); border-radius: var(--1, 0px); opacity: var(--add, 1); user-select: none; cursor: pointer; color: var(--affine-link-color); font-feature-settings: 'clig' off, 'liga' off; font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 400; text-decoration: none; text-wrap: nowrap; } .affine-link-preview > span { display: inline-block; -webkit-line-clamp: 1; -webkit-box-orient: vertical; text-overflow: ellipsis; overflow: hidden; opacity: var(--add, 1); } `}get _blockComponent(){let e=this.edgeless.service.selection.surfaceSelections.filter(e=>e.elements.includes(this.model.id));if(1!==e.length)return;let t=this.std.view.getBlock(e[0].blockId);if(t)return t}get _canConvertToEmbedView(){let e=this._blockComponent;return(!(e&&(0,tE.C8)(e.model))||!!e.doc.awarenessStore.getFlag("enable_synced_doc_block"))&&(e&&"convertToEmbed"in e||this._embedOptions?.viewType==="embed")}get _canShowCardStylePanel(){return(0,tE.Cv)(this.model)||(0,tE.EG)(this.model)||(0,tE.C8)(this.model)}get _canShowFullScreenButton(){return(0,tE.MT)(this.model)}get _canShowUrlOptions(){return"url"in this.model&&((0,tE.Cv)(this.model)||(0,tE.EG)(this.model)||(0,tE.C8)(this.model))}get _doc(){return this.model.doc}get _embedViewButtonDisabled(){return!!this._doc.readonly||(0,tE.C8)(this.model)&&(!!this._blockComponent?.closest("affine-embed-synced-doc-block")||this.model.pageId===this._doc.id)}get _getCardStyleOptions(){let{EmbedCardHorizontalIcon:e,EmbedCardListIcon:t,EmbedCardVerticalIcon:i,EmbedCardCubeIcon:s}=(0,oT.Yr)();return[{style:"horizontal",Icon:e,tooltip:"Large horizontal style"},{style:"list",Icon:t,tooltip:"Small horizontal style"},{style:"vertical",Icon:i,tooltip:"Large vertical style"},{style:"cube",Icon:s,tooltip:"Small vertical style"}]}get _isCardView(){return!!((0,tE.Cv)(this.model)||(0,tE.C8)(this.model))||this._embedOptions?.viewType==="card"}get _isEmbedView(){return!(0,tE.Cv)(this.model)&&((0,tE.v8)(this.model)||this._embedOptions?.viewType==="embed")}get _openButtonDisabled(){return(0,tE.C8)(this.model)&&this.model.pageId===this._doc.id}_openMenuButton(){let e=[];return((0,tE.C8)(this.model)||(0,tE.v8)(this.model)?e.push({name:"Open this doc",icon:G.UYC,handler:this._open,disabled:this._openButtonDisabled}):this._canShowFullScreenButton&&e.push({name:"Open this doc",icon:G.UYC,handler:this._open}),this._blockComponent&&(0,U.mV)(this._blockComponent)&&e.push({name:"Open in center peek",icon:G.KRn,handler:()=>this._peek()}),0===e.length)?L.s6:(0,L.qy)` ${G.gb9}${G.eoI} `} >
${(0,t$.u)(e,e=>e.name,({name:e,icon:t,handler:i,disabled:s})=>(0,L.qy)` ${t}${e} `)}
`}get _rootService(){return this.std.spec.getService("affine:page")}_setCardStyle(e){let t=p.z.deserialize(this.model.xywh);t.w=eh.Cd[e],t.h=eh.Hn[e];let i=t.serialize();this.model.doc.updateBlock(this.model,{style:e,xywh:i})}_setEmbedScale(e){if((0,tE.MT)(this.model))return;let t=p.z.deserialize(this.model.xywh);if("scale"in this.model){let i=e/(this.model.scale??1);t.w*=i,t.h*=i;let s=t.serialize();this.model.doc.updateBlock(this.model,{scale:e,xywh:s})}else{t.h=eh.Hn[this.model.style]*e,t.w=eh.Cd[this.model.style]*e;let i=t.serialize();this.model.doc.updateBlock(this.model,{xywh:i})}this._embedScale=e}_showCaption(){this._blockComponent?.captionEditor?.show()}_viewMenuButton(){if(this._canConvertToEmbedView||this._isEmbedView){let e=[{type:"card",name:"Card view",handler:()=>this._convertToCardView(),disabled:this.model.doc.readonly},{type:"embed",name:"Embed view",handler:()=>this._convertToEmbedView(),disabled:this.model.doc.readonly&&this._embedViewButtonDisabled}];return(0,L.qy)`
${this._viewType} view
${G.eoI} `} >
${(0,t$.u)(e,e=>e.type,({type:e,name:t,handler:i,disabled:s})=>(0,L.qy)` ${t} `)}
`}return L.s6}get _viewType(){return this._isCardView?"card":this._isEmbedView?"embed":"inline"}get std(){return this.edgeless.std}connectedCallback(){super.connectedCallback(),this._embedScale=this._getScale()}render(){let e=this.model;"url"in this.model&&(this._embedOptions=this._rootService.getEmbedBlockOptions(this.model.url));let t=[this._canShowUrlOptions&&"url"in e?(0,L.qy)` ${(0,oT.yz)(e.url)} ${G.TdU} s1(this.std.host,e)} > ${G.qUP} `:L.s6,this._openMenuButton(),this._viewMenuButton(),"style"in e&&this._canShowCardStylePanel?(0,L.qy)` ${G.v1n} `} > this._setCardStyle(e)} > `:L.s6,"caption"in e?(0,L.qy)` ${G.ITz} `:L.s6,this.quickConnectButton,(0,tE.MT)(e)?L.s6:(0,L.qy)` ${Math.round(100*this._embedScale)+"%"} ${G.eoI} `} > this._setEmbedScale(e)} > `];return(0,sj.f)(t.filter(e=>e!==L.s6),an)}#rO;get _embedScale(){return this.#rO}set _embedScale(e){this.#rO=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#iJ;get model(){return this.#iJ}set model(e){this.#iJ=e}#rP;get quickConnectButton(){return this.#rP}set quickConnectButton(e){this.#rP=e}constructor(){super(...arguments),this._convertToCardView=()=>{if(this._isCardView)return;let e=this._blockComponent;if(e&&"convertToCard"in e){e.convertToCard();return}if(!("url"in this.model))return;let{id:t,url:i,xywh:s,style:o,caption:r}=this.model,a="affine:bookmark",n=o;if(this._embedOptions&&"card"===this._embedOptions.viewType){let{flavour:e,styles:t}=this._embedOptions;a=e,n=t.includes(o)?o:t[0]}else n=ah.HO.includes(o)?o:ah.HO[0];let l=p.z.deserialize(s);l.w=eh.Cd[n],l.h=eh.Hn[n];let c=this.edgeless.service.addBlock(a,{url:i,xywh:l.serialize(),style:n,caption:r},this.edgeless.surface.model);this.std.command.exec("reassociateConnectors",{oldId:t,newId:c}),this.edgeless.service.selection.set({editing:!1,elements:[c]}),this._doc.deleteBlock(this.model)},this._convertToEmbedView=()=>{if(this._isEmbedView)return;let e=this._blockComponent;if(e&&"convertToEmbed"in e){e.convertToEmbed();return}if(!("url"in this.model)||!this._embedOptions)return;let{flavour:t,styles:i}=this._embedOptions,{id:s,url:o,xywh:r,style:a}=this.model,n=i.includes(a)?a:i[0],l=p.z.deserialize(r);l.w=eh.Cd[n],l.h=eh.Hn[n];let c=this.edgeless.service.addBlock(t,{url:o,xywh:l.serialize(),style:n},this.edgeless.surface.model);this.std.command.exec("reassociateConnectors",{oldId:s,newId:c}),this.edgeless.service.selection.set({editing:!1,elements:[c]}),this._doc.deleteBlock(this.model)},this._copyUrl=()=>{"url"in this.model&&(navigator.clipboard.writeText(this.model.url).catch(console.error),(0,e5.o)(this.std.host,"Copied link to clipboard"),this.edgeless.service.selection.clear())},this._embedOptions=null,this._getScale=()=>"scale"in this.model?this.model.scale??1:(0,tE.MT)(this.model)?1:p.z.deserialize(this.model.xywh).h/eh.Hn[this.model.style],this._open=()=>{this._blockComponent?.open()},this._peek=()=>{this._blockComponent&&(0,U.se)(this._blockComponent)},this.#rO=cq(this,c,1),this.#i_=(cq(this,d),cq(this,h,void 0)),this.#iJ=(cq(this,u),cq(this,f,void 0)),this.#rP=(cq(this,g),cq(this,m,void 0)),cq(this,v)}static{cq(t,n)}})})();var cU=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},cW=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("edgeless-change-frame-button")],a=[],n=(0,P.Tm)(L.WF),l=[],c=[],d=[],u=[],p=[],f=[];(class extends n{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.P)("edgeless-color-picker-button.background")],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],cU(this,null,i,{kind:"accessor",name:"backgroundButton",static:!1,private:!1,access:{has:e=>"backgroundButton"in e,get:e=>e.backgroundButton,set:(e,t)=>{e.backgroundButton=t}},metadata:h},l,c),cU(this,null,s,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:h},d,u),cU(this,null,o,{kind:"accessor",name:"frames",static:!1,private:!1,access:{has:e=>"frames"in e,get:e=>e.frames,set:(e,t)=>{e.frames=t}},metadata:h},p,f),cU(null,e={value:t},r,{kind:"class",name:t.name,metadata:h},null,a),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h}),cW(t,a)}_insertIntoPage(){if(!this.edgeless.doc.root)return;let e=this.edgeless.doc.root,t=e.children.filter(e=>(0,tf.o)(e,["affine:note"])&&e.displayMode!==e$.ko.EdgelessOnly),i=t[t.length-1],s=this.frames[0],o=i?.id;if(!i){let t=(0,h.W)(s.xywh);t[1]=t[1]+t[3],t[3]=72,o=this.edgeless.doc.addBlock("affine:note",{xywh:(0,h.P)(...t)},e.id)}this.edgeless.doc.addBlock("affine:surface-ref",{reference:this.frames[0].id,refFlavour:"affine:frame"},o),(0,e5.o)(this.edgeless.host,"Frame has been inserted into doc")}_setFrameBackground(e){this.frames.forEach(t=>{this.service.updateElement(t.id,{background:e})})}render(){let{frames:e}=this,t=1===e.length,i=this.edgeless.surface.renderer.getColorScheme(),s=function(e,t){let i=(0,sk.Tr)(e,e=>"object"==typeof e.background?e.background[t]??e.background.normal??null:e.background),s=(0,sk.Sk)(Object.entries(i),([e,t])=>t);return s?s[0]:null}(e,i)??"--affine-palette-transparent";return(0,sj.f)([t?(0,L.qy)` ${G.Qvf} Insert into Page `:L.s6,t?(0,L.qy)` ip(this.frames[0],this.edgeless)} > ${G.CFr} `:L.s6,(0,lH.z)(this.edgeless.doc.awarenessStore.getFlag("enable_color_picker"),()=>{let{type:e,colors:t}=l5(i,s,this.frames[0].background);return(0,L.qy)` `},()=>(0,L.qy)` `} > this._setFrameBackground(e.detail)} > `)].filter(e=>e!==L.s6),an)}get service(){return this.edgeless.service}#rH;get backgroundButton(){return this.#rH}set backgroundButton(e){this.#rH=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#rA;get frames(){return this.#rA}set frames(e){this.#rA=e}constructor(){super(...arguments),this.pickColor=e=>{if("pick"===e.type){this.frames.forEach(t=>this.service.updateElement(t.id,l2("background",{...e.detail})));return}this.frames.forEach(t=>t["start"===e.type?"stash":"pop"]("background"))},this.#rH=cW(this,l,void 0),this.#i_=(cW(this,c),cW(this,d,void 0)),this.#rA=(cW(this,u),cW(this,p,[])),cW(this,f)}})})();var cY=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},cK=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("edgeless-change-group-button")],r=[],a=(0,P.Tm)(L.WF),n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],cY(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:h},n,l),cY(this,null,s,{kind:"accessor",name:"groups",static:!1,private:!1,access:{has:e=>"groups"in e,get:e=>e.groups,set:(e,t)=>{e.groups=t}},metadata:h},c,d),cY(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h}),cK(t,r)}_insertIntoPage(){if(!this.edgeless.doc.root)return;let e=this.edgeless.doc.root,t=e.children.filter(e=>(0,tf.o)(e,["affine:note"])&&e.displayMode!==e$.ko.EdgelessOnly),i=t[t.length-1],s=this.groups[0],o=i?.id;if(!i){let t=(0,h.W)(s.xywh);t[1]=t[1]+t[3],t[3]=72,o=this.edgeless.doc.addBlock("affine:note",{xywh:(0,h.P)(...t)},e.id)}this.edgeless.doc.addBlock("affine:surface-ref",{reference:this.groups[0].id,refFlavour:"group"},o),(0,e5.o)(this.edgeless.host,"Group has been inserted into page")}render(){let{groups:e}=this,t=1===e.length;return(0,sj.f)([t?(0,L.qy)` ${G.Qvf} Insert into Page `:L.s6,t?(0,L.qy)` ig(e[0],this.edgeless)} > ${G.CFr} `:L.s6,(0,L.qy)` e.forEach(e=>this.edgeless.service.ungroup(e))} > ${G.CiQ} `].filter(e=>e!==L.s6),an)}#i_=cK(this,n,void 0);get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#M=(cK(this,l),cK(this,c,void 0));get groups(){return this.#M}set groups(e){this.#M=e}constructor(){super(...arguments),cK(this,d)}})})();let cX=(0,L.qy)` `,cQ=(0,L.qy)` `,cJ=(0,L.qy)` `;var c1=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},c0=function(e,t,i){for(var s=arguments.length>2,o=0;o ${s}
${e} ${t} ${i?(0,L.qy)`${i}`:""}
`}function c5(e){return new Promise(t=>{let i={width:0,height:0},s=new Image;s.onload=()=>{i.width=s.width,i.height=s.height,URL.revokeObjectURL(s.src),t(i)},s.onerror=()=>{URL.revokeObjectURL(s.src),t(i)},s.src=URL.createObjectURL(e)})}(()=>{let e,t,i=[(0,D.EM)("affine-image-block-card")],s=[],o=(0,P.Tm)(P.ao),r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;c1(this,null,[(0,D.MZ)({attribute:!1})],{kind:"accessor",name:"block",static:!1,private:!1,access:{has:e=>"block"in e,get:e=>e.block,set:(e,t)=>{e.block=t}},metadata:n},r,a),c1(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` .affine-image-block-card-container { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; } .affine-image-block-card { display: flex; flex-direction: column; justify-content: space-between; background-color: var(--affine-background-secondary-color, #f4f4f5); border-radius: 8px; border: 1px solid var(--affine-background-tertiary-color, #eee); padding: 12px; } .affine-image-block-card-content { display: flex; align-items: center; gap: 8px; color: var(--affine-placeholder-color); text-align: justify; font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 600; line-height: var(--affine-line-height); user-select: none; } .affine-image-card-size { overflow: hidden; padding-top: 12px; color: var(--affine-text-secondary-color); text-overflow: ellipsis; font-size: 10px; font-style: normal; font-weight: 400; line-height: 20px; user-select: none; } `}render(){let{isInSurface:e,loading:t,error:i,model:s}=this.block,o=e?s.rotate:0,r=(0,Z.W)({transform:`rotate(${o}deg)`,transformOrigin:"center",width:e?"220px":"752px",height:e?"122px":"78px"}),a=s.size&&s.size>0?(0,tv.bn)(s.size,!0,0):null;return(0,L.qy)`
${t?cX:i?cJ:cQ} ${t?"Loading image...":i?"Image loading failed.":"Image"}
${a}
`}#T=c0(this,r,void 0);get block(){return this.#T}set block(e){this.#T=e}constructor(){super(...arguments),c0(this,a)}static{c0(t,s)}})})();let c7=["ew","nwse","ns","nesw"];function c3(e,t=!1,i=220,s=122){return t?new p.z(e[0],e[1],i,s):p.z.fromCenter(e,i,s)}let c4=new Set;async function c6(e,t,i){let s;if(c4.has(t)){console.error("The image is already uploading!");return}c4.add(t);let o=e.doc;try{s=await o.blobSync.set(i)}catch(t){console.error(t),t instanceof Error&&(0,e5.o)(e,`Failed to upload image! ${t.message||t.toString()}`)}finally{c4.delete(t);let e=o.getBlockById(t);o.withoutTransact(()=>{e&&o.updateBlock(e,{sourceId:s})})}}async function c8(e){let t=e.sourceId;if(!t)return null;let s=e.doc,o=await s.blobSync.get(t);if(!o)return null;if(!o.type){let e=await o.arrayBuffer(),t=await Promise.resolve().then(i.bind(i,81208)),s=await t.fileTypeFromBuffer(e);return s?.mime.startsWith("image/")?new Blob([e],{type:s.mime}):null}return o.type.startsWith("image/")?o:null}async function c9(e){try{if(e.model.sourceId===e.lastSourceId&&e.blobUrl){if(e.blobUrl)return}else e.loading=!0,e.error=!1,e.blob=void 0,e.blobUrl&&(URL.revokeObjectURL(e.blobUrl),e.blobUrl=void 0);let{model:t}=e,{id:i,sourceId:s,doc:o}=t;if(c4.has(i)||!s)return;let r=await o.blobSync.get(s);if(!r)return;e.loading=!1,e.blob=r,e.blobUrl=URL.createObjectURL(r),e.lastSourceId=s}catch(t){e.retryCount++,console.warn(`${t}, retrying`,e.retryCount),e.retryCount<3?setTimeout(()=>{c9(e).catch(console.error)},1e3*e.retryCount):(e.loading=!1,e.error=!0)}}async function de(e){let{host:t,downloading:i}=e;if(i){(0,e5.o)(t,"Download in progress...");return}e.downloading=!0;let s=await c8(e.model);if(!s){(0,e5.o)(t,"Unable to download image!");return}(0,e5.o)(t,"Downloading image..."),(0,lb.WN)(s,"image"),e.downloading=!1}async function dt(e){let{blob:t,model:i}=e;if(!t)return;let s=new File([t],"image.png",{type:t.type}),o=await c5(s);e.doc.updateBlock(i,{width:o.width,height:o.height})}async function di(e){let{host:t,model:i}=e,s=await c8(i);if(!s){console.error("Failed to get image blob");return}try{var o,r;if(window.apis?.clipboard?.copyAsImageFromString){let e=await (o=s,new Promise(e=>{let t=new FileReader;t.addEventListener("load",i=>e(t.result)),t.addEventListener("error",()=>e(null)),t.readAsDataURL(o)}));if(!e)throw new c.Ss(d.O.DefaultRuntimeError,"Cant convert a blob to data URL.");await window.apis.clipboard?.copyAsImageFromString(e)}else{if("image/png"!==s.type){let e=await (r=s,new Promise(e=>{let t=new FileReader;t.addEventListener("load",i=>{let s=new Image;s.onload=()=>{let t=document.createElement("canvas");t.width=s.width,t.height=s.height;let i=t.getContext("2d");i&&(i.drawImage(s,0,0),t.toBlob(e,"image/png"))},s.onerror=()=>e(null),s.src=t.result}),t.addEventListener("error",()=>e(null)),t.readAsDataURL(r)}));if(!e){console.error("Failed to convert blob to PNG");return}s=e}if(!globalThis.isSecureContext){console.error("Clipboard API is not available in insecure context",s.type,s);return}await navigator.clipboard.write([new ClipboardItem({[s.type]:s})])}(0,e5.o)(t,"Copied image to clipboard")}catch(e){console.error(e)}}function ds(e,t,i,s,o="after"){let r=t.filter(e=>e.type.startsWith("image/"));if(!r.length)return;if(r.some(e=>e.size>i)){(0,e5.o)(e,`You can only upload files less than ${(0,tv.bn)(i,!0,0)}`);return}let a=r.map(e=>({flavour:"affine:image",size:e.size})),n=e.doc.addSiblingBlocks(s,a,o);return n.map((t,i)=>void c6(e,t,r[i])),n}async function dr(e){if(!e.doc.schema.flavourSchemaMap.has("affine:attachment")){console.error("The attachment flavour is not supported!");return}let t=e.model,i=t.sourceId,s=await c8(t);if(!i||!s){console.error("Image data not available");return}let{saveImageData:o,getAttachmentData:r}=(0,lb.YF)();o(i,{width:t.width,height:t.height});let a=r(i),n={sourceId:i,name:"affine-attachment",size:s.size,type:s.type,caption:t.caption,...a};lw(t,"affine:attachment",n)}var da=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},dn=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("edgeless-change-image-button")],r=[],a=(0,P.Tm)(L.WF),n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],da(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:h},n,l),da(this,null,s,{kind:"accessor",name:"model",static:!1,private:!1,access:{has:e=>"model"in e,get:e=>e.model,set:(e,t)=>{e.model=t}},metadata:h},c,d),da(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h}),dn(t,r)}get _blockComponent(){let e=this.edgeless.service.selection.surfaceSelections.filter(e=>e.elements.includes(this.model.id));if(1===e.length)return this.edgeless.std.view.getBlock(e[0].blockId)}get _doc(){return this.model.doc}render(){return(0,L.qy)` ${sv.s3} ${sv.IT} `}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#iJ;get model(){return this.#iJ}set model(e){this.#iJ=e}constructor(){super(...arguments),this._download=()=>{this._blockComponent&&de(this._blockComponent).catch(console.error)},this._showCaption=()=>{this._blockComponent?.captionEditor?.show()},this.#i_=dn(this,n,void 0),this.#iJ=(dn(this,l),dn(this,c,void 0)),dn(this,d)}})})();var dl=i(54074),dc=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},dd=function(e,t,i){for(var s=arguments.length>2,o=0;o{"mindmap"===t.type&&i.push(t);let s=e.service.surface.getGroup(t.id);s?.type==="mindmap"&&i.push(s)}),0===i.length)?L.s6:(0,L.qy)` "shape"===e.type)} .edgeless=${e} > `}(()=>{let e,t,i,s,o=[(0,D.EM)("edgeless-change-mindmap-style-panel")],r=[],a=L.WF,n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],dc(this,null,i,{kind:"accessor",name:"mindmapStyle",static:!1,private:!1,access:{has:e=>"mindmapStyle"in e,get:e=>e.mindmapStyle,set:(e,t)=>{e.mindmapStyle=t}},metadata:h},n,l),dc(this,null,s,{kind:"accessor",name:"onSelect",static:!1,private:!1,access:{has:e=>"onSelect"in e,get:e=>e.onSelect,set:(e,t)=>{e.onSelect=t}},metadata:h},c,d),dc(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` :host { display: flex; align-items: center; justify-content: center; flex-direction: row; gap: 8px; background: var(--affine-background-overlay-panel-color); } .style-item { border-radius: 4px; } .style-item > svg { vertical-align: middle; } .style-item.active, .style-item:hover { cursor: pointer; background-color: var(--affine-hover-color); } `}render(){return(0,t$.u)(dh,e=>e.value,({value:e,icon:t})=>(0,L.qy)`
this.onSelect(e)} > ${t}
`)}#rL=dd(this,n,void 0);get mindmapStyle(){return this.#rL}set mindmapStyle(e){this.#rL=e}#ov=(dd(this,l),dd(this,c,void 0));get onSelect(){return this.#ov}set onSelect(e){this.#ov=e}constructor(){super(...arguments),dd(this,d)}static{dd(t,r)}})})(),(()=>{let e,t,i,s,o=[(0,D.EM)("edgeless-change-mindmap-layout-panel")],r=[],a=L.WF,n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],dc(this,null,i,{kind:"accessor",name:"mindmapLayout",static:!1,private:!1,access:{has:e=>"mindmapLayout"in e,get:e=>e.mindmapLayout,set:(e,t)=>{e.mindmapLayout=t}},metadata:h},n,l),dc(this,null,s,{kind:"accessor",name:"onSelect",static:!1,private:!1,access:{has:e=>"onSelect"in e,get:e=>e.onSelect,set:(e,t)=>{e.onSelect=t}},metadata:h},c,d),dc(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` :host { display: flex; align-items: center; justify-content: center; flex-direction: row; gap: 8px; } `}render(){return(0,t$.u)(du,e=>e.value,({name:e,value:t,icon:i})=>(0,L.qy)` this.onSelect(t)} > ${i} `)}#rD=dd(this,n,void 0);get mindmapLayout(){return this.#rD}set mindmapLayout(e){this.#rD=e}#ov=(dd(this,l),dd(this,c,void 0));get onSelect(){return this.#ov}set onSelect(e){this.#ov=e}constructor(){super(...arguments),dd(this,d)}static{dd(t,r)}})})(),(()=>{let e,t,i,s,o,r,a=[(0,D.EM)("edgeless-change-mindmap-button")],n=[],l=(0,P.Tm)(L.WF),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.wk)()],r=[(0,D.MZ)({attribute:!1})],dc(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:v},c,d),dc(this,null,s,{kind:"accessor",name:"elements",static:!1,private:!1,access:{has:e=>"elements"in e,get:e=>e.elements,set:(e,t)=>{e.elements=t}},metadata:v},h,u),dc(this,null,o,{kind:"accessor",name:"layoutType",static:!1,private:!1,access:{has:e=>"layoutType"in e,get:e=>e.layoutType,set:(e,t)=>{e.layoutType=t}},metadata:v},p,f),dc(this,null,r,{kind:"accessor",name:"nodes",static:!1,private:!1,access:{has:e=>"nodes"in e,get:e=>e.nodes,set:(e,t)=>{e.nodes=t}},metadata:v},g,m),dc(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v}),dd(t,n)}_getCommonLayoutType(){let e=(0,sk.Tr)(this.elements,e=>e.layoutType),t=(0,sk.Sk)(Object.entries(e),([e,t])=>t);return t?Number(t[0]):tx.p5.BALANCE}_getCommonStyle(){let e=(0,sk.Tr)(this.elements,e=>e.style),t=(0,sk.Sk)(Object.entries(e),([e,t])=>t);return t?Number(t[0]):dl.cy.ONE}_isSubnode(){return 1===this.nodes.length&&this.nodes[0].group.tree.element!==this.nodes[0]}get _mindmaps(){let e=new Set;return this.elements.reduce((t,i)=>(e.add(i),e),e)}render(){return(0,sj.f)([(0,L.qy)` ${sm.z4}${sm.eo} `} > `,this._isSubnode()?L.s6:(0,L.qy)` ${this.layout.icon}${sm.eo} `} > `].filter(e=>e!==L.s6),an)}get layout(){let e=this.layoutType??this._getCommonLayoutType();return du.find(t=>t.value===e)}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#oB;get elements(){return this.#oB}set elements(e){this.#oB=e}#rZ;get layoutType(){return this.#rZ}set layoutType(e){this.#rZ=e}#rj;get nodes(){return this.#rj}set nodes(e){this.#rj=e}constructor(){super(...arguments),this._updateLayoutType=e=>{this.elements.forEach(t=>{t.layoutType=e,t.layout()}),this.layoutType=e},this._updateStyle=e=>{this._mindmaps.forEach(t=>t.style=e)},this.#i_=dd(this,c,void 0),this.#oB=(dd(this,d),dd(this,h,void 0)),this.#rZ=(dd(this,u),dd(this,p,void 0)),this.#rj=(dd(this,f),dd(this,g,void 0)),dd(this,m)}})})();var df=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},dg=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("note-display-mode-panel")],a=[],n=(0,P.Tm)(L.WF),l=[],c=[],d=[],h=[],u=[],p=[];(class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],df(this,null,i,{kind:"accessor",name:"displayMode",static:!1,private:!1,access:{has:e=>"displayMode"in e,get:e=>e.displayMode,set:(e,t)=>{e.displayMode=t}},metadata:f},l,c),df(this,null,s,{kind:"accessor",name:"onSelect",static:!1,private:!1,access:{has:e=>"onSelect"in e,get:e=>e.onSelect,set:(e,t)=>{e.onSelect=t}},metadata:f},d,h),df(this,null,o,{kind:"accessor",name:"panelWidth",static:!1,private:!1,access:{has:e=>"panelWidth"in e,get:e=>e.panelWidth,set:(e,t)=>{e.panelWidth=t}},metadata:f},u,p),df(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` :host { display: flex; flex-direction: column; align-items: flex-start; min-width: 180px; width: var(--panel-width); gap: 4px; } .item { display: flex; align-items: center; width: 100%; height: 30px; padding: 4px 12px; border-radius: 4px; gap: 4px; box-sizing: border-box; cursor: pointer; } .item-label { flex: 1 1 0; } .item-icon { display: flex; justify-content: center; align-items: center; gap: 4px; color: var(--affine-icon-color); } .item:hover, .item.selected { background-color: var(--affine-hover-color); } `}_DisplayModeIcon(e){switch(e){case e$.ko.DocAndEdgeless:return(0,L.qy)`${sm.v_} ${sm.ID}`;case e$.ko.DocOnly:return(0,L.qy)`${sm.v_}`;case e$.ko.EdgelessOnly:return(0,L.qy)`${sm.ID}`}}_DisplayModeLabel(e){switch(e){case e$.ko.DocAndEdgeless:return"In Both";case e$.ko.DocOnly:return"In Page Only";case e$.ko.EdgelessOnly:return"In Edgeless Only"}}render(){return this.style.setProperty("--panel-width",`${this.panelWidth}px`),(0,t$.u)(Object.keys(e$.ko),e=>e,e=>{let t=e$.ko[e],i=t===this.displayMode;return(0,L.qy)`
this.onSelect(t)} @dblclick=${sy.dG} @pointerdown=${sy.dG} >
${this._DisplayModeLabel(t)}
${this._DisplayModeIcon(t)}
`})}#rV=dg(this,l,void 0);get displayMode(){return this.#rV}set displayMode(e){this.#rV=e}#ov=(dg(this,c),dg(this,d,void 0));get onSelect(){return this.#ov}set onSelect(e){this.#ov=e}#rz=(dg(this,h),dg(this,u,240));get panelWidth(){return this.#rz}set panelWidth(e){this.#rz=e}constructor(){super(...arguments),dg(this,p)}static{dg(t,a)}})})();var dm=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},dv=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("edgeless-note-shadow-panel")],a=[],n=(0,P.Tm)(L.WF),l=[],c=[],d=[],h=[],u=[],p=[];(class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],dm(this,null,i,{kind:"accessor",name:"background",static:!1,private:!1,access:{has:e=>"background"in e,get:e=>e.background,set:(e,t)=>{e.background=t}},metadata:f},l,c),dm(this,null,s,{kind:"accessor",name:"onSelect",static:!1,private:!1,access:{has:e=>"onSelect"in e,get:e=>e.onSelect,set:(e,t)=>{e.onSelect=t}},metadata:f},d,h),dm(this,null,o,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:f},u,p),dm(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` :host { display: flex; align-items: center; justify-content: space-between; gap: 8px; } .item { padding: 8px; border-radius: 4px; display: flex; justify-content: center; align-items: center; cursor: pointer; } .item-icon { display: flex; justify-content: center; align-items: center; } .item:hover { background-color: var(--affine-hover-color); } `}render(){let e="dark"===j.Q.mode?db:dy;return(0,t$.u)(W.LS,e=>e,(t,i)=>(0,L.qy)`
this.onSelect(t)} style=${(0,Z.W)({border:this.value===t?"1px solid var(--affine-brand-color)":"none"})} > ${0===i?sm.vq:sm.Yg}
`)}#rR=dv(this,l,void 0);get background(){return this.#rR}set background(e){this.#rR=e}#ov=(dv(this,c),dv(this,d,void 0));get onSelect(){return this.#ov}set onSelect(e){this.#ov=e}#eJ=(dv(this,h),dv(this,u,void 0));get value(){return this.#eJ}set value(e){this.#eJ=e}constructor(){super(...arguments),dv(this,p)}static{dv(t,a)}})})();var dx=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},d_=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("edgeless-scale-panel")],c=[],d=L.WF,h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];(class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],dx(this,null,i,{kind:"accessor",name:"maxScale",static:!1,private:!1,access:{has:e=>"maxScale"in e,get:e=>e.maxScale,set:(e,t)=>{e.maxScale=t}},metadata:C},h,u),dx(this,null,s,{kind:"accessor",name:"minScale",static:!1,private:!1,access:{has:e=>"minScale"in e,get:e=>e.minScale,set:(e,t)=>{e.minScale=t}},metadata:C},p,f),dx(this,null,o,{kind:"accessor",name:"onPopperCose",static:!1,private:!1,access:{has:e=>"onPopperCose"in e,get:e=>e.onPopperCose,set:(e,t)=>{e.onPopperCose=t}},metadata:C},g,m),dx(this,null,r,{kind:"accessor",name:"onSelect",static:!1,private:!1,access:{has:e=>"onSelect"in e,get:e=>e.onSelect,set:(e,t)=>{e.onSelect=t}},metadata:C},v,y),dx(this,null,a,{kind:"accessor",name:"scale",static:!1,private:!1,access:{has:e=>"scale"in e,get:e=>e.scale,set:(e,t)=>{e.scale=t}},metadata:C},b,w),dx(this,null,n,{kind:"accessor",name:"scaleList",static:!1,private:!1,access:{has:e=>"scaleList"in e,get:e=>e.scaleList,set:(e,t)=>{e.scaleList=t}},metadata:C},x,_),dx(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}static{this.styles=(0,L.AH)` :host { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 68px; } edgeless-tool-icon-button { align-self: stretch; } .scale-input { display: flx; align-self: stretch; border: 0.5px solid var(--affine-border-color); border-radius: 8px; padding: 4px 8px; box-sizing: border-box; } .scale-input::placeholder { color: var(--affine-placeholder-color); } .scale-input:focus { outline-color: var(--affine-primary-color); outline-width: 0.5px; } `}_onPopperClose(){this.onPopperCose?.()}_onSelect(e){this.onSelect?.(e/100)}render(){var e;return(0,L.qy)` ${(0,t$.u)(this.scaleList,e=>e,e=>(0,L.qy)`this._onSelect(e)} > ${`${e}%`} `)} `}#rF;get maxScale(){return this.#rF}set maxScale(e){this.#rF=e}#rN;get minScale(){return this.#rN}set minScale(e){this.#rN=e}#rE;get onPopperCose(){return this.#rE}set onPopperCose(e){this.#rE=e}#ov;get onSelect(){return this.#ov}set onSelect(e){this.#ov=e}#rq;get scale(){return this.#rq}set scale(e){this.#rq=e}#rU;get scaleList(){return this.#rU}set scaleList(e){this.#rU=e}constructor(){super(...arguments),this._onKeydown=e=>{if(e.stopPropagation(),"Enter"===e.key&&!e.isComposing){e.preventDefault();let t=e.target,i=parseInt(t.value.trim());if(isNaN(i)){t.value="";return}this._onSelect((0,tv.qE)(i,this.minScale,this.maxScale)),t.value="",this._onPopperClose()}},this.#rF=d_(this,h,400),this.#rN=(d_(this,u),d_(this,p,0)),this.#rE=(d_(this,f),d_(this,g,void 0)),this.#ov=(d_(this,m),d_(this,v,void 0)),this.#rq=(d_(this,y),d_(this,b,void 0)),this.#rU=(d_(this,w),d_(this,x,dC)),d_(this,_)}static{d_(t,c)}})})();var dk=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},dS=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n=[(0,D.EM)("edgeless-change-note-button")],l=[],c=(0,P.Tm)(L.WF),d=[],h=[],u=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[];(class extends c{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.P)("edgeless-color-picker-button.background")],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],dk(this,null,i,{kind:"accessor",name:"backgroundButton",static:!1,private:!1,access:{has:e=>"backgroundButton"in e,get:e=>e.backgroundButton,set:(e,t)=>{e.backgroundButton=t}},metadata:p},d,h),dk(this,null,s,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:p},u,f),dk(this,null,o,{kind:"accessor",name:"enableNoteSlicer",static:!1,private:!1,access:{has:e=>"enableNoteSlicer"in e,get:e=>e.enableNoteSlicer,set:(e,t)=>{e.enableNoteSlicer=t}},metadata:p},g,m),dk(this,null,r,{kind:"accessor",name:"notes",static:!1,private:!1,access:{has:e=>"notes"in e,get:e=>e.notes,set:(e,t)=>{e.notes=t}},metadata:p},v,y),dk(this,null,a,{kind:"accessor",name:"quickConnectButton",static:!1,private:!1,access:{has:e=>"quickConnectButton"in e,get:e=>e.quickConnectButton,set:(e,t)=>{e.quickConnectButton=t}},metadata:p},b,w),dk(null,e={value:t},n,{kind:"class",name:t.name,metadata:p},null,l),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p}),dS(t,l)}_getScaleLabel(e){return Math.round(100*e)+"%"}_handleNoteSlicerButtonClick(){this.edgeless.service&&this.edgeless.slots.toggleNoteSlicer.emit()}_setBackground(e){this.notes.forEach(t=>{this.doc.updateBlock(t,{background:e})}),this.edgeless.service.editPropsStore.recordLastProps("affine:note",{background:e})}_setCollapse(){this.notes.forEach(e=>{let{collapse:t,collapsedHeight:i}=e.edgeless;if(t)this.doc.updateBlock(e,()=>{e.edgeless.collapse=!1});else if(i){let{xywh:t,edgeless:s}=e,o=p.z.deserialize(t);o.h=i*(s.scale??1),this.doc.updateBlock(e,()=>{e.edgeless.collapse=!0,e.xywh=o.serialize()})}}),this.requestUpdate()}_setDisplayMode(e,t){let{displayMode:i}=e;if(t===i)return;this.doc.updateBlock(e,{displayMode:t});let s=this.doc.getParent(e);(0,H.Z1)(s);let o=s.children.filter(e=>(0,tf.o)(e,["affine:note"])),r=o[o.length-1];i===e$.ko.EdgelessOnly&&t!==e$.ko.EdgelessOnly&&e!==r&&this.doc.moveBlocks([e],s,r,!1),t===e$.ko.DocOnly&&this.edgeless.service.selection.clear()}_setShadowType(e){this.notes.forEach(t=>{this.doc.updateBlock(t,()=>{t.edgeless.style.shadowType=e})})}_setStrokeStyle(e){this.notes.forEach(t=>{this.doc.updateBlock(t,()=>{t.edgeless.style.borderStyle=e})})}_setStrokeWidth(e){this.notes.forEach(t=>{this.doc.updateBlock(t,()=>{t.edgeless.style.borderSize=e})})}_setStyles({type:e,value:t}){if("size"===e){this._setStrokeWidth(t);return}"lineStyle"===e&&this._setStrokeStyle(t)}get doc(){return this.edgeless.doc}render(){let e=this.notes.length,t=this.notes[0],{edgeless:i,displayMode:s}=t,{shadowType:o,borderRadius:r,borderSize:a,borderStyle:n}=i.style,l=this.edgeless.surface.renderer.getColorScheme(),c=function(e,t){let i=(0,sk.Tr)(e,e=>"object"==typeof e.background?e.background[t]??e.background.normal??null:e.background),s=(0,sk.Sk)(Object.entries(i),([e,t])=>t);return s?s[0]:null}(this.notes,l)??W.KI,{collapse:d}=i,h=i.scale??1,u=dE[s],p=1===e,f=s===e$.ko.DocOnly,g=[p?(0,L.qy)` Show in ${u} ${G.eoI} `} > this._setDisplayMode(t,e)} > `:L.s6,f?L.s6:(0,lH.z)(this.edgeless.doc.awarenessStore.getFlag("enable_color_picker"),()=>{let{type:e,colors:i}=l5(l,c,t.background);return(0,L.qy)` `},()=>(0,L.qy)` `} > this._setBackground(e.detail)} > `),f?L.s6:(0,L.qy)` ${G.E1b}${G.eoI} `} > this._setShadowType(e)} > ${G.HNp}${G.eoI} `} >
${ce({selectedLineSize:a,selectedLineStyle:n,onClick:e=>this._setStyles(e)})}
${G.DLR}${G.eoI} `} > this._setBorderRadius(e)} .onPopperCose=${()=>this._cornersPanelRef.value?.hide()} > `,p?(0,L.qy)` this._handleNoteSlicerButtonClick()} > ${G.b8b} `:L.s6,p?this.quickConnectButton:L.s6,(0,L.qy)` this._setCollapse()} > ${d?G.mSu:G.pg7} ${this._getScaleLabel(h)}${G.eoI} `} > this._setNoteScale(e)} .onPopperCose=${()=>this._scalePanelRef.value?.hide()} > `];return(0,sj.f)(g.filter(e=>e!==L.s6),an)}#rW;get _cornersPanelRef(){return this.#rW}set _cornersPanelRef(e){this.#rW=e}#rG;get _scalePanelRef(){return this.#rG}set _scalePanelRef(e){this.#rG=e}#rH;get backgroundButton(){return this.#rH}set backgroundButton(e){this.#rH=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#rY;get enableNoteSlicer(){return this.#rY}set enableNoteSlicer(e){this.#rY=e}#rK;get notes(){return this.#rK}set notes(e){this.#rK=e}#rP;get quickConnectButton(){return this.#rP}set quickConnectButton(e){this.#rP=e}constructor(){super(...arguments),this._setBorderRadius=e=>{this.notes.forEach(t=>{this.doc.updateBlock(t,()=>{t.edgeless.style.borderRadius=e})})},this._setNoteScale=e=>{this.notes.forEach(t=>{this.doc.updateBlock(t,()=>{let i=p.z.deserialize(t.xywh),s=e/(t.edgeless.scale??1);i.w*=s,i.h*=s;let o=i.serialize();t.xywh=o,t.edgeless.scale=e})})},this.pickColor=e=>{if("pick"===e.type){this.notes.forEach(t=>this.doc.updateBlock(t,l2("background",{...e.detail}))),this.edgeless.service.editPropsStore.recordLastProps("affine:note",l2("background",e.detail));return}this.notes.forEach(t=>t["start"===e.type?"stash":"pop"]("background"))},this.#rW=(0,a_._)(),this.#rG=(0,a_._)(),this.#rH=dS(this,d,void 0),this.#i_=(dS(this,h),dS(this,u,void 0)),this.#rY=(dS(this,f),dS(this,g,void 0)),this.#rK=(dS(this,m),dS(this,v,[])),this.#rP=(dS(this,y),dS(this,b,void 0)),dS(this,w)}})})();let{Rect:dI,Ellipse:dB,Triangle:d$,Diamond:dT}=v.IO,dO=[{name:dI,generalIcon:G.dHM,scribbledIcon:G.B2L,tooltip:"Square",disabled:!1,value:{shapeType:dI,radius:0}},{name:dB,generalIcon:G.YlR,scribbledIcon:G.adS,tooltip:"Ellipse",disabled:!1,value:{shapeType:dB}},{name:dT,generalIcon:G.e9L,scribbledIcon:G.o17,tooltip:"Diamond",disabled:!1,value:{shapeType:dT}},{name:d$,generalIcon:G.o7e,scribbledIcon:G.OVp,tooltip:"Triangle",disabled:!1,value:{shapeType:d$}},{name:"roundedRect",generalIcon:G.EW9,scribbledIcon:G.Cso,tooltip:"Rounded rectangle",disabled:!1,value:{shapeType:dI,radius:.1}}];dO.reduce((e,t)=>(e[t.name]=t,e),{});var dP=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},dH=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("edgeless-shape-panel")],r=[],a=L.WF,n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],dP(this,null,i,{kind:"accessor",name:"selectedShape",static:!1,private:!1,access:{has:e=>"selectedShape"in e,get:e=>e.selectedShape,set:(e,t)=>{e.selectedShape=t}},metadata:h},n,l),dP(this,null,s,{kind:"accessor",name:"shapeStyle",static:!1,private:!1,access:{has:e=>"shapeStyle"in e,get:e=>e.shapeStyle,set:(e,t)=>{e.shapeStyle=t}},metadata:h},c,d),dP(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` :host { display: flex; align-items: center; justify-content: center; gap: 8px; } `}_onSelect(e){this.selectedShape=e,this.slots.select.emit(e)}disconnectedCallback(){this.slots.select.dispose(),super.disconnectedCallback()}render(){return(0,t$.u)(dO,e=>e.name,({name:e,generalIcon:t,scribbledIcon:i,tooltip:s,disabled:o})=>(0,L.qy)`{o||this._onSelect(e)}} > ${this.shapeStyle===v.lH.General?t:i} `)}#rX;get selectedShape(){return this.#rX}set selectedShape(e){this.#rX=e}#rQ;get shapeStyle(){return this.#rQ}set shapeStyle(e){this.#rQ=e}constructor(){super(...arguments),this.slots={select:new a2.D},this.#rX=dH(this,n,void 0),this.#rQ=(dH(this,l),dH(this,c,v.lH.Scribbled)),dH(this,d)}static{dH(t,r)}})})();var dA=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},dL=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("edgeless-shape-style-panel")],r=[],a=L.WF,n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],dA(this,null,i,{kind:"accessor",name:"onSelect",static:!1,private:!1,access:{has:e=>"onSelect"in e,get:e=>e.onSelect,set:(e,t)=>{e.onSelect=t}},metadata:h},n,l),dA(this,null,s,{kind:"accessor",name:"value",static:!1,private:!1,access:{has:e=>"value"in e,get:e=>e.value,set:(e,t)=>{e.value=t}},metadata:h},c,d),dA(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` :host { display: flex; align-items: center; justify-content: center; gap: 8px; } `}_onSelect(e){this.value=e,this.onSelect&&this.onSelect(e)}render(){return(0,t$.u)(dD,e=>e.value,({value:e,icon:t})=>(0,L.qy)`this._onSelect(e)} > ${t} `)}#ov=dL(this,n,void 0);get onSelect(){return this.#ov}set onSelect(e){this.#ov=e}#eJ=(dL(this,l),dL(this,c,void 0));get value(){return this.#eJ}set value(e){this.#eJ=e}constructor(){super(...arguments),dL(this,d)}static{dL(t,r)}})})();var dZ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},dj=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n=[(0,D.EM)("edgeless-change-shape-button")],l=[],c=(0,P.Tm)(L.WF),d=[],h=[],u=[],p=[],f=[],g=[],m=[],y=[],b=[],w=[];(class extends c{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.P)("edgeless-shape-panel")],s=[(0,D.P)("edgeless-color-picker-button.border-style")],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.P)("edgeless-color-picker-button.fill-color")],dZ(this,null,i,{kind:"accessor",name:"_shapePanel",static:!1,private:!1,access:{has:e=>"_shapePanel"in e,get:e=>e._shapePanel,set:(e,t)=>{e._shapePanel=t}},metadata:v},d,h),dZ(this,null,s,{kind:"accessor",name:"borderStyleButton",static:!1,private:!1,access:{has:e=>"borderStyleButton"in e,get:e=>e.borderStyleButton,set:(e,t)=>{e.borderStyleButton=t}},metadata:v},u,p),dZ(this,null,o,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:v},f,g),dZ(this,null,r,{kind:"accessor",name:"elements",static:!1,private:!1,access:{has:e=>"elements"in e,get:e=>e.elements,set:(e,t)=>{e.elements=t}},metadata:v},m,y),dZ(this,null,a,{kind:"accessor",name:"fillColorButton",static:!1,private:!1,access:{has:e=>"fillColorButton"in e,get:e=>e.fillColorButton,set:(e,t)=>{e.fillColorButton=t}},metadata:v},b,w),dZ(null,e={value:t},n,{kind:"class",name:t.name,metadata:v},null,l),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=[dV]}#rJ(e){return t=>{if("pick"===t.type){this.elements.forEach(i=>{let s=l2(e,{...t.detail});"fillColor"!==e||i.filled||Object.assign(s,{filled:!0}),this.service.updateElement(i.id,s)});return}this.elements.forEach(i=>i["start"===t.type?"stash":"pop"](e))}}_addText(){iu(this.elements[0],this.edgeless)}_getTextColor(e){return tV(e)?tL():e===id?il:ic}_setShapeFillColor(e){let t=!tV(e),i=this._getTextColor(e);this.elements.forEach(s=>this.service.updateElement(s.id,{filled:t,fillColor:e,color:i}))}_setShapeStrokeColor(e){this.elements.forEach(t=>this.service.updateElement(t.id,{strokeColor:e}))}_setShapeStrokeStyle(e){this.elements.forEach(t=>this.service.updateElement(t.id,{strokeStyle:e}))}_setShapeStrokeWidth(e){this.elements.forEach(t=>this.service.updateElement(t.id,{strokeWidth:e}))}_setShapeStyle(e){let t=e===v.lH.General?tI.ay.Inter:tI.ay.Kalam;this.elements.forEach(i=>{this.service.updateElement(i.id,{shapeStyle:e,fontFamily:t})})}_setShapeStyles({type:e,value:t}){if("size"===e){this._setShapeStrokeWidth(t);return}"lineStyle"===e&&this._setShapeStrokeStyle(t)}_showAddButtonOrTextMenu(){return 1!==this.elements.length||this.elements[0].text?this.elements.some(e=>!e.text)?"nothing":"menu":"button"}firstUpdated(){this._disposables.add(this._shapePanel.slots.select.on(e=>{let t="roundedRect"===e?{shapeType:a3.IO.Rect,radius:.1}:{shapeType:e,radius:0};this.edgeless.doc.captureSync(),this.elements.forEach(e=>{this.service.updateElement(e.id,t)})}))}render(){let e=this.edgeless.surface.renderer.getColorScheme(),t=this.elements,i=function(e){let t=(0,sk.Tr)(e,e=>"rect"===e.shapeType&&e.radius?"roundedRect":e.shapeType),i=(0,sk.Sk)(Object.entries(t),([e,t])=>t);return i?i[0]:null}(t),s=function(e,t){let i=(0,sk.Tr)(e,e=>e.filled?"object"==typeof e.fillColor?e.fillColor[t]??e.fillColor.normal??null:e.fillColor:"--affine-palette-transparent"),s=(0,sk.Sk)(Object.entries(i),([e,t])=>t);return s?s[0]:null}(t,e)??a3.SO,o=function(e,t){let i=(0,sk.Tr)(e,e=>"object"==typeof e.strokeColor?e.strokeColor[t]??e.strokeColor.normal??null:e.strokeColor),s=(0,sk.Sk)(Object.entries(i),([e,t])=>t);return s?s[0]:null}(t,e)??a3.vt,r=function(e){let t=(0,sk.Tr)(e,e=>e.strokeWidth),i=(0,sk.Sk)(Object.entries(t),([e,t])=>t);return i?Number(i[0]):e$.D9.Four}(t)??e$.D9.Four,a=function(e){let t=(0,sk.Tr)(e,e=>e.strokeStyle),i=(0,sk.Sk)(Object.entries(t),([e,t])=>t);return i?i[0]:null}(t)??v.u1.Solid,n=function(e){let t=(0,sk.Tr)(e,e=>e.shapeStyle),i=(0,sk.Sk)(Object.entries(t),([e,t])=>t);return i?i[0]:v.lH.Scribbled}(t)??v.lH.Scribbled;return(0,sj.f)([(0,L.qy)` ${G.jCn}${G.eoI} `} > `,(0,L.qy)` ${(0,r9.P)(n===v.lH.General?G.$JY:G.tgi)} ${G.eoI} `} > this._setShapeStyle(e)} > `,(0,lH.z)(this.edgeless.doc.awarenessStore.getFlag("enable_color_picker"),()=>{let{type:i,colors:o}=l5(e,s,t[0].fillColor);return(0,L.qy)` `},()=>(0,L.qy)` `} > this._setShapeFillColor(e.detail)} > `),(0,lH.z)(this.edgeless.doc.awarenessStore.getFlag("enable_color_picker"),()=>{let{type:i,colors:s}=l5(e,o,t[0].strokeColor);return(0,L.qy)`
${ce({selectedLineSize:r,selectedLineStyle:a,onClick:e=>this._setShapeStyles(e),lineStyles:[v.u1.Solid,v.u1.Dash]})}
`},()=>(0,L.qy)` `} > this._setShapeStyles(e)} .setStrokeColor=${e=>this._setShapeStrokeColor(e.detail)} > `),(0,rW.S)(this._showAddButtonOrTextMenu(),[["button",()=>(0,L.qy)` ${G.Y2f} `],["menu",()=>(0,L.qy)` `],["nothing",()=>L.s6]])].filter(e=>e!==L.s6),an)}get service(){return this.edgeless.service}#r1=dj(this,d,void 0);get _shapePanel(){return this.#r1}set _shapePanel(e){this.#r1=e}#r0=(dj(this,h),dj(this,u,void 0));get borderStyleButton(){return this.#r0}set borderStyleButton(e){this.#r0=e}#i_=(dj(this,p),dj(this,f,void 0));get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#oB=(dj(this,g),dj(this,m,[]));get elements(){return this.#oB}set elements(e){this.#oB=e}#r2=(dj(this,y),dj(this,b,void 0));get fillColorButton(){return this.#r2}set fillColorButton(e){this.#r2=e}constructor(){super(...arguments),dj(this,w)}static{dj(t,l)}})})();var dz=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},dR=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-one-row-color-panel")],s=[],o=tq;(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;dz(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` :host { display: flex; flex-wrap: nowrap; padding: 0 2px; gap: 14px; box-sizing: border-box; background: var(--affine-background-overlay-panel-color); } ${tN} .color-container { width: 20px; height: 20px; } .color-container::before { content: ''; position: absolute; width: 2px; right: calc(100% + 7px); height: 100%; // FIXME: not working scroll-snap-align: start; } `}static{dR(t,s)}})})();var dF=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},dN=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c=[(0,D.EM)("edgeless-shape-menu")],d=[],h=L.WF,u=[],p=[],f=[],g=[],m=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[];(class extends h{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],dF(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:v},u,p),dF(this,null,s,{kind:"accessor",name:"fillColor",static:!1,private:!1,access:{has:e=>"fillColor"in e,get:e=>e.fillColor,set:(e,t)=>{e.fillColor=t}},metadata:v},f,g),dF(this,null,o,{kind:"accessor",name:"onChange",static:!1,private:!1,access:{has:e=>"onChange"in e,get:e=>e.onChange,set:(e,t)=>{e.onChange=t}},metadata:v},m,y),dF(this,null,r,{kind:"accessor",name:"radius",static:!1,private:!1,access:{has:e=>"radius"in e,get:e=>e.radius,set:(e,t)=>{e.radius=t}},metadata:v},b,w),dF(this,null,a,{kind:"accessor",name:"shapeStyle",static:!1,private:!1,access:{has:e=>"shapeStyle"in e,get:e=>e.shapeStyle,set:(e,t)=>{e.shapeStyle=t}},metadata:v},x,_),dF(this,null,n,{kind:"accessor",name:"shapeType",static:!1,private:!1,access:{has:e=>"shapeType"in e,get:e=>e.shapeType,set:(e,t)=>{e.shapeType=t}},metadata:v},C,k),dF(this,null,l,{kind:"accessor",name:"strokeColor",static:!1,private:!1,access:{has:e=>"strokeColor"in e,get:e=>e.strokeColor,set:(e,t)=>{e.strokeColor=t}},metadata:v},S,M),dF(null,e={value:t},c,{kind:"class",name:t.name,metadata:v},null,d),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { display: flex; z-index: -1; } .menu-content { display: flex; align-items: center; } .shape-type-container, .shape-style-container { display: flex; align-items: center; justify-content: center; gap: 14px; } .shape-type-container svg, .shape-style-container svg { fill: var(--affine-icon-color); stroke: none; } menu-divider { height: 24px; margin: 0 9px; } `}render(){let{radius:e,fillColor:t,shapeStyle:i}=this,{shapeType:s}=this;"rect"===s&&e>0&&(s="roundedRect");let o=j.Q.getColorValue(t,a3.SO);return(0,L.qy)` `}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#r5;get fillColor(){return this.#r5}set fillColor(e){this.#r5=e}#eY;get onChange(){return this.#eY}set onChange(e){this.#eY=e}#i2;get radius(){return this.#i2}set radius(e){this.#i2=e}#rQ;get shapeStyle(){return this.#rQ}set shapeStyle(e){this.#rQ=e}#r7;get shapeType(){return this.#r7}set shapeType(e){this.#r7=e}#oO;get strokeColor(){return this.#oO}set strokeColor(e){this.#oO=e}constructor(){super(...arguments),this._setFillColor=e=>{let t=!tV(e),i=e.replace("--affine-palette-shape-","--affine-palette-line-");i.endsWith("transparent")&&(i="--affine-palette-line-grey"),this.onChange({filled:t,fillColor:e,strokeColor:i})},this._setShapeStyle=e=>{this.onChange({shapeStyle:e})},this.#i_=dN(this,u,void 0),this.#r5=(dN(this,p),dN(this,f,void 0)),this.#eY=(dN(this,g),dN(this,m,void 0)),this.#i2=(dN(this,y),dN(this,b,void 0)),this.#rQ=(dN(this,w),dN(this,x,void 0)),this.#r7=(dN(this,_),dN(this,C,void 0)),this.#oO=(dN(this,k),dN(this,S,void 0)),dN(this,M)}static{dN(t,d)}})})();var dq=i(43264);async function dU(e,t,i=!0){let{clipboardController:s}=e,o=(0,tM.Z2)(t,e.surface.edgeless.service.frame),r=tS(o);r.x+=r.w+10;let a=await (0,tM.xc)(o,e.std),{canvasElements:n,blockModels:l}=await s.createElementsFromClipboardData(a,r.center),c=[...n,...l];e.surface.fitToViewport(r),i&&e.service.selection.set({elements:c.map(e=>e.id),editing:!1})}var dW=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},dG=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("edgeless-more-button")],a=[],n=(0,P.Tm)(L.WF),l=[],c=[],d=[],h=[],u=[],f=[];(class extends n{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],dW(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:p},l,c),dW(this,null,s,{kind:"accessor",name:"elements",static:!1,private:!1,access:{has:e=>"elements"in e,get:e=>e.elements,set:(e,t)=>{e.elements=t}},metadata:p},d,h),dW(this,null,o,{kind:"accessor",name:"vertical",static:!1,private:!1,access:{has:e=>"vertical"in e,get:e=>e.vertical,set:(e,t)=>{e.vertical=t}},metadata:p},u,f),dW(null,e={value:t},r,{kind:"class",name:t.name,metadata:p},null,a),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p}),dG(t,a)}get _Actions(){return[[d1,d0],dX,this.getOpenActions(),[...dQ,this.getRefreshAction()],[this.getLinkedDocAction()],[dJ]]}get _FrameActions(){return[[d1],dQ,[this.getLinkedDocAction()],[dJ]]}get _block(){let e=this.edgeless.service.selection.surfaceSelections;if(1!==e.length||1!==e[0].elements.length)return;let t=this.view.getBlock(e[0].blockId);if(t)return t}_refreshable(e){return(0,tE.TW)(e)||(0,tE.Cv)(e)||(0,tE.BG)(e)||(0,tE.qo)(e)}getLinkedDocAction(){let e=1===this.selection.selectedElements.length,{firstElement:t}=this.selection;return e&&((0,tE.C8)(t)||(0,tE.v8)(t))?L.s6:e&&(0,tE._h)(t)?d5:d7}getOpenActions(){let e=1===this.selection.selectedElements.length,{firstElement:t}=this.selection,i=[];if(e&&((0,tE.C8)(t)||(0,tE.v8)(t))){let e=t.pageId===this.doc.id;i.push({...dY,disabled:e})}return e&&this._block&&(0,ri.mV)(this._block)&&i.push(dK),i}getRefreshAction(){return this.selection.selectedElements.every(e=>this._refreshable(e))?d2:L.s6}render(){let e=ad(this.edgeless.service.selection.selectedElements.some(tE.X8)?this._FrameActions:this._Actions,this._runAction);return(0,L.qy)` ${this.vertical?G.FHP:G.jNK} `} >
${e}
`}get doc(){return this.edgeless.doc}get selection(){return this.edgeless.service.selection}get slots(){return this.edgeless.slots}get surface(){return this.edgeless.surface}get view(){return this.edgeless.host.view}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#oB;get elements(){return this.#oB}set elements(e){this.#oB=e}#Z;get vertical(){return this.#Z}set vertical(e){this.#Z=e}constructor(){super(...arguments),this._createLinkedDoc=e=>{let t=this.edgeless.service.selection,i=(0,tM.Z2)(t.selectedElements,this.edgeless.surface.edgeless.service.frame),s=(0,iV.Zp)(this.edgeless.host,i,e),o=tS(i),r=this.edgeless.service.addBlock("affine:embed-linked-doc",{xywh:`[${o.center[0]-182}, ${o.center[1]-195}, 364, 390]`,style:"vertical",pageId:s.id},this.surface.model.id);this.edgeless.service.telemetryService?.track("CanvasElementAdded",{control:"context-menu",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"embed-linked-doc"}),this.edgeless.service.telemetryService?.track("DocCreated",{control:"create linked doc",page:"whiteboard editor",module:"format toolbar",type:"embed-linked-doc"}),this.edgeless.service.telemetryService?.track("LinkedDocCreated",{control:"create linked doc",page:"whiteboard editor",module:"format toolbar",type:"embed-linked-doc",other:"new doc"}),this.doc.transact(()=>{t8(this.surface,i)}),this.edgeless.service.selection.set({elements:[r],editing:!1})},this._delete=()=>{this.doc.captureSync(),t8(this.surface,this.selection.selectedElements),this.selection.set({elements:[],editing:!1})},this._reload=e=>{e.forEach(e=>{let t=this.view.getBlock(e.blockId);t&&this._refreshable(t.model)&&t.refreshData()})},this._runAction=async({type:e})=>{let t=this.edgeless.service.selection;switch(e){case"copy":this.edgeless.clipboardController.copy();break;case"duplicate":await dU(this.edgeless,t.selectedElements);break;case"delete":this._delete();break;case"turn-into-linked-doc":{let e=await (0,iV.fG)(this.edgeless.host);if(null===e)return;this._turnIntoLinkedDoc(e),(0,iV.eD)(this.edgeless.host,this.edgeless.doc);break}case"create-linked-doc":{let e=await (0,iV.fG)(this.edgeless.host);if(null===e)return;this._createLinkedDoc(e),(0,iV.eD)(this.edgeless.host,this.edgeless.doc);break}case"create-frame":{let{service:e}=this.edgeless,t=e.frame.createFrameOnSelected();if(!t)break;this.edgeless.service.telemetryService?.track("CanvasElementAdded",{control:"context-menu",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"frame"}),this.edgeless.surface.fitToViewport(p.z.deserialize(t.xywh));break}case"create-group":this.edgeless.service.createGroupFromSelected();break;case"front":case"forward":case"backward":case"back":this.selection.selectedElements.forEach(t=>{this.edgeless.service.reorderElement(t,e)});break;case"reload":this._reload(this.selection.surfaceSelections);break;case"open":this._block&&"open"in this._block&&"function"==typeof this._block.open&&this._block.open();break;case"center-peek":this._block&&(0,ri.mV)(this._block)&&(0,ri.se)(this._block)}},this._turnIntoLinkedDoc=e=>{let t=1===this.selection.selectedElements.length,{firstElement:i}=this.selection;if(t&&(0,tE._h)(i)){let t=(0,iV.ah)(this.edgeless.host.doc,i,e),s=this.edgeless.service.addBlock("affine:embed-synced-doc",{xywh:i.xywh,style:"syncedDoc",pageId:t.id,index:i.index},this.surface.model.id);this.edgeless.service.telemetryService?.track("CanvasElementAdded",{control:"context-menu",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"embed-synced-doc"}),this.edgeless.service.telemetryService?.track("DocCreated",{control:"turn into linked doc",page:"whiteboard editor",module:"format toolbar",type:"embed-linked-doc"}),this.edgeless.service.telemetryService?.track("LinkedDocCreated",{control:"turn into linked doc",page:"whiteboard editor",module:"format toolbar",type:"embed-linked-doc",other:"new doc"}),function(e,t,i){i.surface.getConnectors(e).forEach(s=>{s.source.id===e&&i.updateElement(s.id,{source:{...s.source,id:t}}),s.target.id===e&&i.updateElement(s.id,{target:{...s.target,id:t}})})}(i.id,s,this.edgeless.service),this.doc.transact(()=>{this.surface.doc.deleteBlock(i)}),this.edgeless.service.selection.set({elements:[s],editing:!1})}else this._createLinkedDoc(e)},this.#i_=dG(this,l,void 0),this.#oB=(dG(this,c),dG(this,d,[])),this.#Z=(dG(this,h),dG(this,u,!1)),dG(this,f)}})})();var d3=i(26739),d4=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},d6=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-release-from-group-button")],s=[],o=(0,P.Tm)(L.WF),r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;d4(this,null,[(0,D.MZ)({attribute:!1})],{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:n},r,a),d4(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),d6(t,s)}_releaseFromGroup(){let e=this.edgeless.service,t=e.selection.firstElement;if(!(t.group instanceof d3.$))return;let i=t.group;i.removeChild(t),t.index=e.layer.generateIndex("flavour"in t?t.flavour:t.type);let s=i.group;s instanceof d3.$&&s.addChild(t.id)}render(){return(0,L.qy)` this._releaseFromGroup()} > ${G.aIb} `}#i_=d6(this,r,void 0);get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}constructor(){super(...arguments),d6(this,a)}})})();var d8=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},d9=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n=[(0,D.EM)(he)],l=[],c=P.W,d=[],h=[],u=[],p=[],f=[],g=[],m=[],y=[],b=[],w=[];return class extends c{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.wk)({hasChanged:(e,t)=>e.length!==t?.length||e.some((e,i)=>e!==t[i])})],a=[(0,D.wk)()],d8(this,null,i,{kind:"accessor",name:"_dragging",static:!1,private:!1,access:{has:e=>"_dragging"in e,get:e=>e._dragging,set:(e,t)=>{e._dragging=t}},metadata:v},d,h),d8(this,null,s,{kind:"accessor",name:"_registeredEntries",static:!1,private:!1,access:{has:e=>"_registeredEntries"in e,get:e=>e._registeredEntries,set:(e,t)=>{e._registeredEntries=t}},metadata:v},u,p),d8(this,null,o,{kind:"accessor",name:"enableNoteSlicer",static:!1,private:!1,access:{has:e=>"enableNoteSlicer"in e,get:e=>e.enableNoteSlicer,set:(e,t)=>{e.enableNoteSlicer=t}},metadata:v},f,g),d8(this,null,r,{kind:"accessor",name:"selectedIds",static:!1,private:!1,access:{has:e=>"selectedIds"in e,get:e=>e.selectedIds,set:(e,t)=>{e.selectedIds=t}},metadata:v},m,y),d8(this,null,a,{kind:"accessor",name:"toolbarVisible",static:!1,private:!1,access:{has:e=>"toolbarVisible"in e,get:e=>e.toolbarVisible,set:(e,t)=>{e.toolbarVisible=t}},metadata:v},b,w),d8(null,e={value:t},n,{kind:"class",name:t.name,metadata:v},null,l),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { position: absolute; z-index: 3; transform: translateZ(0); will-change: transform; -webkit-user-select: none; user-select: none; } `}_groupSelected(){return(0,sk.$z)(this.selection.selectedElements,e=>(0,tE._h)(e)?"note":(0,tE.X8)(e)?"frame":(0,tE.TW)(e)?"image":(0,tE.BG)(e)?"attachment":(0,tE.Cv)(e)||(0,tE.Wq)(e)?"embedCard":(0,tE.dT)(e)?"edgelessText":e.type)}_recalculatePosition(){let e,t;let{selection:i,viewport:s}=this.edgeless.service,o=i.selectedElements;if(0===o.length){this.style.transform="translate3d(0, 0, 0)";return}let r=tS(o),{width:a,height:n}=s,[l,c]=s.toViewCoord(r.x,r.y),[d,h]=s.toViewCoord(r.maxX,r.maxY);if(l>=a||d<=0||c>=n||h<=0){e=l,t=c,this.style.transform=`translate3d(${e}px, ${t}px, 0)`;return}let u=49,p=!1,f=!1;(p=o.some(e=>(0,tE.X8)(e)))||(f=o.some(e=>e instanceof v.$f))?(u+=20,p&&(u+=8)):1===o.length&&o[0]instanceof v.B5&&(u+=26),(t=c-u)<0&&(t=c+r.h*s.zoom+u-37,(p||f)&&(t-=20,p&&(t-=8))),e=(0,v.qE)(l,10,a-10),t=(0,v.qE)(t,10,n-150),this.style.transform=`translate3d(${e}px, ${t}px, 0)`,this.selectedIds=i.selectedIds}_renderQuickConnectButton(){return[(0,L.qy)` ${sm.Rj} `]}firstUpdated(){let{_disposables:e,edgeless:t}=this;e.add(t.service.viewport.viewportUpdated.on(()=>{this._recalculatePosition()})),e.add(this.selection.slots.updated.on(()=>{0===this.selection.selectedIds.length||this.selection.editing||this.selection.inoperable?this.toolbarVisible=!1:(this.toolbarVisible=!0,this._recalculatePosition())})),(0,sk.ME)(this.edgeless.service.surface,["elementAdded","elementUpdated"]).forEach(t=>e.add(t.on(this._updateOnSelectedChange))),e.add(this.doc.slots.blockUpdated.on(this._updateOnSelectedChange)),e.add(t.dispatcher.add("dragStart",()=>{this._dragging=!0})),e.add(t.dispatcher.add("dragEnd",()=>{this._dragging=!1,this._recalculatePosition()})),e.add(t.slots.elementResizeStart.on(()=>{this._dragging=!0})),e.add(t.slots.elementResizeEnd.on(()=>{this._dragging=!1,this._recalculatePosition()})),e.add(t.slots.readonlyUpdated.on(()=>this.requestUpdate())),this.updateComplete.then(()=>{e.add(j.Q.subscribe(()=>this.requestUpdate()))}).catch(console.error)}registerEntry(e){this._registeredEntries.push(e)}render(){var e;if(this.doc.readonly||this._dragging||!this.toolbarVisible)return L.s6;let t=this._groupSelected(),{edgeless:i,selection:s}=this,{shape:o,brush:r,connector:a,note:n,text:l,frame:c,group:d,embedCard:h,attachment:u,image:p,edgelessText:f,mindmap:g}=t,{selectedElements:m}=this.selection,y=(0,sk.I8)(Object.values(t),e=>!!e.length,2),b=1!==m.length||a?.length?void 0:this._renderQuickConnectButton(),w=m.length!==a?.length?[m.length<2||m.some(e=>e.group instanceof v.AR)?L.s6:(0,L.qy)` `,m.length<2||m[0]instanceof v.$f||m.some(e=>e.group instanceof v.AR)?L.s6:(0,L.qy)` `,m.length<2||m.some(e=>e.group instanceof v.AR)?L.s6:(0,L.qy)` `]:[],x=y?w:[...w,dp(i,g),dp(i,o),!o?.length||o.some(e=>i.service.surface.isInMindmap(e.id))?L.s6:(0,L.qy)` `,r?.length?(0,L.qy)` `:L.s6,a?.length?(0,L.qy)` `:L.s6,n?.length?(0,L.qy)` `:L.s6,l?.length?(0,L.qy)` `:L.s6,f?.length?(0,L.qy)` `:L.s6,c?.length?(0,L.qy)` `:L.s6,d?.length?(0,L.qy)` `:L.s6,h?.length!==1?L.s6:(0,L.qy)` `,u?.length!==1?L.s6:(0,L.qy)` `,p?.length!==1?L.s6:(0,L.qy)` `];return 1===m.length&&(s.firstElement.group instanceof v.$f&&x.unshift((e=this.edgeless,(0,L.qy)` `)),a?.length||x.push(b?.pop()??L.s6)),this._registeredEntries.filter(e=>e.when(m)).map(e=>e.render(this.edgeless)).forEach(e=>e&&x.unshift(e)),x.push((0,L.qy)` `),(0,L.qy)` ${(0,sj.f)(x.filter(e=>e!==L.s6),an)} `}get edgeless(){return this.block}get selection(){return this.edgeless.service.selection}get slots(){return this.edgeless.slots}get surface(){return this.edgeless.surface}#sq;get _dragging(){return this.#sq}set _dragging(e){this.#sq=e}#r3;get _registeredEntries(){return this.#r3}set _registeredEntries(e){this.#r3=e}#rY;get enableNoteSlicer(){return this.#rY}set enableNoteSlicer(e){this.#rY=e}#r4;get selectedIds(){return this.#r4}set selectedIds(e){this.#r4=e}#r6;get toolbarVisible(){return this.#r6}set toolbarVisible(e){this.#r6=e}constructor(){super(...arguments),this._quickConnect=({x:e,y:t})=>{let i=this.selection.selectedElements[0],s=this.edgeless.service.viewport.toViewCoordFromClientCoord([e,t]);this.edgeless.doc.captureSync(),this.edgeless.tools.setEdgelessTool({type:"connector",mode:v.B1.Curve}),this.edgeless.tools.controllers.connector.quickConnect(s,i)},this._updateOnSelectedChange=e=>{let t="string"==typeof e?e:e.id;this.isConnected&&!this._dragging&&this.selection.has(t)&&(this._recalculatePosition(),this.requestUpdate())},this.#sq=d9(this,d,!1),this.#r3=(d9(this,h),d9(this,u,[])),this.#rY=(d9(this,p),d9(this,f,void 0)),this.#r4=(d9(this,g),d9(this,m,[])),this.#r6=(d9(this,y),d9(this,b,!1)),d9(this,w)}static{d9(t,l)}},t})(),hi=(0,L.AH)` :host { position: absolute; top: 0; right: 0; z-index: var(--affine-z-index-popover); } .affine-image-toolbar-container { height: 24px; gap: 4px; padding: 4px; margin: 0; } .image-toolbar-button { color: var(--affine-icon-color); background-color: var(--affine-background-primary-color); box-shadow: var(--affine-shadow-1); border-radius: 4px; } `;var hs=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ho=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c=[(0,D.EM)("affine-image-toolbar")],d=[],h=L.WF,u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[];(class extends h{static{t=this}static{let M="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,D.P)("editor-icon-button.more")],s=[(0,D.wk)()],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],hs(this,null,i,{kind:"accessor",name:"_moreButton",static:!1,private:!1,access:{has:e=>"_moreButton"in e,get:e=>e._moreButton,set:(e,t)=>{e._moreButton=t}},metadata:M},u,p),hs(this,null,s,{kind:"accessor",name:"_moreMenuOpen",static:!1,private:!1,access:{has:e=>"_moreMenuOpen"in e,get:e=>e._moreMenuOpen,set:(e,t)=>{e._moreMenuOpen=t}},metadata:M},f,g),hs(this,null,o,{kind:"accessor",name:"abortController",static:!1,private:!1,access:{has:e=>"abortController"in e,get:e=>e.abortController,set:(e,t)=>{e.abortController=t}},metadata:M},m,v),hs(this,null,r,{kind:"accessor",name:"blockComponent",static:!1,private:!1,access:{has:e=>"blockComponent"in e,get:e=>e.blockComponent,set:(e,t)=>{e.blockComponent=t}},metadata:M},y,b),hs(this,null,a,{kind:"accessor",name:"config",static:!1,private:!1,access:{has:e=>"config"in e,get:e=>e.config,set:(e,t)=>{e.config=t}},metadata:M},w,x),hs(this,null,n,{kind:"accessor",name:"moreMenuConfig",static:!1,private:!1,access:{has:e=>"moreMenuConfig"in e,get:e=>e.moreMenuConfig,set:(e,t)=>{e.moreMenuConfig=t}},metadata:M},_,C),hs(this,null,l,{kind:"accessor",name:"onActiveStatusChange",static:!1,private:!1,access:{has:e=>"onActiveStatusChange"in e,get:e=>e.onActiveStatusChange,set:(e,t)=>{e.onActiveStatusChange=t}},metadata:M},k,S),hs(null,e={value:t},c,{kind:"class",name:t.name,metadata:M},null,d),t=e.value,M&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:M})}static{this.styles=hi}_clearPopMenu(){this._popMenuAbortController&&(this._popMenuAbortController.abort(),this._popMenuAbortController=null)}get _items(){var e,t,i,s;return e=this.blockComponent,t=this.abortController,i=this.config,s=this.closeCurrentMenu,i.filter(t=>t.showWhen(e)).map(i=>{let o=null;switch(i.type){case"common":{let s=`image-toolbar-button ${i.name.toLocaleLowerCase()}`;o=(0,L.qy)` i.action(e,t)} > ${i.icon} `;break}case"custom":o=i.render(e,s);break;default:o=null}return[o]}).filter(([e])=>null!=e).map(([e])=>e)}_toggleMoreMenu(){var e,t;if(this._currentOpenMenu&&!this._currentOpenMenu.signal.aborted&&this._currentOpenMenu===this._popMenuAbortController){this.closeCurrentMenu(),this._moreMenuOpen=!1;return}this.closeCurrentMenu(),this._popMenuAbortController=new AbortController,this._popMenuAbortController.signal.addEventListener("abort",()=>{this._moreMenuOpen=!1,this.onActiveStatusChange(!1)}),this.onActiveStatusChange(!0),this._currentOpenMenu=this._popMenuAbortController,(0,H.Z1)(this._moreButton),(0,sB.cl)({template:(0,L.qy)`
${(e=this.blockComponent,t=this._popMenuAbortController,this.moreMenuConfig.filter(t=>t.showWhen(e)).map(i=>{let s=null;switch(i.type){case"more":{let o=`menu-item ${i.name.toLocaleLowerCase()}`;s=(0,L.qy)` {s.stopPropagation(),i.action(e,t)}} > ${i.icon} ${i.name} `;break}case"divider":s=(0,L.qy)` `;break;default:s=null}return s}).filter(e=>null!==e).map(e=>e))}
`,container:this.blockComponent.host,portalStyles:{zIndex:"var(--affine-z-index-popover)"},computePosition:{referenceElement:this._moreButton,placement:"bottom-start",middleware:[(0,sI.UU)(),(0,sI.cY)(4)],autoUpdate:{animationFrame:!0}},abortController:this._popMenuAbortController,closeOnClickAway:!0}),this._moreMenuOpen=!0}disconnectedCallback(){super.disconnectedCallback(),this.closeCurrentMenu(),this._clearPopMenu()}render(){return(0,L.qy)` ${this._items} this._toggleMoreMenu()} > ${sm.FH} `}#od;get _moreButton(){return this.#od}set _moreButton(e){this.#od=e}#oh;get _moreMenuOpen(){return this.#oh}set _moreMenuOpen(e){this.#oh=e}#_;get abortController(){return this.#_}set abortController(e){this.#_=e}#ol;get blockComponent(){return this.#ol}set blockComponent(e){this.#ol=e}#th;get config(){return this.#th}set config(e){this.#th=e}#r8;get moreMenuConfig(){return this.#r8}set moreMenuConfig(e){this.#r8=e}#oc;get onActiveStatusChange(){return this.#oc}set onActiveStatusChange(e){this.#oc=e}constructor(){super(...arguments),this._currentOpenMenu=null,this._popMenuAbortController=null,this.closeCurrentMenu=()=>{this._currentOpenMenu&&!this._currentOpenMenu.signal.aborted&&(this._currentOpenMenu.abort(),this._currentOpenMenu=null)},this.#od=ho(this,u,void 0),this.#oh=(ho(this,p),ho(this,f,!1)),this.#_=(ho(this,g),ho(this,m,void 0)),this.#ol=(ho(this,v),ho(this,y,void 0)),this.#th=(ho(this,b),ho(this,w,void 0)),this.#r8=(ho(this,x),ho(this,_,void 0)),this.#oc=(ho(this,C),ho(this,k,td.lQ)),ho(this,S)}static{ho(t,d)}})})();let hr=[{name:"download",icon:sv.s3,tooltip:"Download",showWhen:()=>!0,action:(e,t)=>{t.abort(),e.download()},type:"common"},{name:"caption",icon:sv.IT,tooltip:"Caption",showWhen:e=>!e.doc.readonly,action:(e,t)=>{t.abort(),e.captionEditor?.show()},type:"common"}],ha=[{name:"Turn into card view",icon:sm.cF,tooltip:"Turn into Card view",showWhen:e=>{let t=e.doc,i=t.schema.flavourSchemaMap.has("affine:attachment"),s=t.readonly;return i&&!s&&!!e.blob},action:(e,t)=>{e.convertToCardView(),t.abort()},type:"more"},{name:"Copy",icon:sv.Td,tooltip:"Copy",showWhen:()=>!0,action:(e,t)=>{e.copy(),t.abort()},type:"more"},{name:"Duplicate",icon:sv.j,tooltip:"Duplicate",showWhen:e=>!e.doc.readonly,action:(e,t)=>{!function(e,t){let i=e.model,{width:s,height:o,xywh:r,rotate:a,zIndex:n,...l}=(0,i2.i)(i),{doc:c}=i,d=c.getParent(i);(0,H.Z1)(d,"Parent not found");let h=d?.children.indexOf(i),u=c.addBlock(i.flavour,l,d,h+1);t?.abort();let p=e.host;p.updateComplete.then(()=>{let{selection:e}=p;if(e.setGroup("note",[e.create("block",{blockId:u})]),(0,of.zU)(p)){let e=p.view.getBlock(u);e&&e.scrollIntoView(!0)}}).catch(console.error)}(e,t)},type:"more"},{type:"divider",showWhen:e=>!e.doc.readonly},{name:"Delete",icon:sv.d7,tooltip:"Delete",showWhen:e=>!e.doc.readonly,action:(e,t)=>{t.abort(),e.doc.deleteBlock(e.model)},type:"more"}];var hn=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},hl=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-image-toolbar-widget")],s=[],o=P.W;return class extends o{static{t=this}constructor(){super(...arguments),this._hoverController=null,this._isActivated=!1,this._setHoverController=()=>{this._hoverController=null,this._hoverController=new n5.n(this,({abortController:e})=>{let t=this.block,i=this.host.selection,s=i.find("text");if(s&&(s.to||s.from.length))return null;let o=i.filter("block");if(o.length>1||1===o.length&&o[0].blockId!==t.blockId)return null;let r=t.resizeImg??t.imageCard;return r?{template:(0,L.qy)`{this._isActivated=e,e||this._hoverController?.isHovering||this._hoverController?.abort()}} >`,container:this.block,portalStyles:{zIndex:"var(--affine-z-index-popover)"},computePosition:{referenceElement:r,placement:"right-start",middleware:[(0,sI.BN)({crossAxis:!0,padding:{top:eh.Et+12,bottom:12,right:12},limiter:(0,sI.ER)()})],autoUpdate:!0}}:null},{allowMultiple:!0});let e=this.block;this._hoverController.setReference(e),this._hoverController.onAbort=()=>{this._isActivated||this._hoverController?.abort()}},this.addConfigItems=(e,t)=>(void 0===t?this.config.push(...e):this.config.splice(t,0,...e),this),this.addMoreMenuItems=(e,t)=>(void 0===t?this.moreMenuConfig.push(...e):this.moreMenuConfig.splice(t,0,...e),this),this.buildDefaultConfig=()=>(this.clearConfig().addConfigItems(hr).addMoreMenuItems(ha),this),this.clearConfig=()=>(this.config=[],this.moreMenuConfig=[],this),this.config=[],this.moreMenuConfig=[]}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;hn(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),hl(t,s)}firstUpdated(){this.config.length&&this.moreMenuConfig.length||this.buildDefaultConfig(),this._setHoverController()}},t})();var hd=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},hh=function(e,t,i){for(var s=arguments.length>2,o=0;oa?"top":"bottom";return{placement:n,height:("top"===n?r:a)-i}}(t,document.body,i+s),a=t.getBoundingClientRect(),n={x:a.x,y:a.y+("bottom"===o?a.height:0)},l=document.body.getBoundingClientRect(),c=function({positioningPoint:e,objRect:t={width:0,height:0},boundaryRect:i=document.body.getBoundingClientRect(),offsetX:s=0,offsetY:o=0,edgeGap:r=20}){return{x:(0,tv.qE)(e.x+s,r,i.width-t.width-r),y:e.y+o}}({positioningPoint:n,objRect:e?.getBoundingClientRect(),boundaryRect:l,offsetY:"bottom"===o?s:-s});return{placement:o,height:r,x:`${c.x}px`,y:"bottom"===o?`${c.y}px`:`calc(${c.y}px - 100%)`}}(()=>{let e,t,i=[(0,D.EM)(hu)],s=[],o=P.W;(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;hd(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),hh(t,s)}open(e,t){let i=(0,sI.ll)(this.target,e,()=>{(0,sI.rD)(this.target,e,{middleware:[(0,sI.Ej)({apply:({rects:t})=>{Object.assign(e.style,{left:`${t.reference.x}px`,top:`${t.reference.y}px`,width:`${t.reference.width}px`,height:`${t.reference.height}px`})}})]}).catch(console.error)});return{close:()=>{e.remove(),t.onClose?.(),i()}}}render(){return L.s6}setTarget(e){this._getTarget=e}get target(){return this._getTarget?this._getTarget():document.body}})})();let hf=(0,L.AH)` :host { position: absolute; } .linked-doc-popover { position: fixed; left: 0; top: 0; box-sizing: border-box; font-family: ${(0,L.iz)(iW.$7.fontSansFamily)}; font-size: var(--affine-font-base); padding: 12px 8px; display: flex; flex-direction: column; overflow-y: auto; background: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-shadow-2); border-radius: 12px; z-index: var(--affine-z-index-popover); } .linked-doc-popover icon-button { padding: 8px; justify-content: flex-start; gap: 8px; } .linked-doc-popover .group-title { color: var(--affine-text-secondary-color); margin: 8px 12px; } .linked-doc-popover .divider { margin: 6px 12px; height: 1px; background: var(--affine-border-color); } .group icon-button svg { width: 20px; height: 20px; } ${(0,aL.kM)(".linked-doc-popover .group")} `;var hg=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},hm=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("affine-linked-doc-popover")],c=[],d=(0,P.Tm)(L.WF),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];return class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.wk)()],a=[(0,D.YG)("icon-button")],n=[(0,D.P)(".linked-doc-popover")],hg(this,null,i,{kind:"accessor",name:"_activatedItemIndex",static:!1,private:!1,access:{has:e=>"_activatedItemIndex"in e,get:e=>e._activatedItemIndex,set:(e,t)=>{e._activatedItemIndex=t}},metadata:C},h,u),hg(this,null,s,{kind:"accessor",name:"_linkedDocGroup",static:!1,private:!1,access:{has:e=>"_linkedDocGroup"in e,get:e=>e._linkedDocGroup,set:(e,t)=>{e._linkedDocGroup=t}},metadata:C},p,f),hg(this,null,o,{kind:"accessor",name:"_position",static:!1,private:!1,access:{has:e=>"_position"in e,get:e=>e._position,set:(e,t)=>{e._position=t}},metadata:C},g,m),hg(this,null,r,{kind:"accessor",name:"_showTooltip",static:!1,private:!1,access:{has:e=>"_showTooltip"in e,get:e=>e._showTooltip,set:(e,t)=>{e._showTooltip=t}},metadata:C},v,y),hg(this,null,a,{kind:"accessor",name:"iconButtons",static:!1,private:!1,access:{has:e=>"iconButtons"in e,get:e=>e.iconButtons,set:(e,t)=>{e.iconButtons=t}},metadata:C},b,w),hg(this,null,n,{kind:"accessor",name:"linkedDocElement",static:!1,private:!1,access:{has:e=>"linkedDocElement"in e,get:e=>e.linkedDocElement,set:(e,t)=>{e.linkedDocElement=t}},metadata:C},x,_),hg(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}static{this.styles=hf}constructor(e,t,i,s,o){super(),this.triggerKey=e,this.getMenus=t,this.editorHost=i,this.inlineEditor=s,this.abortController=o,this._abort=()=>{this.abortController.abort(),(0,aL.m7)(this.editorHost,this.inlineEditor,this.triggerKey+(this._query||""))},this._expanded=new Map,this._startRange=this.inlineEditor.getInlineRange(),this.#r9=hm(this,h,0),this.#ae=(hm(this,u),hm(this,p,[])),this.#at=(hm(this,f),hm(this,g,null)),this.#ai=(hm(this,m),hm(this,v,!1)),this.#as=(hm(this,y),hm(this,b,void 0)),this.#ao=(hm(this,w),hm(this,x,null)),hm(this,_),this.triggerKey=e,this.getMenus=t,this.editorHost=i,this.inlineEditor=s,this.abortController=o}get _actionGroup(){return this._linkedDocGroup.map(e=>({...e,items:this._getActionItems(e)}))}get _flattenActionList(){return this._actionGroup.map(e=>e.items.map(t=>({...t,groupName:e.name}))).flat()}_getActionItems(e){return this._expanded.get(e.name)?e.items:e.maxDisplay&&e.items.length>e.maxDisplay?e.items.slice(0,e.maxDisplay).concat({key:`${e.name} More`,name:e.overflowText||"more",icon:sm.C_,action:()=>{this._expanded.set(e.name,!0),this.requestUpdate()}}):e.items}_isTextOverflowing(e){return e.scrollWidth>e.clientWidth}get _query(){return(0,aL.$Z)(this.inlineEditor,this._startRange)}async _updateLinkedDocGroup(){let e=this._query;if(null===e){this.abortController.abort();return}this._linkedDocGroup=await this.getMenus(e,this._abort,this.editorHost,this.inlineEditor)}connectedCallback(){super.connectedCallback(),this._updateLinkedDocGroup(),this._disposables.addFromEvent(this,"mousedown",e=>{e.preventDefault()});let{eventSource:e}=this.inlineEditor;e&&(0,aL._p)({target:e,signal:this.abortController.signal,inlineEditor:this.inlineEditor,onInput:()=>{this._activatedItemIndex=0,this._updateLinkedDocGroup()},onPaste:()=>{this._activatedItemIndex=0,setTimeout(()=>{this._updateLinkedDocGroup()},20)},onDelete:()=>{let e=this.inlineEditor.getInlineRange();this._startRange&&e&&(e.index{let t=this._flattenActionList.length;this._activatedItemIndex=(t+this._activatedItemIndex+e)%t;let i=this._flattenActionList[this._activatedItemIndex],s=this.shadowRoot;if(!s){console.warn("Failed to find the shadow root!",this);return}let o=s.querySelector(`icon-button[data-id="${i.key}"]`);if(!o){console.warn("Failed to find the active item!",i);return}o.scrollIntoView({block:"nearest"})},onConfirm:()=>{this._flattenActionList[this._activatedItemIndex].action()?.catch(console.error)},onAbort:()=>{this.abortController.abort()}})}render(){let e=this._position?(0,Z.W)({transform:`translate(${this._position.x}, ${this._position.y})`,maxHeight:`${Math.min(this._position.height,410)}px`}):(0,Z.W)({visibility:"hidden"}),t=0;return(0,L.qy)`
${this._actionGroup.filter(e=>e.items.length).map((e,i)=>(0,L.qy)`
${e.name}
${e.items.map(({key:e,name:i,icon:s,action:o})=>{let r=++t-1,a=this._showTooltip?(0,L.qy)`${i}`:L.s6;return(0,L.qy)`{o()?.catch(console.error)}} @mousemove=${()=>{for(let t of(this._activatedItemIndex=r,this.iconButtons.values()))if(t.dataset.id==e&&t.textElement){let e=this._isTextOverflowing(t.textElement);this._showTooltip=e;break}}} > ${s} ${a} `})}
`)}
`}updatePosition(e){this._position=e}#r9;get _activatedItemIndex(){return this.#r9}set _activatedItemIndex(e){this.#r9=e}#ae;get _linkedDocGroup(){return this.#ae}set _linkedDocGroup(e){this.#ae=e}#at;get _position(){return this.#at}set _position(e){this.#at=e}#ai;get _showTooltip(){return this.#ai}set _showTooltip(e){this.#ai=e}#as;get iconButtons(){return this.#as}set iconButtons(e){this.#as=e}#ao;get linkedDocElement(){return this.#ao}set linkedDocElement(e){this.#ao=e}static{hm(t,c)}},t})();var hy=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},hb=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)(hw)],s=[],o=P.W;(class extends o{static{t=this}constructor(){super(...arguments),this._abortController=null,this._onCompositionEnd=e=>{let t=e.get("defaultState").event;if(!this.config.triggerKeys.some(e=>e.includes(t.data)))return;let i=this.getInlineEditor(t);i&&this._handleInput(i,!0)},this._onKeyDown=e=>{let t=e.get("keyboardState").raw,i=t.key;if(void 0===i||"Process"===i||t.isComposing)return;let s=this.getInlineEditor(t);if(!s)return;let o=s.getInlineRange();if(o){if(o.length>0)return;this._handleInput(s,!1)}},this.getInlineEditor=e=>{if(e.target instanceof HTMLElement){let t=e.target.closest(".can-link-doc > .inline-editor")?.inlineEditor;if(t instanceof A.hq)return t}let t=this.host.selection.value.find(e=>e.is("text"));if(!t)return;let i=this.host.doc.getBlockById(t.blockId);if(i){if((0,O.op)(i,this.config.ignoreBlockTypes))return;return(0,of.h9)(this.host,i)}},this.showLinkedDocPopover=(e,t)=>{let i=(0,tp.oV)();if(!i)return;this._abortController?.abort(),this._abortController=new AbortController;let s=new eg.K;this._abortController.signal.addEventListener("abort",()=>s.dispose());let o=new hv(t,this.config.getMenus,this.host,e,this._abortController);document.body.append(o),s.add(()=>o.remove());let r=(0,td.nF)(()=>{let e=o.linkedDocElement;if(!e)return;let t=hp(e,i);o.updatePosition(t)},10);s.addFromEvent(window,"resize",r);let a=(0,of.dV)(this.host);return a&&s.addFromEvent(a,"scroll",r,{passive:!0}),setTimeout(r),s.addFromEvent(window,"mousedown",e=>{e.target!==o&&this._abortController?.abort()}),o}}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;hy(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),hb(t,s)}_handleInput(e,t){let i=this.config.triggerKeys[0],s=i=>{t?i():e.slots.inlineRangeApply.once(i)};s(()=>{let t=e.getInlineRange();if(!t)return;let o=e.getTextPoint(t.index);if(!o)return;let[r,a]=o,n=r.textContent?r.textContent.slice(0,a):"",l=this.config.triggerKeys.find(e=>n.endsWith(e));if(l){if(this.config.convertTriggerKey&&i!==l){let t=e.getInlineRange();if(!t)return;let o=t.index-l.length;e.deleteText({index:o,length:l.length}),e.insertText({index:o,length:0},i),e.setInlineRange({index:o+i.length,length:0}),s(()=>{this.showLinkedDocPopover(e,i)});return}this.showLinkedDocPopover(e,l)}})}connectedCallback(){super.connectedCallback(),this.handleEvent("keyDown",this._onKeyDown),this.handleEvent("compositionEnd",this._onCompositionEnd)}get config(){return{triggerKeys:["@","[[","【【"],ignoreBlockTypes:["affine:code"],convertTriggerKey:!0,getMenus:oh,...this.std.spec.getConfig("affine:page")?.linkedWidget}}})})();var hx=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},h_=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-custom-modal")],s=[],o=L.WF;return class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;hx(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` :host { z-index: calc(var(--affine-z-index-modal) + 3); position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; } .modal-background { width: 100%; height: 100%; box-sizing: border-box; align-items: center; background-color: var(--affine-background-modal-color); justify-content: center; display: flex; } .modal-window { width: 70%; min-width: 500px; height: 80%; overflow-y: scroll; background-color: var(--affine-background-overlay-panel-color); border-radius: 12px; box-shadow: var(--affine-shadow-3); position: relative; } .modal-main { height: 100%; } .modal-footer { display: flex; justify-content: flex-end; gap: 20px; padding: 24px; position: absolute; box-sizing: border-box; bottom: 0; right: 0; } .modal-footer .button { align-items: center; background: var(--affine-white); border: 1px solid; border-color: var(--affine-border-color); border-radius: 8px; color: var(--affine-text-primary-color); cursor: pointer; display: inline-flex; font-size: var(--affine-font-sm); font-weight: 500; justify-content: center; outline: 0; padding: 12px 18px; touch-action: manipulation; transition: all 0.3s; user-select: none; } .modal-footer .primary { background: var(--affine-primary-color); border-color: var(--affine-black-10); box-shadow: var(--affine-button-inner-shadow); color: var(--affine-pure-white); } `}close(){this.remove()}modalRef(e){e&&this.onOpen?.(e)}render(){let{options:e}=this;return(0,L.qy)``}static{h_(t,s)}},t})();var hk=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},hS=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)(hM)],s=[],o=P.W;(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;hk(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),hS(t,s)}open(e){return function(e,t=document.body){let i=new hC;return i.onOpen=e.entry,i.options=e,t.append(i),i}(e,this.ownerDocument.body)}render(){return L.s6}})})();var hE=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},hI=function(e,t,i){for(var s=arguments.length>2,o=0;ot.left&&e.topt.top}(()=>{let e,t,i=[(0,D.EM)(hB)],s=[],o=P.W,r=[],a=[];var n=class extends o{static{t=this}static{let l="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;hE(this,null,[(0,D.wk)()],{kind:"accessor",name:"rect",static:!1,private:!1,access:{has:e=>"rect"in e,get:e=>e.rect,set:(e,t)=>{e.rect=t}},metadata:l},r,a),hE(null,e={value:t},i,{kind:"class",name:t.name,metadata:l},null,s),n=t=e.value,l&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:l})}static{this.excludeFlavours=["affine:note","affine:surface"]}get _allBlocksWithRect(){if(!this._viewport)return[];let{scrollLeft:e,scrollTop:t}=this._viewport;return(()=>{let e=[];return this.host.view.walkThrough(t=>{if(!(t instanceof P.p_))return!0;"root"===t.model.role||n.excludeFlavours.includes(t.model.flavour)||e.push(t)}),e})().map(i=>{let s=i.getBoundingClientRect();return{element:i,rect:{left:s.left+e,top:s.top+t,width:s.width,height:s.height}}})}_clearRaf(){this._rafID&&(cancelAnimationFrame(this._rafID),this._rafID=0)}_selectBlocksByRect(e){let t=(function(e,t){let i=function(e,t){let i=[];for(let s of e){let e=s.rect;if(t.top+t.height=t.top+t.height&&(r=e)}if(r)a=function(e,t,i){let s=e.element,o=[e];if(s.childElementCount>0){let e=s.childBlocks.map(e=>i.find(t=>t.element.model.id===e.model.id)).filter(e=>e),r=e.findIndex(e=>h$(e.rect,t)&&e.rect.toph$(e.rect,t)&&e.rect.top+e.rect.height>t.top+t.height);-1!==r&&-1!==a&&(o=e.slice(r,a+1))}return o}(r,t,i);else for(let e of i)h$(t,e.rect)&&a.push(e);for(let e=0;ee.element.model.id===s)&&o.push(a[e].element.blockId)}return o})(this._allBlocksWithRect,e).map(e=>this.host.selection.create("block",{blockId:e}));this.host.selection.setGroup("note",t)}get _viewport(){let e=this.block;if(e)return e.viewport}get scrollContainer(){return(0,iZ.B)(this.block)}connectedCallback(){super.connectedCallback(),this.handleEvent("dragStart",e=>{let t=e.get("pointerState"),{button:i}=t.raw;if(0===i&&function(e){let t=e.raw.target;(0,H.nn)(t,Element);let i=t.closest(`[${eh.u_}]`);return i&&(0,tf.o)(i.model,["affine:page","affine:note"])}(t)){if(!this._viewport)return;this._dragging=!0;let{scrollLeft:e,scrollTop:i}=this._viewport;return this._initialScrollOffset={left:e,top:i},this._initialContainerOffset={x:t.containerOffset.x,y:t.containerOffset.y},!0}},{global:!0}),this.handleEvent("dragMove",e=>{if(this._clearRaf(),!this._dragging)return;let t=e.get("pointerState");if("touch"!==t.raw.pointerType)return e.get("defaultState").event.preventDefault(),this._rafID=requestAnimationFrame(()=>{this._updateDraggingArea(t,!0)}),!0},{global:!0}),this.handleEvent("dragEnd",()=>{this._clearRaf(),this._dragging=!1,this.rect=null,this._initialScrollOffset={top:0,left:0},this._initialContainerOffset={x:0,y:0},this._lastPointerState=null},{global:!0}),this.handleEvent("pointerMove",e=>{this._dragging&&e.get("pointerState").raw.preventDefault()},{global:!0})}disconnectedCallback(){this._clearRaf(),this._disposables.dispose(),super.disconnectedCallback()}firstUpdated(){this._disposables.addFromEvent(this.scrollContainer,"scroll",()=>{if(!this._dragging||!this._lastPointerState)return;let e=this._lastPointerState;this._rafID=requestAnimationFrame(()=>{this._updateDraggingArea(e,!1)})})}render(){let e=this.rect;if(!e)return L.s6;let t={left:e.left+"px",top:e.top+"px",width:e.width+"px",height:e.height+"px"};return(0,L.qy)`
`}#L;get rect(){return this.#L}set rect(e){this.#L=e}constructor(){super(...arguments),this._dragging=!1,this._initialContainerOffset={x:0,y:0},this._initialScrollOffset={top:0,left:0},this._lastPointerState=null,this._rafID=0,this._updateDraggingArea=(e,t)=>{let{x:i,y:s}=e,{x:o,y:r}=e.start,{left:a,top:n}=this._initialScrollOffset;if(!this._viewport)return;let{scrollLeft:l,scrollTop:c,scrollWidth:d,scrollHeight:h}=this._viewport,{x:u,y:p}=this._initialContainerOffset,{x:f,y:g}=e.containerOffset,{left:m,top:v}=this._viewport,y=Math.min(o+a+u-m,i+l+f-m),b=Math.max(o+a+u-m,i+l+f-m),w=Math.min(r+n+p-v,s+c+g-v),x=Math.max(r+n+p-v,s+c+g-v);y=Math.max(y,f-m),b=Math.min(b,d);let _={left:y,top:w=Math.max(w,g-v),width:b-y,height:(x=Math.min(x,h))-w};if(this.rect=_,this._selectBlocksByRect({left:_.left+m,top:_.top+v,width:_.width,height:_.height}),this._lastPointerState=e,t){let t=this.scrollContainer.getBoundingClientRect();if(!iq(this.scrollContainer,e.raw.y-t.top)){this._clearRaf();return}}},this.#L=hI(this,r,null),hI(this,a)}static{hI(t,s)}};return n=t})();let hT=(e,t)=>{let[i,s,o,r]=t,a=Math.min(.1*o,.1*r);e.moveTo(i+a,s),e.arcTo(i+o,s,i+o,s+r,a),e.arcTo(i+o,s+r,i,s+r,a),e.arcTo(i,s+r,i,s,a),e.arcTo(i,s,i+o,s,a)},hO=(e,t,i,s)=>{e.setLineDash(s.strokeLineDash??[]),e.strokeStyle=s.stroke??"transparent",e.lineWidth=s.strokeWidth??2,e.fillStyle=s.fill??"transparent",e.beginPath();let o=p.z.fromXYWH(i);switch(t){case"rect":m.e2.rect.draw(e,o);break;case"triangle":m.e2.triangle.draw(e,o);break;case"diamond":m.e2.diamond.draw(e,o);break;case"ellipse":m.e2.ellipse.draw(e,o);break;case"roundedRect":hT(e,i);break;default:throw Error(`Unknown shape type: ${t}`)}e.closePath(),e.fill(),e.stroke()};class hP{constructor(e,t,i,s){this.xywh=e,this.type=t,this.options=i,this.shapeStyle=s}}class hH extends hP{draw(e,t){if("Scribbled"===this.shapeStyle){let[e,i,s,o]=this.xywh;t.rectangle(e,i,s,o,this.options)}else hO(e,"rect",this.xywh,this.options)}}class hA extends hP{draw(e,t){if("Scribbled"===this.shapeStyle){let[e,i,s,o]=this.xywh;t.polygon([[e+s/2,i],[e,i+o],[e+s,i+o]],this.options)}else hO(e,"triangle",this.xywh,this.options)}}class hL extends hP{draw(e,t){if("Scribbled"===this.shapeStyle){let[e,i,s,o]=this.xywh;t.polygon([[e+s/2,i],[e+s,i+o/2],[e+s/2,i+o],[e,i+o/2]],this.options)}else hO(e,"diamond",this.xywh,this.options)}}class hD extends hP{draw(e,t){if("Scribbled"===this.shapeStyle){let[e,i,s,o]=this.xywh;t.ellipse(e+s/2,i+o/2,s,o,this.options)}else hO(e,"ellipse",this.xywh,this.options)}}class hZ extends hP{draw(e,t){if("Scribbled"===this.shapeStyle){let[e,i,s,o]=this.xywh,r=Math.min(.1*s,.1*o),a=e+r,n=e+s-r,l=i+r,c=i+o-r,d=` M${a},${i} L${n},${i} A${r},${r} 0 0 1 ${n},${l} L${n},${c} A${r},${r} 0 0 1 ${n-r},${c} L${a+r},${c} A${r},${r} 0 0 1 ${a},${c-r} L${a},${l} A${r},${r} 0 0 1 ${a+r},${i} `;t.path(d,this.options)}else hO(e,"roundedRect",this.xywh,this.options)}}class hj{static createShape(e,t,i,s){switch(t){case"rect":return new hH(e,t,i,s);case"triangle":return new hA(e,t,i,s);case"diamond":return new hL(e,t,i,s);case"ellipse":return new hD(e,t,i,s);case"roundedRect":return new hZ(e,t,i,s);default:throw Error(`Unknown shape type: ${t}`)}}}class hV extends v.hJ{constructor(e){super(),this.x=0,this.y=0,this.globalAlpha=0,this.edgeless=e,this.disposables=new eg.K,this.disposables.add(this.edgeless.service.viewport.viewportUpdated.on(()=>{let e=this.edgeless.tools.lastMousePos.x,t=this.edgeless.tools.lastMousePos.y,[i,s]=this.edgeless.service.viewport.toModelCoord(e,t);this.x=i,this.y=s}))}dispose(){this.disposables.dispose()}render(e,t){(0,td.lQ)()}}class hz extends hV{constructor(e,t,i,s){super(e);let o=[this.x,this.y,100,100],{shapeStyle:r,fillColor:a,strokeColor:n}=s,l=j.Q.getColorValue(a,a3.SO,!0),c=j.Q.getColorValue(n,a3.vt,!0);i.fill=l,i.stroke=c,this.shape=hj.createShape(o,t,i,r),this.disposables.add(this.edgeless.slots.edgelessToolUpdated.on(e=>{if("shape"!==e.type)return;let t=e.shapeType,s={...i},{x:o,y:a}=this;("roundedRect"===t||"rect"===t)&&(o+=6,a+=6);let n=[o,a,"roundedRect"===t?140:100,100];this.shape=hj.createShape(n,t,s,r),this.edgeless.surface.refresh()}))}render(e,t){e.globalAlpha=this.globalAlpha;let{x:i,y:s}=this,{type:o}=this.shape;("roundedRect"===o||"rect"===o)&&(i+=6,s+=6);let r=[i,s,"roundedRect"===o?140:100,100];this.shape.xywh=r,this.shape.draw(e,t)}}class hR extends hV{constructor(e,t){super(e),this.backgroundColor="transparent",this.text="",this.globalAlpha=0,this.backgroundColor=j.Q.getColorValue(t,W.KI,!0),this.disposables.add(this.edgeless.slots.edgelessToolUpdated.on(e=>{"affine:note"===e.type&&(this.text=this._getOverlayText(e.tip),this.edgeless.surface.refresh())}))}_getOverlayText(e){return e[0].toUpperCase()+e.slice(1)}render(e){e.globalAlpha=this.globalAlpha;let t=this.x+6,i=this.y+6;e.strokeStyle=j.Q.getPropertyValue("--affine-border-color"),e.fillStyle=this.backgroundColor,e.lineWidth=4,e.beginPath(),e.moveTo(t+6,i),e.lineTo(t+100-6,i),e.quadraticCurveTo(t+100,i,t+100,i+6),e.lineTo(t+100,i+50-6),e.quadraticCurveTo(t+100,i+50,t+100-6,i+50),e.lineTo(t+6,i+50),e.quadraticCurveTo(t,i+50,t,i+50-6),e.lineTo(t,i+6),e.quadraticCurveTo(t,i,t+6,i),e.closePath(),e.stroke(),e.fill(),e.fillStyle=j.Q.getPropertyValue("--affine-icon-color");let s=16;for(e.font=`${s}px Arial`,e.textAlign="left",e.textBaseline="middle";e.measureText(this.text).width>80;)s-=1,e.font=`${s}px Arial`;e.fillText(this.text,t+10,i+25)}}class hF extends hR{constructor(e,t){super(e,t),this.slots={draggingNoteUpdated:new a2.D},this.width=0,this.height=0,this.disposables.add(this.slots.draggingNoteUpdated.on(({xywh:e})=>{[this.x,this.y,this.width,this.height]=e,this.edgeless.surface.refresh()}))}render(e){e.globalAlpha=.8,e.fillStyle=this.backgroundColor,e.strokeStyle="rgba(0, 0, 0, 0.10)",e.lineWidth=2,e.beginPath(),e.roundRect(this.x,this.y,this.width,this.height,4),e.closePath(),e.fill(),e.stroke()}}!function(e){e[e.Right=0]="Right",e[e.Bottom=1]="Bottom",e[e.Left=2]="Left",e[e.Top=3]="Top"}(n||(n={}));class hN extends v.hJ{constructor(e){super(),this.xywh=e}render(e,t){}}class hq extends hN{constructor(e){super(e)}render(e,t){let[i,s,o,r]=this.xywh;e.globalAlpha=.4,e.strokeStyle="#1e96eb",e.lineWidth=1,e.strokeRect(i,s,o,r),e.font="15px sans-serif",e.fillStyle="#C0BFC1",e.textAlign="center",e.textBaseline="middle",e.fillText("Type '/' to insert",i+o/2,s+r/2)}}class hU extends hN{constructor(e,t){super(e),this._background=t}render(e,t){let[i,s,o,r]=this.xywh;e.globalAlpha=.4,e.fillStyle=this._background,e.strokeStyle="rgba(0, 0, 0, 0.10)",e.lineWidth=2,e.beginPath(),e.roundRect(i,s,o,r,8),e.closePath(),e.fill(),e.stroke(),e.font="15px sans-serif",e.fillStyle="black",e.textAlign="left",e.textBaseline="middle",e.fillText("Type '/' for command",i+24,s+r/2)}}class hW extends hN{constructor(e,t){super(e),this._strokeColor=t}render(e,t){let[i,s,o,r]=this.xywh,a=s-30-10;e.globalAlpha=.4,e.fillStyle="rgba(0, 0, 0, 0.8)",e.beginPath(),e.roundRect(i,a,72,30,4),e.closePath(),e.fill(),e.globalAlpha=1,e.font="14px sans-serif",e.fillStyle="white",e.textAlign="center",e.textBaseline="middle",e.fillText("Frame",i+36,a+15),e.globalAlpha=.4,e.strokeStyle=this._strokeColor,e.lineWidth=2,e.beginPath(),e.roundRect(i,s,o,r,8),e.closePath(),e.stroke()}}class hG extends v.hJ{constructor(e,t,i,s){super(),this._shape=hj.createShape(e,t,i,s)}render(e,t){e.globalAlpha=.4,this._shape.draw(e,t)}}function hY(e){let t,i;switch(e){case n.Right:t=[1,.5],i=[0,.5];break;case n.Bottom:t=[.5,1],i=[.5,0];break;case n.Left:t=[0,.5],i=[1,.5];break;case n.Top:t=[.5,0],i=[.5,1]}return{startPosition:t,endPosition:i}}function hK(e){return e instanceof tw.B5}var hX=i(64369),hQ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},hJ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-surface")],s=[],o=P.p_,r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;hQ(this,null,[(0,D.P)(".affine-edgeless-surface-block-container")],{kind:"accessor",name:"_surfaceContainer",static:!1,private:!1,access:{has:e=>"_surfaceContainer"in e,get:e=>e._surfaceContainer,set:(e,t)=>{e._surfaceContainer=t}},metadata:n},r,a),hQ(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.isConnector=e=>e instanceof tw.lw}static{this.isShape=hK}static{this.styles=(0,L.AH)` .affine-edgeless-surface-block-container { width: 100%; height: 100%; } .affine-edgeless-surface-block-container canvas { left: 0; top: 0; width: 100%; height: 100%; position: absolute; z-index: 1; pointer-events: none; transform-origin: 0 0; transform: var(--canvas-transform); } edgeless-block-portal-container { position: relative; box-sizing: border-box; overflow: hidden; display: block; height: 100%; font-family: var(--affine-font-family); font-size: var(--affine-font-base); line-height: var(--affine-line-height); color: var(--affine-text-primary-color); font-weight: 400; } .affine-block-children-container.edgeless { padding-left: 0; position: relative; overflow: hidden; height: 100%; /** * Fix: pointerEvent stops firing after a short time. * When a gesture is started, the browser intersects the touch-action values of the touched element and its ancestors, * up to the one that implements the gesture (in other words, the first containing scrolling element) * https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action */ touch-action: none; background-color: var(--affine-background-primary-color); background-image: radial-gradient( var(--affine-edgeless-grid-color) 1px, var(--affine-background-primary-color) 1px ); z-index: 0; } .affine-edgeless-block-child { position: absolute; transform-origin: center; box-sizing: border-box; border: 2px solid var(--affine-white-10); border-radius: 8px; box-shadow: var(--affine-shadow-3); pointer-events: all; } `}_getReversedTransform(){let{translateX:e,translateY:t,zoom:i}=this.edgeless.service.viewport;return`scale(${1/i}) translate(${-e}px, ${-t}px)`}_initOverlay(){this.overlays={connector:new tC.TG(this.edgeless.service),frame:new aq},(0,sk.zu)(this.overlays).forEach(e=>{this._renderer.addOverlay(e)})}_initRenderer(){let e=this.edgeless.service;this._renderer=new hX.A({viewport:e.viewport,layerManager:e.layer,enableStackingCanvas:!0,provider:{generateColorProperty:(e,t)=>j.Q.generateColorProperty(e,t),getColorValue:(e,t,i)=>j.Q.getColorValue(e,t,i),getColorScheme:()=>j.Q.mode,getPropertyValue:e=>j.Q.getPropertyValue(e),selectedElements:()=>e.selection.selectedIds},onStackingCanvasCreated(e){e.className="indexable-canvas"}}),this._disposables.add(this.model.elementUpdated.on(e=>{e.props.externalXYWH||this._renderer.refresh()})),this._disposables.add(this.model.elementAdded.on(()=>{this._renderer.refresh()})),this._disposables.add(this.model.elementRemoved.on(()=>{this._renderer.refresh()})),this._disposables.add(()=>{this._renderer.dispose()}),this._disposables.add(this._renderer.stackingCanvasUpdated.on(e=>{e.added.length&&this._surfaceContainer.append(...e.added),e.removed.length&&e.removed.forEach(e=>{e.remove()})})),this._disposables.add(e.selection.slots.updated.on(()=>{this._renderer.refresh()}))}connectedCallback(){super.connectedCallback(),this.setAttribute(P.vz.rangeSyncExcludeAttr,"true"),this._initThemeObserver(),this._initRenderer(),this._initOverlay()}firstUpdated(){this._renderer.attach(this._surfaceContainer),this._surfaceContainer.append(...this._renderer.stackingCanvas),this._initCanvasTransform()}render(){return(0,L.qy)`
`}get edgeless(){return this.parentBlock}get renderer(){return this._renderer}#ar;get _surfaceContainer(){return this.#ar}set _surfaceContainer(e){this.#ar=e}constructor(){super(...arguments),this._cachedViewport=new p.z,this._initCanvasTransform=()=>{let e=()=>{this._surfaceContainer.style.setProperty("--canvas-transform",this._getReversedTransform())};this._disposables.add(this.edgeless.service.viewport.viewportUpdated.on(()=>{e()})),e()},this._initThemeObserver=()=>{this.disposables.add(j.Q.subscribe(()=>this.requestUpdate()))},this._lastTime=0,this.fitToViewport=e=>{let{viewport:t}=this.edgeless.service;e=e.expand(30),Date.now()-this._lastTime>200&&(this._cachedViewport=t.viewportBounds),this._lastTime=Date.now(),this._cachedViewport.contains(e)||(this._cachedViewport=this._cachedViewport.unite(e),t.setViewportByBound(this._cachedViewport,[0,0,0,0],!0))},this.refresh=()=>{this._renderer?.refresh()},this.#ar=hJ(this,r,void 0),hJ(this,a)}static{hJ(t,s)}})})();var h1=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},h0=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("note-slicer")],n=[],l=(0,P.Tm)(L.WF),c=[],d=[],p=[],f=[],g=[],m=[],v=[],y=[];(class extends l{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.MZ)({attribute:!1})],h1(this,null,i,{kind:"accessor",name:"_activeSlicerIndex",static:!1,private:!1,access:{has:e=>"_activeSlicerIndex"in e,get:e=>e._activeSlicerIndex,set:(e,t)=>{e._activeSlicerIndex=t}},metadata:h},c,d),h1(this,null,s,{kind:"accessor",name:"_anchorNote",static:!1,private:!1,access:{has:e=>"_anchorNote"in e,get:e=>e._anchorNote,set:(e,t)=>{e._anchorNote=t}},metadata:h},p,f),h1(this,null,o,{kind:"accessor",name:"_enableNoteSlicer",static:!1,private:!1,access:{has:e=>"_enableNoteSlicer"in e,get:e=>e._enableNoteSlicer,set:(e,t)=>{e._enableNoteSlicer=t}},metadata:h},g,m),h1(this,null,r,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:h},v,y),h1(null,e={value:t},a,{kind:"class",name:t.name,metadata:h},null,n),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=h2}get _editorHost(){return this.edgeless.host}get _noteBlock(){return this._editorHost&&this._editorHost.view.viewFromPath("block",(0,O.UL)(this._anchorNote))||null}get _selection(){return this.edgeless.service.selection}_sliceNote(){if(!this._anchorNote||!this._noteBlockIds.length)return;let e=this.edgeless.doc,{index:t,xywh:i,background:s,children:o,displayMode:r}=this._anchorNote,{collapse:a,collapsedHeight:n,...l}=this._anchorNote.edgeless,c=this._noteBlockIds[this._activeSlicerIndex];if(!c)return;let d=o.findIndex(e=>e.id===c),u=o.slice(d+1),[p,,f]=(0,h.W)(i),g=this._divingLinePositions[this._activeSlicerIndex].y,m=this.edgeless.service.viewport.toModelCoord(p,g)[1],v=this.edgeless.service.addBlock("affine:note",{background:s,displayMode:r,xywh:(0,h.P)(p,m+40,f,72),index:t+1,edgeless:l},e.root?.id);e.moveBlocks(u,e.getBlockById(v)),this._activeSlicerIndex=0,this._selection.set({elements:[v],editing:!1}),this.edgeless.service.telemetryService?.track("SplitNote",{control:"NoteSlicer"})}_updateActiveSlicerIndex(e){let{_divingLinePositions:t}=this,i=e.y+4*this._zoom,s=-1;for(let e=0;e0?t[e-1].y:0))/2);e++)s++;s<0&&(s=0),this._activeSlicerIndex=s}_updateDivingLineAndBlockIds(){if(!this._anchorNote||!this._noteBlock){this._divingLinePositions=[],this._noteBlockIds=[];return}let e=[],t=[],i=this._noteBlock.getBoundingClientRect(),s=i.top,o=i.bottom;for(let i=0;is&&a.bottom{this._hidden&&(this._hidden=!1);let t=e.get("pointerState"),i=new u.b(t.x,t.y);this._updateActiveSlicerIndex(i)})),e.add(t.service.viewport.viewportUpdated.on(()=>{this._hidden=!0,this.requestUpdate()})),e.add(t.service.selection.slots.updated.on(()=>{this._enableNoteSlicer=!1,this._updateSlicedNote(),this.selectedRectEle&&(this.selectedRectEle.autoCompleteOff=!1)})),e.add(t.slots.toggleNoteSlicer.on(()=>{this._enableNoteSlicer=!this._enableNoteSlicer,this.selectedRectEle&&this._enableNoteSlicer&&(this.selectedRectEle.autoCompleteOff=!0)}));let{surface:i}=this.edgeless;requestAnimationFrame(()=>{i.isConnected&&i.edgeless.dispatcher&&e.add(i.edgeless.dispatcher.add("click",e=>{let{raw:t}=e.get("pointerState"),i=t.target;return!!i&&!!i.closest("note-slicer")&&(this._sliceNote(),!0)}))})}disconnectedCallback(){super.disconnectedCallback(),this.disposables.dispose(),this._noteDisposables?.dispose(),this._noteDisposables=null}firstUpdated(){this.edgeless.service&&this.disposables.add(this.edgeless.service.uiEventDispatcher.add("wheel",()=>{this._hidden=!0,this.requestUpdate()}))}render(){if(this.edgeless.doc.readonly||this._hidden||!this._anchorNote||!this._enableNoteSlicer)return L.s6;this._updateDivingLineAndBlockIds();let e=this._noteBlock;if(!e||!this._divingLinePositions.length)return L.s6;let t=(0,O.wH)(e).width,i=this._divingLinePositions[this._activeSlicerIndex];return(0,L.qy)`
${sm.GJ}
${this._divingLinePositions.map((e,i)=>{let s=(0,sZ.H)({"note-slicer-dividing-line-container":!0,active:i===this._activeSlicerIndex});return(0,L.qy)`
`})}
`}updated(e){super.updated(e),e.has("anchorNote")&&(this._noteDisposables?.dispose(),this._noteDisposables=null,this._anchorNote&&(this._noteDisposables=new eg.K,this._noteDisposables.add(this._anchorNote.propsUpdated.on(({key:e})=>{("children"===e||"xywh"===e)&&this.requestUpdate()}))))}get selectedRectEle(){return this.edgeless.querySelector("edgeless-selected-rect")}#aa;get _activeSlicerIndex(){return this.#aa}set _activeSlicerIndex(e){this.#aa=e}#an;get _anchorNote(){return this.#an}set _anchorNote(e){this.#an=e}#al;get _enableNoteSlicer(){return this.#al}set _enableNoteSlicer(e){this.#al=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}constructor(){super(...arguments),this._divingLinePositions=[],this._hidden=!1,this._noteBlockIds=[],this._noteDisposables=null,this.#aa=h0(this,c,0),this.#an=(h0(this,d),h0(this,p,null)),this.#al=(h0(this,f),h0(this,g,!1)),this.#i_=(h0(this,m),h0(this,v,void 0)),h0(this,y)}static{h0(t,n)}})})();var h5=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},h7=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("edgeless-navigator-black-background")],a=[],n=(0,P.Tm)(L.WF),l=[],c=[],d=[],h=[],u=[],f=[];(class extends n{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.wk)()],o=[(0,D.wk)()],h5(this,null,i,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:p},l,c),h5(this,null,s,{kind:"accessor",name:"frame",static:!1,private:!1,access:{has:e=>"frame"in e,get:e=>e.frame,set:(e,t)=>{e.frame=t}},metadata:p},d,h),h5(this,null,o,{kind:"accessor",name:"show",static:!1,private:!1,access:{has:e=>"show"in e,get:e=>e.show,set:(e,t)=>{e.show=t}},metadata:p},u,f),h5(null,e={value:t},r,{kind:"class",name:t.name,metadata:p},null,a),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=(0,L.AH)` .edgeless-navigator-black-background { background-color: black; position: absolute; z-index: 1; background-color: transparent; box-shadow: 0 0 0 5000px black; } `}_tryLoadBlackBackground(){let e=this.edgeless.service.editPropsStore.getStorage("presentBlackBackground");this._blackBackground=e??!0}firstUpdated(){let{_disposables:e,edgeless:t}=this;e.add(t.slots.navigatorFrameChanged.on(e=>{this.frame=e})),e.add(t.slots.navigatorSettingUpdated.on(({blackBackground:e})=>{void 0!==e&&(this.edgeless.service.editPropsStore.setStorage("presentBlackBackground",e),this._blackBackground=e,this.show=e&&"frameNavigator"===t.edgelessTool.type)})),e.add(t.slots.edgelessToolUpdated.on(e=>{"frameNavigator"!==e.type?this.show=!1:this.show=this._blackBackground})),e.add(t.slots.fullScreenToggled.on(()=>setTimeout(()=>{this.requestUpdate()},500))),this._tryLoadBlackBackground()}render(){let{edgeless:e,frame:t,show:i}=this;if(!i||!t)return L.s6;let s=p.z.deserialize(t.xywh),o=e.service.viewport.zoom,r=s.w*o,a=s.h*o,[n,l]=e.service.viewport.toViewCoord(s.x,s.y);return(0,L.qy)`
`}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#ac;get frame(){return this.#ac}set frame(e){this.#ac=e}#ad;get show(){return this.#ad}set show(e){this.#ad=e}constructor(){super(...arguments),this._blackBackground=!1,this.#i_=h7(this,l,void 0),this.#ac=(h7(this,c),h7(this,d,void 0)),this.#ad=(h7(this,h),h7(this,u,!1)),h7(this,f)}static{h7(t,a)}})})();var h3=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},h4=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-dragging-area-rect")],s=[],o=(0,P.Tm)(L.WF),r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;h3(this,null,[(0,D.MZ)({attribute:!1})],{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:n},r,a),h3(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` .affine-edgeless-dragging-area { position: absolute; background: var(--affine-hover-color); z-index: 1; pointer-events: none; } `}firstUpdated(){this._disposables.add(this.edgeless.slots.draggingAreaUpdated.on(()=>this.requestUpdate()))}render(){let e=this.edgeless.tools.draggingArea;if(null===e)return L.s6;let t={left:e.left+"px",top:e.top+"px",width:e.width+"px",height:e.height+"px"};return(0,L.qy)`
`}#i_=h4(this,r,void 0);get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}constructor(){super(...arguments),h4(this,a)}static{h4(t,s)}})})();var h6=i(9013);let h8=(0,L.AH)` .affine-embed-html-block { margin: 0 auto; box-sizing: border-box; width: 100%; height: 100%; display: flex; padding: 12px; flex-direction: column; align-items: flex-start; gap: 20px; border-radius: 12px; border: 1px solid var(--affine-background-tertiary-color); opacity: var(--add, 1); background: var(--affine-background-primary-color); user-select: none; } .affine-embed-html { width: 100%; height: calc(100% - 20px - 22px); opacity: var(--add, 1); } .affine-embed-html img, .affine-embed-html object, .affine-embed-html svg { width: 100%; height: 100%; object-fit: cover; border-radius: 4px 4px var(--1, 0px) var(--1, 0px); } .affine-embed-html-iframe-container { position: relative; width: 100%; height: 100%; border-radius: 4px 4px 0px 0px; box-shadow: var(--affine-shadow-1); overflow: hidden; } .embed-html-block-iframe-wrapper { position: relative; width: 100%; height: 100%; } .embed-html-block-iframe-wrapper > iframe { width: 100%; height: 100%; border: none; } .embed-html-block-iframe-wrapper affine-menu { min-width: 296px; } .embed-html-block-iframe-wrapper affine-menu .settings-header { padding: 7px 12px; font-weight: 500; font-size: var(--affine-font-xs); color: var(--affine-text-secondary-color); } .embed-html-block-iframe-wrapper > embed-html-fullscreen-toolbar { visibility: hidden; } .embed-html-block-iframe-wrapper:fullscreen > embed-html-fullscreen-toolbar { visibility: visible; } .affine-embed-html-iframe-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .affine-embed-html-iframe-overlay.hide { display: none; } .affine-embed-html-title { display: flex; align-items: center; gap: 8px; padding: var(--1, 0px); border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-embed-html-title-icon { display: flex; width: 20px; height: 20px; justify-content: center; align-items: center; } .affine-embed-html-title-icon img, .affine-embed-html-title-icon object, .affine-embed-html-title-icon svg { width: 20px; height: 20px; fill: var(--affine-background-primary-color); } .affine-embed-html-title-text { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-word; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 600; line-height: 22px; } `,h9=(0,L.qy)` `;var ue=i(14086),ut=i(45598),ui=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},us=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("edgeless-auto-complete-panel")],l=[],c=(0,P.Tm)(L.WF),d=[],u=[],g=[],m=[],y=[],b=[],w=[],x=[];return class extends c{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],ui(this,null,i,{kind:"accessor",name:"connector",static:!1,private:!1,access:{has:e=>"connector"in e,get:e=>e.connector,set:(e,t)=>{e.connector=t}},metadata:n},d,u),ui(this,null,s,{kind:"accessor",name:"currentSource",static:!1,private:!1,access:{has:e=>"currentSource"in e,get:e=>e.currentSource,set:(e,t)=>{e.currentSource=t}},metadata:n},g,m),ui(this,null,o,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:n},y,b),ui(this,null,r,{kind:"accessor",name:"position",static:!1,private:!1,access:{has:e=>"position"in e,get:e=>e.position,set:(e,t)=>{e.position=t}},metadata:n},w,x),ui(null,e={value:t},a,{kind:"class",name:t.name,metadata:n},null,l),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` .auto-complete-panel-container { position: absolute; display: flex; width: 136px; flex-wrap: wrap; align-items: center; justify-content: center; padding: 8px 0; gap: 8px; border-radius: 8px; background: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-shadow-2); z-index: 1; } .row-button { display: flex; align-items: center; justify-content: center; width: 120px; height: 28px; padding: 4px 0; text-align: center; border-radius: 8px; font-family: ${(0,L.iz)(iW.$7.fontSansFamily)}; font-size: 12px; font-style: normal; font-weight: 500; border: 1px solid var(--affine-border-color, #e3e2e4); box-sizing: border-box; } `}constructor(e,t,i,s){super(),this._overlay=null,this.#ix=us(this,d,void 0),this.#ah=(us(this,u),us(this,g,void 0)),this.#i_=(us(this,m),us(this,y,void 0)),this.#au=(us(this,b),us(this,w,void 0)),us(this,x),this.position=e,this.edgeless=t,this.currentSource=i,this.connector=s}_addFrame(){let e=this._generateTarget(this.connector)?.nextBound;if(!e)return;let{h:t}=e,i=this._getTargetXYWH(t/.75,t);if(!i)return;let{xywh:s,position:o}=i,r=this.edgeless,{service:a,surfaceBlockModel:n}=r,l=a.layer.frames.length+1,c=a.addBlock("affine:frame",{title:new f.rl.Y.Text(`Frame ${l}`),xywh:(0,h.P)(...s)},n);r.doc.captureSync();let d=a.getElementById(c);(0,H.Z1)(d),this.connector.target={id:c,position:o},r.service.selection.set({elements:[d.id],editing:!1})}_addNote(){let{doc:e}=this.edgeless,t=this.edgeless.service,i=this._getTargetXYWH(448,110);if(!i)return;let{xywh:s,position:o}=i,r=W.KI;if(hK(this.currentSource)){if("object"==typeof this.currentSource.fillColor)r={...this.currentSource.fillColor};else{let e=this.currentSource.fillColor.split("-").pop();e&&"gray"!==e||(e="grey"),r=`--affine-note-background-${e}`}}else r="object"==typeof this.currentSource.background?{...this.currentSource.background}:this.currentSource.background;let a=t.addBlock("affine:note",{xywh:(0,h.P)(...s),background:r},e.root?.id);e.addBlock("affine:paragraph",{type:"text"},a);let n=this.currentSource.group;n instanceof v.$f&&n.addChild(a),this.connector.target={id:a,position:o},t.updateElement(this.connector.id,{target:{id:a,position:o}}),this.edgeless.service.selection.set({elements:[a],editing:!1})}_addShape(e){let t=this.edgeless,i=this._generateTarget(this.connector);if(!i)return;let s=this.currentSource,{nextBound:o,position:r}=i,{service:a}=t,n=function(e,t,i){let s=e.service,o=hK(t)?t.serialize():e.service.editPropsStore.getLastProps("shape"),r=s.addElement("shape",{...o,shapeType:"roundedRect"===i?"rect":i,radius:"roundedRect"===i?.1:0,text:new f.rl.Y.Text}),a=t.group;return a instanceof tw.$f&&a.addChild(r),r}(t,s,e);a.updateElement(n,{xywh:o.serialize()}),a.updateElement(this.connector.id,{target:{id:n,position:r}}),iu(a.getElementById(n),this.edgeless),t.service.selection.set({elements:[n],editing:!0}),t.doc.captureSync()}_addText(){let e=this._getTargetXYWH(116,24);if(!e)return;let{xywh:t,position:i}=e,s=p.z.fromXYWH(t),o=this.edgeless.service;if(this.edgeless.doc.awarenessStore.getFlag("enable_edgeless_text")){let e=this.edgeless.host.spec.getService("affine:edgeless-text").initEdgelessTextBlock({edgeless:this.edgeless,x:s.x,y:s.y});o.updateElement(this.connector.id,{target:{id:e,position:i}}),this.currentSource.group instanceof v.$f&&this.currentSource.group.addChild(e),this.edgeless.service.selection.set({elements:[e],editing:!1}),this.edgeless.doc.captureSync()}else{let e=o.addElement(tw.J9.TEXT,{xywh:s.serialize(),text:new f.rl.Y.Text,textAlign:"left",fontSize:24,fontFamily:tI.ay.Inter,color:tD(),fontWeight:tI.IT.Regular,fontStyle:tI.zz.Normal}),t=o.getElementById(e);(0,H.nn)(t,tw.n6),o.updateElement(this.connector.id,{target:{id:e,position:i}}),this.currentSource.group instanceof v.$f&&this.currentSource.group.addChild(e),this.edgeless.service.selection.set({elements:[e],editing:!1}),this.edgeless.doc.captureSync(),ih(t,this.edgeless)}}_autoComplete(e){if(this._removeOverlay(),this._connectorExist()){switch(e){case"text":this._addText();break;case"note":this._addNote();break;case"frame":this._addFrame();break;default:this._addShape(e)}this.remove()}}_connectorExist(){return!!this.edgeless.service.getElementById(this.connector.id)}_generateTarget(e){let t,i,s;let{currentSource:o}=this,r=100,a=100;if(hK(o)){let e=p.z.deserialize(o.xywh);r=e.w,a=e.h}let l=e.target.position;(0,H.Z1)(l);let c=e.path.length,d=(0,v.z)((0,v.ct)(tm.l.angle(e.path[c-2],e.path[c-1])));return d>=45&&d<=135?(t=new p.z(l[0]-r/2,l[1],r,a),i=[.5,0],s=n.Bottom):d>=135&&d<=225?(t=new p.z(l[0]-r,l[1]-a/2,r,a),i=[1,.5],s=n.Left):d>=225&&d<=315?(t=new p.z(l[0]-r/2,l[1]-a,r,a),i=[.5,1],s=n.Top):(t=new p.z(l[0],l[1]-a/2,r,a),i=[0,.5],s=n.Right),{nextBound:t,position:i,direction:s}}_getCurrentSourceInfo(){let{currentSource:e}=this;if(hK(e)){let{shapeType:t,shapeStyle:i,radius:s}=e;return{style:i,type:"rect"===t&&s?"roundedRect":t}}return{style:"General",type:"note"}}_getPanelPosition(){let{viewport:e}=this.edgeless.service,{boundingClientRect:t,zoom:i}=e,s=this._getTargetXYWH(136/i,108/i),o=s?s.xywh.slice(0,2):this.position,r=e.toViewCoord(o[0],o[1]),{width:a,height:n}=t;return r[0]=(0,v.qE)(r[0],20,a-20-136),r[1]=(0,v.qE)(r[1],20,n-20-108),r}_getTargetXYWH(e,t){let i=this._generateTarget(this.connector);if(!i)return null;let{nextBound:s,direction:o,position:r}=i;if(!s)return null;let{w:a,h:l}=s,c=s.x,d=s.y;switch(o){case n.Right:d+=l/2-t/2;break;case n.Bottom:c-=e/2-a/2;break;case n.Left:d+=l/2-t/2,c-=e-a;break;case n.Top:c-=e/2-a/2,d+=l-t}return{xywh:[c,d,e,t],position:r}}_removeOverlay(){this._overlay&&this.edgeless.surface.renderer.removeOverlay(this._overlay)}_showFrameOverlay(){let e=this._generateTarget(this.connector)?.nextBound;if(!e)return;let{h:t}=e,i=this._getTargetXYWH(t/.75,t)?.xywh;if(!i)return;let s=j.Q.getPropertyValue("--affine-black-30");this._overlay=new hW(i,s),this.edgeless.surface.renderer.addOverlay(this._overlay)}_showNoteOverlay(){let e=this._getTargetXYWH(448,110)?.xywh;if(!e)return;let t="";t=hK(this.currentSource)?j.Q.getColorValue(this.currentSource.fillColor,a3.SO,!0):j.Q.getColorValue(this.currentSource.background,W.KI,!0),this._overlay=new hU(e,t),this.edgeless.surface.renderer.addOverlay(this._overlay)}_showOverlay(e){if(this._removeOverlay(),this._connectorExist()){switch(e){case"text":this._showTextOverlay();break;case"note":this._showNoteOverlay();break;case"frame":this._showFrameOverlay();break;default:this._showShapeOverlay(e)}this.edgeless.surface.refresh()}}_showShapeOverlay(e){let t=this._generateTarget(this.connector)?.nextBound;if(!t)return;let{x:i,y:s,w:o,h:r}=t,{shapeStyle:a,strokeColor:n,fillColor:l,strokeWidth:c,roughness:d}=hK(this.currentSource)?this.currentSource:this.edgeless.service.editPropsStore.getLastProps("shape"),h=j.Q.getColorValue(n,a3.vt,!0),u=j.Q.getColorValue(l,a3.SO,!0);this._overlay=new hG([i,s,o,r],e,{seed:666,roughness:d,strokeLineDash:[0,0],stroke:h,strokeWidth:c,fill:u},a),this.edgeless.surface.renderer.addOverlay(this._overlay)}_showTextOverlay(){let e=this._getTargetXYWH(116,24)?.xywh;e&&(this._overlay=new hq(e),this.edgeless.surface.renderer.addOverlay(this._overlay))}connectedCallback(){super.connectedCallback(),this.edgeless.handleEvent("click",e=>{let{target:t}=e.get("pointerState").raw,i=i8(t);i?.closest("edgeless-auto-complete-panel")||this.remove()})}disconnectedCallback(){super.disconnectedCallback(),this._removeOverlay()}firstUpdated(){this.disposables.add(this.edgeless.service.viewport.viewportUpdated.on(()=>this.requestUpdate()))}render(){let e=this._getPanelPosition();if(!e)return L.s6;let t=(0,Z.W)({left:`${e[0]}px`,top:`${e[1]}px`}),{style:i,type:s}=this._getCurrentSourceInfo(),o=(0,t$.u)(dO,({name:e,generalIcon:t,scribbledIcon:s,tooltip:o})=>(0,L.qy)` this._showOverlay(e)} @pointerleave=${()=>this._removeOverlay()} @click=${()=>this._autoComplete(e)} > ${"General"===i?t:s} `);return(0,L.qy)`
${o} this._showOverlay("text")} @pointerleave=${()=>this._removeOverlay()} @click=${()=>this._autoComplete("text")} > ${sv.NQ} this._showOverlay("note")} @pointerleave=${()=>this._removeOverlay()} @click=${()=>this._autoComplete("note")} > ${sm.Hx} this._showOverlay("frame")} @pointerleave=${()=>this._removeOverlay()} @click=${()=>this._autoComplete("frame")} > ${sm.H0} this._showOverlay(s)} @pointerleave=${()=>this._removeOverlay()} @click=${()=>this._autoComplete(s)} >
Add a same object
`}#ix;get connector(){return this.#ix}set connector(e){this.#ix=e}#ah;get currentSource(){return this.#ah}set currentSource(e){this.#ah=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#au;get position(){return this.#au}set position(e){this.#au=e}static{us(t,l)}},t})();var ur=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ua=function(e,t,i){for(var s=arguments.length>2,o=0;o{0===i?e.moveTo(t[0],t[1]):e.lineTo(t[0],t[1])}),e.stroke(),this.renderShape(e),e.stroke())}}(()=>{let e,t,i,s,o,r,a,l=[(0,D.EM)("edgeless-auto-complete")],c=[],d=(0,P.Tm)(L.WF),h=[],u=[],g=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[];(class extends d{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],ur(this,null,i,{kind:"accessor",name:"_isHover",static:!1,private:!1,access:{has:e=>"_isHover"in e,get:e=>e._isHover,set:(e,t)=>{e._isHover=t}},metadata:n},h,u),ur(this,null,s,{kind:"accessor",name:"_isMoving",static:!1,private:!1,access:{has:e=>"_isMoving"in e,get:e=>e._isMoving,set:(e,t)=>{e._isMoving=t}},metadata:n},g,y),ur(this,null,o,{kind:"accessor",name:"current",static:!1,private:!1,access:{has:e=>"current"in e,get:e=>e.current,set:(e,t)=>{e.current=t}},metadata:n},b,w),ur(this,null,r,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:n},x,_),ur(this,null,a,{kind:"accessor",name:"selectedRect",static:!1,private:!1,access:{has:e=>"selectedRect"in e,get:e=>e.selectedRect,set:(e,t)=>{e.selectedRect=t}},metadata:n},C,k),ur(null,e={value:t},l,{kind:"class",name:t.name,metadata:n},null,c),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` .edgeless-auto-complete-container { position: absolute; z-index: 1; pointer-events: none; } .edgeless-auto-complete-arrow-wrapper { width: 72px; height: 44px; position: absolute; z-index: 1; pointer-events: auto; display: flex; align-items: center; justify-content: center; } .edgeless-auto-complete-arrow-wrapper.hidden { display: none; } .edgeless-auto-complete-arrow { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 19px; cursor: pointer; pointer-events: auto; transition: background 0.3s linear, box-shadow 0.2s linear; } .edgeless-auto-complete-arrow-wrapper:hover > .edgeless-auto-complete-arrow { border: 1px solid var(--affine-border-color); box-shadow: var(--affine-shadow-1); background: var(--affine-white); } .edgeless-auto-complete-arrow-wrapper > .edgeless-auto-complete-arrow:hover { border: 1px solid var(--affine-white-10); box-shadow: var(--affine-shadow-1); background: var(--affine-primary-color); } .edgeless-auto-complete-arrow-wrapper.mindmap > .edgeless-auto-complete-arrow { border: 1px solid var(--affine-border-color); box-shadow: var(--affine-shadow-1); background: var(--affine-white); transition: background 0.3s linear, color 0.2s linear; } .edgeless-auto-complete-arrow-wrapper.mindmap > .edgeless-auto-complete-arrow:hover { border: 1px solid var(--affine-white-10); box-shadow: var(--affine-shadow-1); background: var(--affine-primary-color); } .edgeless-auto-complete-arrow svg { fill: #77757d; color: #77757d; } .edgeless-auto-complete-arrow:hover svg { fill: #ffffff; color: #ffffff; } `}_addConnector(e,t){let{current:i,edgeless:s}=this,o=tj;if(hK(i))o="object"==typeof i.strokeColor?{...i.strokeColor}:i.strokeColor;else if("object"==typeof i.background)o={...i.background};else{let e=i.background.split("-").pop();e&&"gray"!==e||(e="grey"),o=`--affine-palette-line-${e}`}let r=s.service.addElement(v.J9.CONNECTOR,{mode:tb.B1.Orthogonal,strokeWidth:2,stroke:o,source:e,target:t});return s.service.getElementById(r)}_addMindmapNode(e,t){let i=this.current.group;if(!(i instanceof ut.AR))return;let s="sibling"===t?i.getParentNode(this.current.id)??this.current:this.current,o=i.addNode(s.id,"sibling"===t?this.current.id:void 0,void 0,void 0,e);requestAnimationFrame(()=>{iu(this.edgeless.service.getElementById(o),this.edgeless)})}_computeLine(e,t,i){let s=this.current.elementBound,{startPosition:o,endPosition:r}=hY(e),a={xywh:i.serialize(),rotate:t.rotate,shapeType:t.shapeType},n=t.getRelativePointLocation(o),l=t.getRelativePointLocation.call(a,r);return this._pathGenerator.generateOrthogonalConnectorPath({startBound:s,endBound:i,startPoint:n,endPoint:l})}_computeNextBound(e){if(hK(this.current)){let t=this._getConnectedElements(this.current).filter(e=>e instanceof v.B5);return function(e,t,i){let s;let{x:o,y:r,w:a,h:l}=p.z.deserialize(t.xywh),c=0;switch(e){case n.Right:c=0;break;case n.Bottom:c=90;break;case n.Left:c=180;break;case n.Top:c=270}function d(e){return!i.some(t=>e.isOverlapWithBound(t.elementBound))}s=(c=(0,v.z)(c+t.rotate))>=45&&c<=135?new p.z(o,r+l+100,a,l):c>=135&&c<=225?new p.z(o-a-100,r,a,l):c>=225&&c<=315?new p.z(o,r-l-100,a,l):new p.z(o+a+100,r,a,l);let h=0;return d(s)?s:function t(){let i=Math.ceil(++h/2),o=s.clone();switch(e){case n.Right:case n.Left:o.y=h%2==1?s.y-(l+20)*i:s.y+(l+20)*i;break;case n.Bottom:case n.Top:o.x=h%2==1?s.x-(a+20)*i:s.x+(a+20)*i}return d(o)?o:t()}()}(e,this.current,t)}{let t=this.current.elementBound;switch(e){case n.Right:t.x+=t.w+100;break;case n.Bottom:t.y+=t.h+100;break;case n.Left:t.x-=t.w+100;break;case n.Top:t.y-=t.h+100}return t}}_createAutoCompletePanel(e,t){if(!this.canShowAutoComplete)return;let i=new uo(this.edgeless.service.viewport.toModelCoord(e.clientX,e.clientY),this.edgeless,this.current,t);this.edgeless.append(i)}_generateElementOnClick(e){let{doc:t,service:i}=this.edgeless,s=this._computeNextBound(e),o=function(e,t,i){let s;let{service:o}=e;if(hK(t))s=o.addElement(t.type,{...t.serialize(),text:new f.rl.Y.Text,xywh:i.serialize()});else{let{doc:o}=e;s=o.addBlock("affine:note",{background:t.background,displayMode:t.displayMode,edgeless:t.edgeless,xywh:i.serialize()},e.model.id);let r=o.getBlockById(s);(0,H.Z1)(r),o.updateBlock(r,()=>{r.edgeless.collapse=!0}),o.addBlock("affine:paragraph",{},r.id)}let r=t.group;return r instanceof tw.$f&&r.addChild(s),s}(this.edgeless,this.current,s);if(hK(this.current)){let{startPosition:t,endPosition:s}=hY(e);this._addConnector({id:this.current.id,position:t},{id:o,position:s}),iu(i.getElementById(o),this.edgeless)}else{let e=t.getBlockById(o);(0,H.Z1)(e);let[r,a]=i.viewport.toViewCoord(s.center[0],s.y+45.5);requestAnimationFrame(()=>{(0,O.kW)(r,a)})}this.edgeless.service.selection.set({elements:[o],editing:!0}),this.removeOverlay()}_getConnectedElements(e){let t=this.edgeless.service;return t.getConnectors(e.id).reduce((i,s)=>(s.target.id===e.id&&s.source.id&&i.push(t.getElementById(s.source.id)),s.source.id===e.id&&s.target.id&&i.push(t.getElementById(s.target.id)),i),[])}_getMindmapButtons(){let e=this.current.group,t=this.current instanceof v.B5&&e instanceof ut.AR?e.getLayoutDir(this.current.id):null,i=e?.tree.id===this.current.id,s=null;switch(t){case tx.p5.LEFT:s=[[n.Left,"child",tx.p5.LEFT]],i||s.push([n.Bottom,"sibling",t]);break;case tx.p5.RIGHT:s=[[n.Right,"child",tx.p5.RIGHT]],i||s.push([n.Bottom,"sibling",t]);break;case tx.p5.BALANCE:s=[[n.Right,"child",tx.p5.RIGHT],[n.Left,"child",tx.p5.LEFT]];break;default:s=null}return s}_renderArrow(){let e=this.current instanceof v.B5,{selectedRect:t}=this,{zoom:i}=this.edgeless.service.viewport,s=e?[n.Right,n.Bottom,n.Left,n.Top]:[n.Right,n.Left],o=e?22:2/3*44;return s.map(s=>{let r="",a=e?G.D21:G.olE;switch(s){case n.Top:r+=`translate(${t.width/2}px, ${-o}px)`;break;case n.Right:r+=`translate(${t.width+o}px, ${t.height/2}px)`,e&&(r+="rotate(90deg)");break;case n.Bottom:r+=`translate(${t.width/2}px, ${t.height+o}px)`,e&&(r+="rotate(180deg)");break;case n.Left:r+=`translate(${-o}px, ${t.height/2}px)`,e&&(r+="rotate(-90deg)")}r+="translate(-36px, -22px)";let l=(0,sZ.H)({"edgeless-auto-complete-arrow-wrapper":!0,hidden:!e&&s===n.Left&&i>=1.5});return(0,L.qy)`
{this._timer=setTimeout(()=>{if(this.current instanceof v.B5){let e=this._computeNextBound(s),t=this._computeLine(s,this.current,e);this._showNextShape(this.current,e,t,this.current.shapeType)}},300)}} @mouseleave=${()=>{this.removeOverlay()}} @pointerdown=${e=>{this._onPointerDown(e,s)}} > ${a}
`})}_renderMindMapButtons(){let e=this._getMindmapButtons();if(!e)return;let{selectedRect:t}=this,{zoom:i}=this.edgeless.service.viewport;return e.map(e=>{let s="",[o,r,a]=e,l=a===tx.p5.LEFT,c="child"===r?G.kvU:G.Y3l;switch(o){case n.Bottom:s+=`translate(${t.width/2}px, ${t.height+22}px)`,l&&(s+="scale(-1)");break;case n.Right:s+=`translate(${t.width+22}px, ${t.height/2}px)`;break;case n.Left:s+=`translate(-22px, ${t.height/2}px)scale(-1)`}s+="translate(-36px, -22px)";let d=(0,sZ.H)({"edgeless-auto-complete-arrow-wrapper":!0,hidden:o===n.Left&&i>=1.5,mindmap:!0});return(0,L.qy)`
{this._addMindmapNode(a,r)}} > ${c}
`})}_showNextShape(e,t,i,s){let{surface:o}=this.edgeless;o.renderer.addOverlay(this._autoCompleteOverlay),this._autoCompleteOverlay.stroke=o.renderer.getColorValue(e.strokeColor,a3.vt,!0),this._autoCompleteOverlay.linePoints=i,this._autoCompleteOverlay.renderShape=i=>{m.e2[s].draw(i,{...t,rotate:e.rotate})},o.refresh()}get _surface(){return this.edgeless.surface}connectedCallback(){super.connectedCallback(),this._pathGenerator=new tC.IV({getElementById:e=>this.edgeless.service.getElementById(e)})}firstUpdated(){let{_disposables:e,edgeless:t}=this;e.add(this.edgeless.service.selection.slots.updated.on(()=>{this._autoCompleteOverlay.linePoints=[],this._autoCompleteOverlay.renderShape=null})),e.add(()=>this.removeOverlay()),e.add(t.host.event.add("pointerMove",()=>{let e=t.tools.getHoverState();if(!e){this._isHover=!1;return}this._isHover=e.content===this.current})),this.edgeless.handleEvent("dragStart",()=>{this._isMoving=!0}),this.edgeless.handleEvent("dragEnd",()=>{this._isMoving=!1})}removeOverlay(){this._timer&&clearTimeout(this._timer),this.edgeless.surface.renderer.removeOverlay(this._autoCompleteOverlay)}render(){let e=this.current instanceof v.B5,t=this.current.group instanceof ut.AR;if(this._isMoving||this._isHover&&!e)return this.removeOverlay(),L.s6;let{selectedRect:i}=this;return(0,L.qy)`
${t?this._renderMindMapButtons():this._renderArrow()}
`}get canShowAutoComplete(){let{current:e}=this;return hK(e)||(0,tE._h)(e)}#ap;get _isHover(){return this.#ap}set _isHover(e){this.#ap=e}#af;get _isMoving(){return this.#af}set _isMoving(e){this.#af=e}#ag;get current(){return this.#ag}set current(e){this.#ag=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#am;get selectedRect(){return this.#am}set selectedRect(e){this.#am=e}constructor(){super(...arguments),this._autoCompleteOverlay=new un,this._onPointerDown=(e,t)=>{let i;let{service:s}=this.edgeless,o=s.viewport.boundingClientRect,r=s.viewport.toModelCoord(e.clientX-o.left,e.clientY-o.top);this.edgeless.dispatcher&&(this._disposables.addFromEvent(document,"pointermove",e=>{let a=s.viewport.toModelCoord(e.clientX-o.left,e.clientY-o.top);if(tm.l.dist(r,a)>8&&!this._isMoving){if(!this.canShowAutoComplete)return;this._isMoving=!0;let{startPosition:e}=hY(t);i=this._addConnector({id:this.current.id,position:e},{position:a})}if(this._isMoving){(0,H.Z1)(i);let e=i.source.id;i.target=this._surface.overlays.connector.renderConnector(a,e?[e]:[])}}),this._disposables.addFromEvent(document,"pointerup",e=>{this._isMoving?i&&!i.target.id&&(this.edgeless.service.selection.clear(),this._createAutoCompletePanel(e,i)):this._generateElementOnClick(t),this._isMoving=!1,this._surface.overlays.connector.clear(),this._disposables.dispose(),this._disposables=new eg.K}))},this._timer=null,this.#ap=ua(this,h,!0),this.#af=(ua(this,u),ua(this,g,!1)),this.#ag=(ua(this,y),ua(this,b,void 0)),this.#i_=(ua(this,w),ua(this,x,void 0)),this.#am=(ua(this,_),ua(this,C,void 0)),ua(this,k)}static{ua(t,c)}})})();var ul=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},uc=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("edgeless-connector-handle")],n=[],l=(0,P.Tm)(L.WF),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.P)(".line-end")],s=[(0,D.P)(".line-start")],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],ul(this,null,i,{kind:"accessor",name:"_endHandler",static:!1,private:!1,access:{has:e=>"_endHandler"in e,get:e=>e._endHandler,set:(e,t)=>{e._endHandler=t}},metadata:v},c,d),ul(this,null,s,{kind:"accessor",name:"_startHandler",static:!1,private:!1,access:{has:e=>"_startHandler"in e,get:e=>e._startHandler,set:(e,t)=>{e._startHandler=t}},metadata:v},h,u),ul(this,null,o,{kind:"accessor",name:"connector",static:!1,private:!1,access:{has:e=>"connector"in e,get:e=>e.connector,set:(e,t)=>{e.connector=t}},metadata:v},p,f),ul(this,null,r,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:v},g,m),ul(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` .line-controller { position: absolute; width: ${12}px; height: ${12}px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--affine-text-emphasis-color); background-color: var(--affine-background-primary-color); cursor: pointer; z-index: 10; pointer-events: all; /** * Fix: pointerEvent stops firing after a short time. * When a gesture is started, the browser intersects the touch-action values of the touched element and its ancestors, * up to the one that implements the gesture (in other words, the first containing scrolling element) * https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action */ touch-action: none; } .line-controller-hidden { display: none; } `}_bindEvent(){let e=this.edgeless;this._disposables.addFromEvent(this._startHandler,"pointerdown",t=>{e.slots.elementResizeStart.emit(),this._capPointerDown(t,"source")}),this._disposables.addFromEvent(this._endHandler,"pointerdown",t=>{e.slots.elementResizeStart.emit(),this._capPointerDown(t,"target")}),this._disposables.add(()=>{e.surface.overlays.connector.clear()})}_capPointerDown(e,t){let{edgeless:i,connector:s,_disposables:o}=this,{service:r,surface:a}=i;e.stopPropagation(),o.addFromEvent(document,"pointermove",e=>{let i=r.viewport.toModelCoordFromClientCoord([e.x,e.y]),o=s["source"===t?"target":"source"].id;s[t]=a.overlays.connector.renderConnector(i,o?[o]:[]),this.requestUpdate()}),o.addFromEvent(document,"pointerup",()=>{a.overlays.connector.clear(),i.doc.captureSync(),o.dispose(),this._disposables=new eg.K,this._bindEvent(),i.slots.elementResizeEnd.emit()})}firstUpdated(){let{edgeless:e}=this,{viewport:t}=e.service;this._lastZoom=t.zoom,e.service.viewport.viewportUpdated.on(()=>{t.zoom!==this._lastZoom&&(this._lastZoom=t.zoom,this.requestUpdate())}),this._bindEvent()}render(){let{service:e}=this.edgeless,{path:t}=this.connector,i=e.viewport.zoom,s=tm.l.subScalar(tm.l.mul(t[0],i),6),o=tm.l.subScalar(tm.l.mul(t[t.length-1],i),6),r={transform:`translate3d(${s[0]}px,${s[1]}px,0)`},a={transform:`translate3d(${o[0]}px,${o[1]}px,0)`};return(0,L.qy)`
`}#av;get _endHandler(){return this.#av}set _endHandler(e){this.#av=e}#ay;get _startHandler(){return this.#ay}set _startHandler(e){this.#ay=e}#ix;get connector(){return this.#ix}set connector(e){this.#ix=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}constructor(){super(...arguments),this._lastZoom=1,this.#av=uc(this,c,void 0),this.#ay=(uc(this,d),uc(this,h,void 0)),this.#ix=(uc(this,u),uc(this,p,void 0)),this.#i_=(uc(this,f),uc(this,g,void 0)),uc(this,m)}static{uc(t,n)}})})();let ud=Math.PI/12;class uh{constructor(e,t,i,o){this._aspectRatio=1,this._bounds=new Map,this._currentRect=new DOMRect,this._dragDirection=s.Left,this._dragPos={start:{x:0,y:0},end:{x:0,y:0}},this._dragging=!1,this._locked=!1,this._origin={x:0,y:0},this._originalRect=new DOMRect,this._proportion=!1,this._proportional=!1,this._resizeMode="none",this._rotate=0,this._rotation=!1,this._shiftKey=!1,this._target=null,this._zoom=1,this.onPointerDown=(e,t,i=!1)=>{if(e.stopPropagation(),this._locked=!1,this._target=e.target,this._dragDirection=t,this._dragPos.start={x:e.x,y:e.y},this._dragPos.end={x:e.x,y:e.y},this._rotation=this._target.classList.contains("rotate"),this._proportional=i,this._rotation){let e=this._target.closest(".affine-edgeless-selected-rect")?.getBoundingClientRect();(0,H.Z1)(e);let{left:t,top:i,right:s,bottom:o}=e;this._origin={x:(t+s)/2,y:(i+o)/2}}this._dragging=!0,this._onDragStart();let s=({x:e,y:t,shiftKey:i})=>{if("none"===this._resizeMode)return;this._shiftKey=i,this._dragPos.end={x:e,y:t};let s=this._proportional||this._shiftKey;if(this._rotation){this._onRotate(s);return}this._onResize(s)},o=e=>{this._dragging=!1,this._onDragEnd();let{x:t,y:i,width:r,height:a}=this._currentRect;this._originalRect=new DOMRect(t,i,r,a),this._locked=!0,this._shiftKey=!1,this._rotation=!1,this._dragPos={start:{x:0,y:0},end:{x:0,y:0}},document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",o)};document.addEventListener("pointermove",s),document.addEventListener("pointerup",o)},this._onDragStart=e,this._onResizeMove=t,this._onRotateMove=i,this._onDragEnd=o}_onResize(e){let t;let{_aspectRatio:i,_dragDirection:o,_dragPos:r,_rotate:a,_resizeMode:n,_zoom:l,_target:c,_originalRect:d,_currentRect:h}=this;e||=this._proportion,(0,H.Z1)(c);let u="all"===n,f="corner"===n,g="edgeAndCorner"===n,{start:{x:m,y:y},end:{x:b,y:w}}=r,{left:x,top:_,right:C,bottom:k}=d,S={w:C-x,h:k-_,cx:(x+C)/2,cy:(_+k)/2},M={...S},E={x:1,y:1},I={x:1,y:1},B={x:1,y:1},$=new DOMPoint(0,0),T=new DOMPoint(0,0),O=(b-m)/l,P=new DOMMatrix().translateSelf(S.cx,S.cy).rotateSelf(a).translateSelf(-S.cx,-S.cy);if(f||u||g){switch(o){case s.TopLeft:B.x=-1,B.y=-1,$.x=C,$.y=k,T.x=x,T.y=_;break;case s.TopRight:B.x=1,B.y=-1,$.x=x,$.y=k,T.x=C,T.y=_;break;case s.BottomRight:B.x=1,B.y=1,$.x=x,$.y=_,T.x=C,T.y=k;break;case s.BottomLeft:B.x=-1,B.y=1,$.x=C,$.y=_,T.x=x,T.y=k;break;case s.Left:B.x=-1,B.y=1,$.x=C,$.y=S.cy,T.x=x,T.y=S.cy;break;case s.Right:B.x=1,B.y=1,$.x=x,$.y=S.cy,T.x=C,T.y=S.cy;break;case s.Top:{let e=(x+C)/2;B.x=1,B.y=-1,$.x=e,$.y=k,T.x=e,T.y=_;break}case s.Bottom:{let e=(x+C)/2;B.x=1,B.y=1,$.x=e,$.y=_,T.x=e,T.y=k}}e||=this._bounds.size>1;let t=$.matrixTransform(P),r=T.matrixTransform(P);if(r.x+=O,r.y+=(w-y)/l,o===s.Left||o===s.Right||o===s.Top||o===s.Bottom){let e=T.matrixTransform(P),t=[0,0],[[i,n]]=(0,v.Hb)([[e.x,e.y]],t,-a),[[l,c]]=(0,v.Hb)([[r.x,r.y]],t,-a),d={x:0,y:0};o===s.Left||o===s.Right?(d.x=l,d.y=n):(d.x=i,d.y=c);let[[h,u]]=(0,v.Hb)([[d.x,d.y]],t,a);r.x=h,r.y=u}let n=(t.x+r.x)/2,c=(t.y+r.y)/2,d=new DOMMatrix().translateSelf(n,c).rotateSelf(-a).translateSelf(-n,-c),h=t.matrixTransform(d),u=r.matrixTransform(d);switch(o){case s.TopLeft:M.w=h.x-u.x,M.h=h.y-u.y;break;case s.TopRight:M.w=u.x-h.x,M.h=h.y-u.y;break;case s.BottomRight:M.w=u.x-h.x,M.h=u.y-h.y;break;case s.BottomLeft:M.w=h.x-u.x,M.h=u.y-h.y;break;case s.Left:M.w=h.x-u.x;break;case s.Right:M.w=u.x-h.x;break;case s.Top:M.h=h.y-u.y;break;case s.Bottom:M.h=u.y-h.y}M.cx=(u.x+h.x)/2,M.cy=(u.y+h.y)/2,E.x=M.w/S.w,E.y=M.h/S.h,I.x=E.x<0?-1:1,I.y=E.y<0?-1:1;let p=o===s.TopLeft||o===s.TopRight||o===s.BottomRight||o===s.BottomLeft;e&&p&&(iMath.abs(M.w)&&(M.w=498*I.x,E.x=M.w/S.w,T.x=$.x+M.w*B.x),M.cx=(T.x+$.x)/2}let A=Math.abs(M.w),L=Math.abs(M.h),D=M.cx-A/2,Z=M.cy-L/2;h.x=D,h.y=Z,h.width=A,h.height=L;let j=new Map;if(f||u||g){if(1===this._bounds.size)t=(e,t)=>{j.set(t,{bound:new p.z(D,Z,A,L)})};else{let e=$.matrixTransform(P),i=new DOMMatrix().translateSelf(e.x,e.y).rotateSelf(a).translateSelf(-e.x,-e.y).scaleSelf(E.x,E.y,1,e.x,e.y,0).translateSelf(e.x,e.y).rotateSelf(-a).translateSelf(-e.x,-e.y);t=({bound:{x:e,y:t,w:s,h:o},path:r},a)=>{let n=new DOMPoint(e+s/2,t+o/2).matrixTransform(i),l=Math.abs(s*E.x),c=Math.abs(o*E.y);j.set(a,{bound:new p.z(n.x-l/2,n.y-c/2,l,c),matrix:i,path:r})}}}else{let e=new DOMMatrix().scaleSelf(E.x,E.y,1,$.x,$.y,0);t=({bound:{x:t,y:i,w:s,h:o},rotate:r=0,path:a},n)=>{let l,c;let u=t+s/2,f=i+o/2,g=new DOMPoint(u,f).matrixTransform(e);if(r){let{width:e}=(0,v.R$)({x:t,y:i,w:s,h:o,rotate:r}),a=e/2;if(g.y=f,h.width<=e)c=(l=s*(h.width/e))/(s/o),g.x=h.left+h.width/2;else{let e=(u-a-d.left)/d.width,t=h.left+e*h.width+a;g.x=Math.max(h.left+a,Math.min(t,h.left+h.width-a)),l=s,c=o}}else l=Math.abs(s*E.x),c=Math.abs(o*E.y);j.set(n,{bound:new p.z(g.x-l/2,g.y-c/2,l,c),matrix:e,path:a})}}this._bounds.forEach(t),this._onResizeMove(j,this._dragDirection)}_onRotate(e=!1){let{_originalRect:{left:t,top:i,right:s,bottom:o},_dragPos:{start:{x:r,y:a},end:{x:n,y:l}},_origin:{x:c,y:d},_rotate:h}=this,u=Math.atan2(a-d,r-c),p=Math.atan2(l-d,n-c)-u;if(e){let e=h*Math.PI/180,t=e+p;t+=ud/2,t-=t%ud,p=t-e}let f=180*p/Math.PI,g=n,m=l;if(e){let e=new DOMPoint(r,a).matrixTransform(new DOMMatrix().translateSelf(c,d).rotateSelf(f).translateSelf(-c,-d));g=e.x,m=e.y}this._onRotateMove({x:(t+s)/2,y:(i+o)/2},f),this._dragPos.start={x:g,y:m},this._rotate+=f}onPressShiftKey(e){if(!this._target||this._locked||this._shiftKey===e)return;this._shiftKey=e;let t=this._proportional||this._shiftKey;if(this._rotation){this._onRotate(t);return}this._onResize(t)}updateBounds(e){this._bounds=e}updateRectPosition(e){return this._currentRect.x+=e.x,this._currentRect.y+=e.y,this._originalRect.x=this._currentRect.x,this._originalRect.y=this._currentRect.y,this._originalRect}updateState(e,t,i,s,o,r=!1){this._resizeMode=e,this._rotate=t,this._zoom=i,this._proportion=r,s&&(this._currentRect.x=s.x,this._currentRect.y=s.y,this._originalRect.x=this._currentRect.x,this._originalRect.y=this._currentRect.y),o&&(this._originalRect=o,this._aspectRatio=o.width/o.height,this._currentRect=DOMRect.fromRect(o))}get bounds(){return this._bounds}get currentRect(){return this._currentRect}get dragDirection(){return this._dragDirection}get dragging(){return this._dragging}get originalRect(){return this._originalRect}get rotation(){return this._rotation}}var uu=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},up=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,o,r,a,n,l,c,d,u,f,m=[(0,D.EM)("edgeless-selected-rect")],y=[],b=(0,P.Tm)(L.WF),w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],A=[],j=[],V=[],z=[],R=[],F=[],N=[];(class extends b{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(b[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.wk)()],a=[(0,D.wk)()],n=[(0,D.wk)()],l=[(0,D.wk)()],c=[(0,D.wk)()],d=[(0,D.wk)()],u=[(0,D.wk)()],f=[(0,D.MZ)({attribute:!1})],uu(this,null,i,{kind:"accessor",name:"_isHeightLimit",static:!1,private:!1,access:{has:e=>"_isHeightLimit"in e,get:e=>e._isHeightLimit,set:(e,t)=>{e._isHeightLimit=t}},metadata:s},w,x),uu(this,null,o,{kind:"accessor",name:"_isResizing",static:!1,private:!1,access:{has:e=>"_isResizing"in e,get:e=>e._isResizing,set:(e,t)=>{e._isResizing=t}},metadata:s},_,C),uu(this,null,r,{kind:"accessor",name:"_isWidthLimit",static:!1,private:!1,access:{has:e=>"_isWidthLimit"in e,get:e=>e._isWidthLimit,set:(e,t)=>{e._isWidthLimit=t}},metadata:s},k,S),uu(this,null,a,{kind:"accessor",name:"_mode",static:!1,private:!1,access:{has:e=>"_mode"in e,get:e=>e._mode,set:(e,t)=>{e._mode=t}},metadata:s},M,E),uu(this,null,n,{kind:"accessor",name:"_scaleDirection",static:!1,private:!1,access:{has:e=>"_scaleDirection"in e,get:e=>e._scaleDirection,set:(e,t)=>{e._scaleDirection=t}},metadata:s},I,B),uu(this,null,l,{kind:"accessor",name:"_scalePercent",static:!1,private:!1,access:{has:e=>"_scalePercent"in e,get:e=>e._scalePercent,set:(e,t)=>{e._scalePercent=t}},metadata:s},$,T),uu(this,null,c,{kind:"accessor",name:"_selectedRect",static:!1,private:!1,access:{has:e=>"_selectedRect"in e,get:e=>e._selectedRect,set:(e,t)=>{e._selectedRect=t}},metadata:s},O,A),uu(this,null,d,{kind:"accessor",name:"_shiftKey",static:!1,private:!1,access:{has:e=>"_shiftKey"in e,get:e=>e._shiftKey,set:(e,t)=>{e._shiftKey=t}},metadata:s},j,V),uu(this,null,u,{kind:"accessor",name:"autoCompleteOff",static:!1,private:!1,access:{has:e=>"autoCompleteOff"in e,get:e=>e.autoCompleteOff,set:(e,t)=>{e.autoCompleteOff=t}},metadata:s},z,R),uu(this,null,f,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:s},F,N),uu(null,e={value:t},m,{kind:"class",name:t.name,metadata:s},null,y),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.enabledWarnings=[]}static{this.styles=(0,L.AH)` :host { display: block; user-select: none; contain: size layout; position: absolute; top: 0; left: 0; z-index: 1; } .affine-edgeless-selected-rect { position: absolute; top: 0; left: 0; transform-origin: center center; border-radius: 0; pointer-events: none; box-sizing: border-box; z-index: 1; border-color: var(--affine-blue); border-width: var(--affine-border-width); border-style: solid; transform: translate(0, 0) rotate(0); } .affine-edgeless-selected-rect .handle { position: absolute; user-select: none; outline: none; pointer-events: auto; /** * Fix: pointerEvent stops firing after a short time. * When a gesture is started, the browser intersects the touch-action values of the touched element and its ancestors, * up to the one that implements the gesture (in other words, the first containing scrolling element) * https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action */ touch-action: none; } .affine-edgeless-selected-rect .handle[aria-label^='top-'], .affine-edgeless-selected-rect .handle[aria-label^='bottom-'] { width: 18px; height: 18px; box-sizing: border-box; z-index: 10; } .affine-edgeless-selected-rect .handle[aria-label^='top-'] .resize, .affine-edgeless-selected-rect .handle[aria-label^='bottom-'] .resize { position: absolute; width: 12px; height: 12px; box-sizing: border-box; border-radius: 50%; border: 2px var(--affine-blue) solid; background: white; } .affine-edgeless-selected-rect .handle[aria-label^='top-'] .rotate, .affine-edgeless-selected-rect .handle[aria-label^='bottom-'] .rotate { position: absolute; width: 12px; height: 12px; box-sizing: border-box; background: transparent; } /* -18 + 6.5 */ .affine-edgeless-selected-rect .handle[aria-label='top-left'] { left: -12px; top: -12px; } .affine-edgeless-selected-rect .handle[aria-label='top-left'] .resize { right: 0; bottom: 0; } .affine-edgeless-selected-rect .handle[aria-label='top-left'] .rotate { right: 6px; bottom: 6px; } .affine-edgeless-selected-rect .handle[aria-label='top-right'] { top: -12px; right: -12px; } .affine-edgeless-selected-rect .handle[aria-label='top-right'] .resize { left: 0; bottom: 0; } .affine-edgeless-selected-rect .handle[aria-label='top-right'] .rotate { left: 6px; bottom: 6px; } .affine-edgeless-selected-rect .handle[aria-label='bottom-right'] { right: -12px; bottom: -12px; } .affine-edgeless-selected-rect .handle[aria-label='bottom-right'] .resize { left: 0; top: 0; } .affine-edgeless-selected-rect .handle[aria-label='bottom-right'] .rotate { left: 6px; top: 6px; } .affine-edgeless-selected-rect .handle[aria-label='bottom-left'] { bottom: -12px; left: -12px; } .affine-edgeless-selected-rect .handle[aria-label='bottom-left'] .resize { right: 0; top: 0; } .affine-edgeless-selected-rect .handle[aria-label='bottom-left'] .rotate { right: 6px; top: 6px; } .affine-edgeless-selected-rect .handle[aria-label='top'], .affine-edgeless-selected-rect .handle[aria-label='bottom'], .affine-edgeless-selected-rect .handle[aria-label='left'], .affine-edgeless-selected-rect .handle[aria-label='right'] { border: 0; background: transparent; border-color: var('--affine-blue'); } .affine-edgeless-selected-rect .handle[aria-label='left'], .affine-edgeless-selected-rect .handle[aria-label='right'] { top: 0; bottom: 0; height: 100%; width: 6px; } .affine-edgeless-selected-rect .handle[aria-label='top'], .affine-edgeless-selected-rect .handle[aria-label='bottom'] { left: 0; right: 0; width: 100%; height: 6px; } /* calc(-1px - (6px - 1px) / 2) = -3.5px */ .affine-edgeless-selected-rect .handle[aria-label='left'] { left: -3.5px; } .affine-edgeless-selected-rect .handle[aria-label='right'] { right: -3.5px; } .affine-edgeless-selected-rect .handle[aria-label='top'] { top: -3.5px; } .affine-edgeless-selected-rect .handle[aria-label='bottom'] { bottom: -3.5px; } .affine-edgeless-selected-rect .handle[aria-label='top'] .resize, .affine-edgeless-selected-rect .handle[aria-label='bottom'] .resize, .affine-edgeless-selected-rect .handle[aria-label='left'] .resize, .affine-edgeless-selected-rect .handle[aria-label='right'] .resize { width: 100%; height: 100%; } .affine-edgeless-selected-rect .handle[aria-label='top'] .resize:after, .affine-edgeless-selected-rect .handle[aria-label='bottom'] .resize:after, .affine-edgeless-selected-rect .handle[aria-label='left'] .resize:after, .affine-edgeless-selected-rect .handle[aria-label='right'] .resize:after { position: absolute; width: 7px; height: 7px; box-sizing: border-box; border-radius: 6px; z-index: 10; content: ''; background: white; } .affine-edgeless-selected-rect .handle[aria-label='top'] .transparent-handle:after, .affine-edgeless-selected-rect .handle[aria-label='bottom'] .transparent-handle:after, .affine-edgeless-selected-rect .handle[aria-label='left'] .transparent-handle:after, .affine-edgeless-selected-rect .handle[aria-label='right'] .transparent-handle:after { opacity: 0; } .affine-edgeless-selected-rect .handle[aria-label='left'] .resize:after, .affine-edgeless-selected-rect .handle[aria-label='right'] .resize:after { top: calc(50% - 6px); } .affine-edgeless-selected-rect .handle[aria-label='top'] .resize:after, .affine-edgeless-selected-rect .handle[aria-label='bottom'] .resize:after { left: calc(50% - 6px); } .affine-edgeless-selected-rect .handle[aria-label='left'] .resize:after { left: -0.5px; } .affine-edgeless-selected-rect .handle[aria-label='right'] .resize:after { right: -0.5px; } .affine-edgeless-selected-rect .handle[aria-label='top'] .resize:after { top: -0.5px; } .affine-edgeless-selected-rect .handle[aria-label='bottom'] .resize:after { bottom: -0.5px; } .affine-edgeless-selected-rect .handle .resize::before { content: ''; display: none; position: absolute; width: 20px; height: 20px; background-image: url("data:image/svg+xml,%3Csvg width='26' height='26' viewBox='0 0 26 26' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M23 3H19C10.1634 3 3 10.1634 3 19V23' stroke='black' stroke-opacity='0.3' stroke-width='5' stroke-linecap='round'/%3E%3C/svg%3E"); background-size: contain; background-repeat: no-repeat; } .affine-edgeless-selected-rect[data-mode='scale'] .handle[aria-label='top-left'] .resize:hover::before, .affine-edgeless-selected-rect[data-scale-direction='top-left'][data-scale-percent] .handle[aria-label='top-left'] .resize::before { display: block; top: 0px; left: 0px; transform: translate(-100%, -100%); } .affine-edgeless-selected-rect[data-mode='scale'] .handle[aria-label='top-right'] .resize:hover::before, .affine-edgeless-selected-rect[data-scale-direction='top-right'][data-scale-percent] .handle[aria-label='top-right'] .resize::before { display: block; top: 0px; right: 0px; transform: translate(100%, -100%) rotate(90deg); } .affine-edgeless-selected-rect[data-mode='scale'] .handle[aria-label='bottom-right'] .resize:hover::before, .affine-edgeless-selected-rect[data-scale-direction='bottom-right'][data-scale-percent] .handle[aria-label='bottom-right'] .resize::before { display: block; bottom: 0px; right: 0px; transform: translate(100%, 100%) rotate(180deg); } .affine-edgeless-selected-rect[data-mode='scale'] .handle[aria-label='bottom-left'] .resize:hover::before, .affine-edgeless-selected-rect[data-scale-direction='bottom-left'][data-scale-percent] .handle[aria-label='bottom-left'] .resize::before { display: block; bottom: 0px; left: 0px; transform: translate(-100%, 100%) rotate(-90deg); } .affine-edgeless-selected-rect::after { content: attr(data-scale-percent); display: none; position: absolute; color: var(--affine-icon-color); font-feature-settings: 'clig' off, 'liga' off; font-family: var(--affine-font-family); font-size: 12px; font-style: normal; font-weight: 400; line-height: 24px; } .affine-edgeless-selected-rect[data-scale-direction='top-left']::after { display: block; top: -20px; left: -20px; transform: translate(-100%, -100%); } .affine-edgeless-selected-rect[data-scale-direction='top-right']::after { display: block; top: -20px; right: -20px; transform: translate(100%, -100%); } .affine-edgeless-selected-rect[data-scale-direction='bottom-right']::after { display: block; bottom: -20px; right: -20px; transform: translate(100%, 100%); } .affine-edgeless-selected-rect[data-scale-direction='bottom-left']::after { display: block; bottom: -20px; left: -20px; transform: translate(-100%, 100%); } `}constructor(){super(),this._cursorRotate=0,this._dragEndCallback=[],this._initSelectedSlot=()=>{this._propDisposables.forEach(e=>e.dispose()),this._propDisposables=[],this.selection.selectedElements.forEach(e=>{"flavour"in e&&this._propDisposables.push(e.propsUpdated.on(()=>{this._updateOnElementChange(e.id)}))})},this._onDragEnd=()=>{this.slots.dragEnd.emit(),this.doc.transact(()=>{this._dragEndCallback.forEach(e=>e())}),this._dragEndCallback=[],this._isWidthLimit=!1,this._isHeightLimit=!1,this._updateCursor(!1),this._scalePercent=void 0,this._scaleDirection=void 0,this._updateMode(),this.edgeless.slots.elementResizeEnd.emit()},this._onDragMove=(e,t)=>{this.slots.dragMove.emit();let{edgeless:i}=this;e.forEach(({bound:e,matrix:s,path:o},r)=>{let a=i.service.getElementById(r);if(a){if((0,tE._h)(a)){this.#ab(a,e,t);return}if((0,tE.dT)(a)){this.#aw(a,e,t);return}if((0,tE.v8)(a)){this.#ax(a,e,t);return}if((0,tE.MT)(a)){this.#a_(a,e,t);return}if((0,tE.wI)(a)){this.#aC(a,e,t);return}if(this._isProportionalElement(a)){this.#ak(a,e,t);return}if(a instanceof tB.n){this.#aS(a,e,t);return}if(a instanceof v.B5){this.#aM(a,e,t);return}if(a instanceof v.lw&&s&&o){this.#aE(a,e,s,o);return}this.#aI(a,e,t)}})},this._onDragRotate=(e,t)=>{this.slots.dragRotate.emit();let{selection:i}=this,s=new DOMMatrix().translateSelf(e.x,e.y).rotateSelf(t).translateSelf(-e.x,-e.y),o=i.selectedElements.filter(e=>(0,tE.TW)(e)||(0,tE.dT)(e)||(0,tE.r0)(e));(0,dq.l)(o).forEach(e=>{let{id:i,rotate:o}=e,r=p.z.deserialize(e.xywh),a=new DOMPoint(...r.center).matrixTransform(s);r.center=[a.x,a.y],(0,tE.r0)(e)&&e instanceof v.lw?this.#aE(e,r,s,e.absolutePath.map(e=>e.clone())):this.edgeless.service.updateElement(i,{xywh:r.serialize(),rotate:(0,v.z)(o+t)})}),this._updateCursor(!0,{type:"rotate",angle:t}),this._updateMode()},this._onDragStart=()=>{this.slots.dragStart.emit();let e=this._resizeManager.rotation;this._dragEndCallback=[],this.edgeless.slots.elementResizeStart.emit(),this.selection.selectedElements.forEach(t=>{t.stash("xywh"),t instanceof ue.N&&t.stash("edgeless"),e&&t.stash("rotate"),t instanceof tB.n&&!e&&(t.stash("fontSize"),t.stash("hasMaxWidth")),this._dragEndCallback.push(()=>{t.pop("xywh"),t instanceof ue.N&&t.pop("edgeless"),e&&t.pop("rotate"),t instanceof tB.n&&!e&&(t.pop("fontSize"),t.pop("hasMaxWidth"))})}),this._updateResizeManagerState(!0)},this._propDisposables=[],this._updateCursor=(e,t)=>{let i="default";if(e&&t){let{type:e,target:s,point:o}=t,{angle:r}=t;if("rotate"===e)s&&o&&(r=function(e,t,i=0){let s=e.closest(".affine-edgeless-selected-rect")?.getBoundingClientRect();(0,H.Z1)(s);let{left:o,top:r,right:a,bottom:n}=s,l=tm.l.med([o,r],[a,n]);return(0,v.z)((tm.l.angle(l,t)+i)*180/Math.PI)}(s,o,45)),this._cursorRotate+=r||0,i=(function(e=0,t=(0,L.AH)`default`){return`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg transform='rotate(${e} 16 16)'%3E%3Cpath fill='white' d='M13.7,18.5h3.9l0-1.5c0-1.4-1.2-2.6-2.6-2.6h-1.5v3.9l-5.8-5.8l5.8-5.8v3.9h2.3c3.1,0,5.6,2.5,5.6,5.6v2.3h3.9l-5.8,5.8L13.7,18.5z'/%3E%3Cpath d='M20.4,19.4v-3.2c0-2.6-2.1-4.7-4.7-4.7h-3.2l0,0V9L9,12.6l3.6,3.6v-2.6l0,0H15c1.9,0,3.5,1.6,3.5,3.5v2.4l0,0h-2.6l3.6,3.6l3.6-3.6L20.4,19.4L20.4,19.4z'/%3E%3C/g%3E%3C/svg%3E") 16 16, ${t}`})(this._cursorRotate).toString();else{if("edge"===this.resizeMode)i="ew";else if(s&&o){let e=function(e){let t=e.parentElement;(0,H.Z1)(t);let i=t.getAttribute("aria-label");return(0,H.Z1)(i),i}(s),{width:t,height:a,left:n,top:l}=this._selectedRect;i=c7[Math.round((r="top"===e||"bottom"===e||"left"===e||"right"===e?function(e,t){let i=0,s=e.parentElement;(0,H.Z1)(s);let o=s.getAttribute("aria-label");switch((0,H.Z1)(o),o){case"top":i=270;break;case"bottom":i=90;break;case"left":i=180;break;case"right":i=0}return i+t}(s,this._selectedRect.rotate):function(e,t,i,s){let o=e.parentElement;(0,H.Z1)(o);let r=o.getAttribute("aria-label");(0,H.Z1)(r);let{left:a,top:n,right:l,bottom:c,width:d,height:h}=i,u=Math.min(d,h),p=tm.l.med([a,n],[l,c]),f=[0,0];switch(r){case"top-left":f[0]=a,f[1]=n;break;case"top-right":f[0]=l,f[1]=n;break;case"bottom-right":f[0]=l,f[1]=c;break;case"bottom-left":f[0]=a,f[1]=c}let g=new DOMMatrix().translateSelf(p[0],p[1]).rotateSelf(s).translateSelf(-p[0],-p[1]).transformPoint(new DOMPoint(...f)),m=new DOMMatrix().translateSelf(g.x,g.y).rotateSelf(s).translateSelf(-g.x,-g.y).scaleSelf(u/d,u/h,1,g.x,g.y,0).translateSelf(g.x,g.y).rotateSelf(-s).translateSelf(-g.x,-g.y),y=new DOMPoint(...p).matrixTransform(m);return(0,v.z)(180*tm.l.angle([y.x,y.y],t)/Math.PI)}(s,o,new DOMRect(n+this.edgeless.viewport.left,l+this.edgeless.viewport.top,t,a),this._selectedRect.rotate))*Math.PI/180/(Math.PI/4))%c7.length]}i+="-resize"}}else this._cursorRotate=0;this.edgelessSlots.cursorUpdated.emit(i)},this._updateMode=()=>{if(this._cursorRotate){this._mode="rotate";return}let{selection:e}=this,t=e.selectedElements;1!==t.length&&(this._mode="scale");let i=t[0];(0,tE._h)(i)||(0,tE.v8)(i)?this._mode=this._shiftKey?"scale":"resize":this._isProportionalElement(i)?this._mode="scale":this._mode="resize","scale"!==this._mode&&(this._scalePercent=void 0,this._scaleDirection=void 0)},this._updateOnElementChange=(e,t=!1)=>{if(t&&this._resizeManager.dragging||!this.isConnected)return;let i="string"==typeof e?e:e.id;(this._resizeManager.bounds.has(i)||this.selection.has(i))&&(this._updateSelectedRect(),this._updateMode())},this._updateOnSelectionChange=()=>{this._initSelectedSlot(),this._updateSelectedRect(),this._updateResizeManagerState(!0),this._updateCursor(!1),this._updateMode()},this._updateOnViewportChange=()=>{this.selection.empty||(this._updateSelectedRect(),this._updateMode())},this._updateResizeManagerState=e=>{let{_resizeManager:t,_selectedRect:i,resizeMode:s,zoom:o,selection:{selectedElements:r}}=this,a=(0,tE.Ql)(r),n=r.some(e=>this._isProportionalElement(e));r.length>1&&(e=!0),t.updateState(s,i.rotate,o,e?void 0:a,e?a:void 0,n),t.updateBounds((0,tE.Aq)(r))},this._updateSelectedRect=(0,sy.GR)(()=>{let{zoom:e,selection:t,edgeless:i}=this,s=t.selectedElements,o=(0,tE.Ql)(s),[r,a]=i.service.viewport.toViewCoord(o.left,o.top),[n,l]=[o.width*e,o.height*e],c=0;1===s.length&&s[0].rotate&&(c=s[0].rotate),this._selectedRect={width:n,height:l,left:r,top:a,rotate:c,borderStyle:"solid",borderWidth:t.editing?2:1}},this),this.slots={dragStart:new a2.D,dragMove:new a2.D,dragRotate:new a2.D,dragEnd:new a2.D},this.#aB=up(this,w,!1),this.#a$=(up(this,x),up(this,_,!1)),this.#aT=(up(this,C),up(this,k,!1)),this.#eR=(up(this,S),up(this,M,"resize")),this.#aO=(up(this,E),up(this,I,void 0)),this.#aP=(up(this,B),up(this,$,void 0)),this.#aH=(up(this,T),up(this,O,{width:0,height:0,left:0,top:0,rotate:0,borderWidth:0,borderStyle:"solid"})),this.#aA=(up(this,A),up(this,j,!1)),this.#aL=(up(this,V),up(this,z,!1)),this.#i_=(up(this,R),up(this,F,void 0)),up(this,N),this._resizeManager=new uh(this._onDragStart,this._onDragMove,this._onDragRotate,this._onDragEnd),this.addEventListener("pointerdown",sy.dG)}#aC(e,t,i){let s=p.z.deserialize(e.xywh),o=1;"scale"in e&&(o=e.scale);let r=s.w/o,a=s.h/o;this._shiftKey&&(o=t.w/r,this._scalePercent=`${Math.round(100*o)}%`,this._scaleDirection=i),r=t.w/o,r=(0,tv.qE)(r,260,320),t.w=r*o,a=t.h/o,a=(0,tv.qE)(a,160,300),t.h=a*o,this._isWidthLimit=260===r||320===r,this._isHeightLimit=160===a||300===a,this.edgeless.service.updateElement(e.id,{scale:o,xywh:t.serialize()})}#aE(e,t,i,s){let o=e.resize(t,s,i);this.edgeless.service.updateElement(e.id,o)}#aw(e,t,i){let o=p.z.deserialize(e.xywh);if(i===s.TopLeft||i===s.TopRight||i===s.BottomRight||i===s.BottomLeft){let s=e.scale*(t.w/o.w);this._scalePercent=`${Math.round(100*s)}%`,this._scaleDirection=i,t.h=t.w*(o.h/o.w),this.edgeless.service.updateElement(e.id,{scale:s,xywh:t.serialize()})}else if(i===s.Left||i===s.Right){let i=this.edgeless.host.view.getBlock(e.id);if(!i||!i.checkWidthOverflow(t.w))return;let s=(0,tv.qE)(t.w/e.scale,i_,1/0);t.w=s*e.scale,this.edgeless.service.updateElement(e.id,{xywh:p.z.serialize({...t,h:o.h}),hasMaxWidth:!0})}}#a_(e,t,i){t.w=(0,tv.qE)(t.w,370,1/0),t.h=(0,tv.qE)(t.h,80,1/0),this._isWidthLimit=370===t.w,this._isHeightLimit=80===t.h,this.edgeless.service.updateElement(e.id,{xywh:t.serialize()})}#ax(e,t,i){let s=p.z.deserialize(e.xywh),o=e.scale??1,r=s.w/o,a=s.h/o;this._shiftKey&&(o=t.w/r,this._scalePercent=`${Math.round(100*o)}%`,this._scaleDirection=i),r=t.w/o,r=(0,tv.qE)(r,370,1/0),t.w=r*o,a=t.h/o,a=(0,tv.qE)(a,64,1/0),t.h=a*o,this._isWidthLimit=370===r,this._isHeightLimit=64===a,this.edgeless.service.updateElement(e.id,{scale:o,xywh:t.serialize()})}#ab(e,t,i){let s=p.z.deserialize(e.xywh),o=e.edgeless.scale??1,r=s.w/o,a=s.h/o;this._shiftKey?(o=t.w/r,this._scalePercent=`${Math.round(100*o)}%`,this._scaleDirection=i):s.h!==t.h&&this.edgeless.doc.updateBlock(e,()=>{e.edgeless.collapse=!0,e.edgeless.collapsedHeight=t.h/o}),r=t.w/o,r=(0,tv.qE)(r,498,1/0),t.w=r*o,a=t.h/o,a=(0,tv.qE)(a,78,1/0),t.h=a*o,this._isWidthLimit=498===r,this._isHeightLimit=78===a,this.edgeless.service.updateElement(e.id,{edgeless:{...e.edgeless,scale:o},xywh:t.serialize()})}#ak(e,t,i){let o=p.z.deserialize(e.xywh);if((0,tE.TW)(e)){let{height:s}=e;s&&(this._scalePercent=`${Math.round(t.h/s*100)}%`,this._scaleDirection=i)}else{let s=e.style,o=eh.Hn[s];this._scalePercent=`${Math.round(t.h/o*100)}%`,this._scaleDirection=i}i===s.Left||i===s.Right?t.h=o.h/o.w*t.w:(i===s.Top||i===s.Bottom)&&(t.w=o.w/o.h*t.h),this.edgeless.service.updateElement(e.id,{xywh:t.serialize()})}#aM(e,t,i){t=(0,v.dN)(e,t),this.edgeless.service.updateElement(e.id,{xywh:t.serialize()})}#aS(e,t,i){let o=1;if(i===s.Left||i===s.Right){let{text:i,fontFamily:s,fontSize:r,fontStyle:a,fontWeight:n,hasMaxWidth:l}=e;t=(0,g.JO)({yText:i,fontFamily:s,fontSize:r,fontStyle:a,fontWeight:n,hasMaxWidth:l},t,!0),this.edgeless.service.updateElement(e.id,{xywh:t.serialize(),fontSize:e.fontSize*o,hasMaxWidth:!0})}else o=t.h/e.h,this.edgeless.service.updateElement(e.id,{xywh:t.serialize(),fontSize:e.fontSize*o})}#aI(e,t,i){this.edgeless.service.updateElement(e.id,{xywh:t.serialize()})}_canAutoComplete(){return!this.autoCompleteOff&&!this._isResizing&&1===this.selection.selectedElements.length&&(this.selection.selectedElements[0]instanceof v.B5||(0,tE._h)(this.selection.selectedElements[0]))}_canRotate(){return!this.selection.selectedElements.every(e=>(0,tE._h)(e)||(0,tE.X8)(e)||(0,tE.Cv)(e)||(0,tE.BG)(e)||(0,tE.Wq)(e))}_isProportionalElement(e){return(0,tE.BG)(e)||(0,tE.TW)(e)||(0,tE.Cv)(e)||(0,tE.RT)(e)||(0,tE.EG)(e)||(0,tE._y)(e)||(0,tE.Ej)(e)||(0,tE.C8)(e)}_shouldRenderSelection(e){return(e=e??this.selection.selectedElements).length>0&&!this.selection.editing}firstUpdated(){let{_disposables:e,edgelessSlots:t,selection:i,edgeless:s}=this;e.add(s.service.viewport.viewportUpdated.on(this._updateOnViewportChange)),(0,sk.ME)(s.service.surface,["elementAdded","elementRemoved","elementUpdated"]).forEach(t=>{e.add(t.on(this._updateOnElementChange))}),e.add(this.doc.slots.blockUpdated.on(this._updateOnElementChange)),e.add(t.pressShiftKeyUpdated.on(e=>{this._shiftKey=e,this._resizeManager.onPressShiftKey(e),this._updateSelectedRect(),this._updateMode()})),e.add(i.slots.updated.on(this._updateOnSelectionChange)),e.add(s.slots.readonlyUpdated.on(()=>this.requestUpdate())),e.add(s.slots.elementResizeStart.on(()=>this._isResizing=!0)),e.add(s.slots.elementResizeEnd.on(()=>this._isResizing=!1)),e.add(()=>{this._propDisposables.forEach(e=>e.dispose())})}render(){if(!this.isConnected)return L.s6;let{selection:e}=this,t=e.selectedElements;if(!this._shouldRenderSelection(t))return L.s6;let{edgeless:i,doc:o,resizeMode:r,_resizeManager:a,_selectedRect:n,_updateCursor:l}=this,c=!e.editing&&!o.readonly,d=e.inoperable,u=[];if(!d){let e=c?function(e,t,i){let o=()=>({handleTopLeft:tg(s.TopLeft,t,i),handleTopRight:tg(s.TopRight,t,i),handleBottomLeft:tg(s.BottomLeft,t,i),handleBottomRight:tg(s.BottomRight,t,i)}),r=e=>({handleLeft:tg(s.Left,t,i,e),handleRight:tg(s.Right,t,i,e)});switch(e){case"corner":{let{handleTopLeft:e,handleTopRight:t,handleBottomLeft:i,handleBottomRight:s}=o();return(0,L.qy)` ${e} ${t} ${i} ${s} `}case"edge":{let{handleLeft:e,handleRight:t}=r();return(0,L.qy)`${e} ${t}`}case"all":{let{handleTopLeft:e,handleTopRight:a,handleBottomLeft:n,handleBottomRight:l}=o(),{handleLeft:c,handleRight:d}=r(!0),{handleTop:h,handleBottom:u}={handleTop:tg(s.Top,t,i,!0),handleBottom:tg(s.Bottom,t,i,!0)};return(0,L.qy)` ${e} ${h} ${a} ${d} ${l} ${u} ${n} ${c} `}case"edgeAndCorner":{let{handleTopLeft:e,handleTopRight:t,handleBottomLeft:i,handleBottomRight:s}=o(),{handleLeft:a,handleRight:n}=r(!0);return(0,L.qy)` ${e} ${t} ${n} ${s} ${i} ${a} `}case"none":return L.s6}}(r,(e,i)=>{if(e.target.classList.contains("rotate")&&!this._canRotate())return;let s=t.some(e=>e instanceof tB.n);a.onPointerDown(e,i,s)},(e,t)=>{(this._canRotate()||t?.type!=="rotate")&&l(e,t)}):L.s6,o=1===t.length&&t[0]instanceof v.lw?(0,L.qy)` `:L.s6,n=t.length>1&&!t.reduce((e,t)=>e&&t instanceof v.lw,!0)?t.map(e=>{let[t,s,o,r]=(0,h.W)(e.xywh),[a,n]=i.service.viewport.toViewCoord(t,s),{left:l,top:c,borderWidth:d}=this._selectedRect,u={position:"absolute",boxSizing:"border-box",left:`${a-l-d}px`,top:`${n-c-d}px`,width:`${o*this.zoom}px`,height:`${r*this.zoom}px`,transform:`rotate(${e.rotate}deg)`,border:"1px solid var(--affine-primary-color)"};return(0,L.qy)`
`}):L.s6;u.push(e,o,n)}let p=1===t.length&&t[0]instanceof v.$f;return 1===t.length&&t[0]instanceof v.lw&&(n.width=0,n.height=0,n.borderWidth=0),n.borderStyle=p?"dashed":"solid",(0,L.qy)` ${!o.readonly&&!d&&this._canAutoComplete()?(0,L.qy)` `:L.s6}
${u}
`}get doc(){return this.edgeless.doc}get dragDirection(){return this._resizeManager.dragDirection}get dragging(){return this._resizeManager.dragging||this.edgeless.tools.dragging}get edgelessSlots(){return this.edgeless.slots}get resizeMode(){let e=this.selection.selectedElements,t=!0,i=e.length>1,s=!0,o=!0,r=!1;for(let a of e)(0,tE._h)(a)||(0,tE.v8)(a)?(t=!1,this._shiftKey&&(s=!1,o=!1)):(0,tE.MT)(a)?t=!1:(0,tE.X8)(a)?t=!1:this._isProportionalElement(a)?(t=!1,s=!1,o=!1):(0,tE.dT)(a)?(t=!1,s=!1):((0,H.j)(a),a.type===v.J9.CONNECTOR?i&&=!(a.source.id||a.target.id):t=!1,a.type!==v.J9.SHAPE&&a.type!==v.J9.GROUP&&(s=!1),a.type!==v.J9.TEXT&&(o=!1),(a.group instanceof v.AR||a instanceof v.AR)&&(r=!0));return t?i?"all":"none":r?"none":s?"all":o?"edgeAndCorner":"corner"}get selection(){return this.edgeless.service.selection}get surface(){return this.edgeless.surface}get zoom(){return this.edgeless.service.viewport.zoom}#aB;get _isHeightLimit(){return this.#aB}set _isHeightLimit(e){this.#aB=e}#a$;get _isResizing(){return this.#a$}set _isResizing(e){this.#a$=e}#aT;get _isWidthLimit(){return this.#aT}set _isWidthLimit(e){this.#aT=e}#eR;get _mode(){return this.#eR}set _mode(e){this.#eR=e}#aO;get _scaleDirection(){return this.#aO}set _scaleDirection(e){this.#aO=e}#aP;get _scalePercent(){return this.#aP}set _scalePercent(e){this.#aP=e}#aH;get _selectedRect(){return this.#aH}set _selectedRect(e){this.#aH=e}#aA;get _shiftKey(){return this.#aA}set _shiftKey(e){this.#aA=e}#aL;get autoCompleteOff(){return this.#aL}set autoCompleteOff(e){this.#aL=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}static{up(t,y)}})})();var uf=i(99603),ug=i(55639),um=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},uv=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d=[(0,D.EM)("smooth-corner")],h=[],u=L.WF,p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[];(class extends u{static{t=this}static{let B="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({type:String})],s=[(0,D.MZ)({type:Number})],o=[(0,D.MZ)({type:String})],r=[(0,D.MZ)({type:Number})],a=[(0,D.MZ)({type:Number})],n=[(0,D.wk)()],l=[(0,D.MZ)({type:Number})],c=[(0,D.wk)()],um(this,null,i,{kind:"accessor",name:"bgColor",static:!1,private:!1,access:{has:e=>"bgColor"in e,get:e=>e.bgColor,set:(e,t)=>{e.bgColor=t}},metadata:B},p,f),um(this,null,s,{kind:"accessor",name:"bgOpacity",static:!1,private:!1,access:{has:e=>"bgOpacity"in e,get:e=>e.bgOpacity,set:(e,t)=>{e.bgOpacity=t}},metadata:B},g,m),um(this,null,o,{kind:"accessor",name:"borderColor",static:!1,private:!1,access:{has:e=>"borderColor"in e,get:e=>e.borderColor,set:(e,t)=>{e.borderColor=t}},metadata:B},v,y),um(this,null,r,{kind:"accessor",name:"borderRadius",static:!1,private:!1,access:{has:e=>"borderRadius"in e,get:e=>e.borderRadius,set:(e,t)=>{e.borderRadius=t}},metadata:B},b,w),um(this,null,a,{kind:"accessor",name:"borderWidth",static:!1,private:!1,access:{has:e=>"borderWidth"in e,get:e=>e.borderWidth,set:(e,t)=>{e.borderWidth=t}},metadata:B},x,_),um(this,null,n,{kind:"accessor",name:"height",static:!1,private:!1,access:{has:e=>"height"in e,get:e=>e.height,set:(e,t)=>{e.height=t}},metadata:B},C,k),um(this,null,l,{kind:"accessor",name:"smooth",static:!1,private:!1,access:{has:e=>"smooth"in e,get:e=>e.smooth,set:(e,t)=>{e.smooth=t}},metadata:B},S,M),um(this,null,c,{kind:"accessor",name:"width",static:!1,private:!1,access:{has:e=>"width"in e,get:e=>e.width,set:(e,t)=>{e.width=t}},metadata:B},E,I),um(null,e={value:t},d,{kind:"class",name:t.name,metadata:B},null,h),t=e.value,B&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:B})}static{this.styles=(0,L.AH)` :host { position: relative; } .smooth-corner-bg, .smooth-corner-border { position: absolute; top: 0; left: 0; pointer-events: none; } .smooth-corner-border { z-index: 2; } .smooth-corner-content { position: relative; z-index: 1; width: 100%; height: 100%; } `}constructor(){super(),this._resizeObserver=null,this.#aD=uv(this,p,"white"),this.#aZ=(uv(this,f),uv(this,g,1)),this.#aj=(uv(this,m),uv(this,v,"black")),this.#H=(uv(this,y),uv(this,b,0)),this.#A=(uv(this,w),uv(this,x,2)),this.#iU=(uv(this,_),uv(this,C,0)),this.#aV=(uv(this,k),uv(this,S,0)),this.#tP=(uv(this,M),uv(this,E,0)),uv(this,I),this._resizeObserver=new ResizeObserver(e=>{for(let t of e)this.width=t.contentRect.width,this.height=t.contentRect.height})}_getSvg(e,t){return(0,L.JW)` ${t} `}get _path(){return(0,ug.k)({width:this.width,height:this.height,cornerRadius:this.borderRadius,cornerSmoothing:this.smooth})}connectedCallback(){super.connectedCallback(),this._resizeObserver?.observe(this)}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver?.unobserve(this)}render(){return(0,L.qy)`${this._getSvg("smooth-corner-bg",(0,L.JW)``)} ${this._getSvg("smooth-corner-border",(0,L.JW)``)}
`}#aD;get bgColor(){return this.#aD}set bgColor(e){this.#aD=e}#aZ;get bgOpacity(){return this.#aZ}set bgOpacity(e){this.#aZ=e}#aj;get borderColor(){return this.#aj}set borderColor(e){this.#aj=e}#H;get borderRadius(){return this.#H}set borderRadius(e){this.#H=e}#A;get borderWidth(){return this.#A}set borderWidth(e){this.#A=e}#iU;get height(){return this.#iU}set height(e){this.#iU=e}#aV;get smooth(){return this.#aV}set smooth(e){this.#aV=e}#tP;get width(){return this.#tP}set width(e){this.#tP=e}static{uv(t,h)}})})();var uy=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ub=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-toolbar-button")],s=[],o=c_;(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;uy(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` .icon-container { position: relative; display: flex; align-items: center; justify-content: center; padding: 0; color: var(--affine-icon-color); cursor: pointer; } .icon-container.active-mode-color[active] { color: var(--affine-primary-color); } .icon-container.active-mode-background[active] { background: var(--affine-hover-color); } .icon-container[disabled] { pointer-events: none; cursor: not-allowed; } .icon-container[coming] { cursor: not-allowed; color: var(--affine-text-disable-color); } `}render(){return(0,L.qy)` ${super.render()} `}static{ub(t,s)}})})();let uw=(0,uf.q6)(Symbol("edgelessToolbarSlotsContext")),ux=(0,uf.q6)(Symbol("edgelessToolbarThemeContext")),u_=(0,uf.q6)(Symbol("edgelessToolbarContext"));var uC=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},uk=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c=[(0,D.EM)("edgeless-frame-order-menu")],d=[],h=(0,P.Tm)(L.WF),u=[],p=[],f=[],g=[],m=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[];(class extends h{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,D.P)(".clone")],s=[(0,D.P)(".edgeless-frame-order-items-container")],o=[(0,D.wk)()],r=[(0,D.P)(".indicator-line")],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],uC(this,null,i,{kind:"accessor",name:"_clone",static:!1,private:!1,access:{has:e=>"_clone"in e,get:e=>e._clone,set:(e,t)=>{e._clone=t}},metadata:v},u,p),uC(this,null,s,{kind:"accessor",name:"_container",static:!1,private:!1,access:{has:e=>"_container"in e,get:e=>e._container,set:(e,t)=>{e._container=t}},metadata:v},f,g),uC(this,null,o,{kind:"accessor",name:"_curIndex",static:!1,private:!1,access:{has:e=>"_curIndex"in e,get:e=>e._curIndex,set:(e,t)=>{e._curIndex=t}},metadata:v},m,y),uC(this,null,r,{kind:"accessor",name:"_indicatorLine",static:!1,private:!1,access:{has:e=>"_indicatorLine"in e,get:e=>e._indicatorLine,set:(e,t)=>{e._indicatorLine=t}},metadata:v},b,w),uC(this,null,a,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:v},x,_),uC(this,null,n,{kind:"accessor",name:"embed",static:!1,private:!1,access:{has:e=>"embed"in e,get:e=>e.embed,set:(e,t)=>{e.embed=t}},metadata:v},C,k),uC(this,null,l,{kind:"accessor",name:"frames",static:!1,private:!1,access:{has:e=>"frames"in e,get:e=>e.frames,set:(e,t)=>{e.frames=t}},metadata:v},S,M),uC(null,e={value:t},c,{kind:"class",name:t.name,metadata:v},null,d),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { position: relative; } .edgeless-frame-order-items-container { max-height: 281px; border-radius: 8px; padding: 8px; background: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-menu-shadow); overflow: auto; display: flex; flex-direction: column; gap: 4px; } .edgeless-frame-order-items-container.embed { padding: 0; background: unset; box-shadow: unset; border-radius: 0; } .item { box-sizing: border-box; width: 256px; border-radius: 4px; padding: 4px; display: flex; gap: 4px; align-items: center; cursor: grab; } .draggable:hover { background-color: var(--affine-hover-color); } .item:hover .drag-indicator { opacity: 1; } .drag-indicator { cursor: pointer; width: 4px; height: 12px; border-radius: 1px; opacity: 0.2; background: var(--affine-placeholder-color); margin-right: 2px; } .title { font-size: 14px; font-weight: 400; height: 22px; line-height: 22px; color: var(--affine-text-primary-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .clone { visibility: hidden; position: absolute; z-index: 1; left: 8px; height: 30px; border: 1px solid var(--affine-border-color); box-shadow: var(--affine-menu-shadow); background-color: var(--affine-white); pointer-events: none; } .indicator-line { visibility: hidden; position: absolute; z-index: 1; left: 8px; background-color: var(--affine-primary-color); height: 1px; width: 90%; } `}_bindEvent(){let{_disposables:e}=this;e.addFromEvent(this._container,"wheel",e=>{e.stopPropagation()}),e.addFromEvent(this._container,"pointerdown",e=>{let t=e.target.closest(".draggable");if(!t)return;let i=this._clone,s=this._indicatorLine;i.style.visibility="visible";let o=t.getBoundingClientRect(),r=Number(t.getAttribute("index"));this._curIndex=r;let a=-1,n=this._container.getBoundingClientRect(),l=n.top+8,c=n.bottom,d=e.clientX-o.left,h=e.clientY-o.top;function u(e,t){i.style.left=e-n.left-d+"px",i.style.top=t-n.top-h+"px"}u(e.clientX,e.clientY),this._disposables.addFromEvent(document,"pointermove",e=>{if(s.style.visibility="visible",u(e.clientX,e.clientY),e.clientY>=l&&e.clientY<=c){let t=e.pageY+this._container.scrollTop-l,i=0;t{if(i.style.visibility="hidden",s.style.visibility="hidden",a>=0&&a<=this.frames.length&&a!==r&&a!==r+1){let e=this.frames[a-1]?.index||null,t=this.frames[a]?.index||null,i=this.frames[r];this.edgeless.service.updateElement(i.id,{index:(0,v.TU)(e,t)}),this.edgeless.doc.captureSync(),this.requestUpdate()}this._disposables.dispose(),this._disposables=new eg.K,this._bindEvent()})})}firstUpdated(){this._bindEvent()}render(){let e=this.frames[this._curIndex];return(0,L.qy)`
e.stopPropagation()} > ${(0,t$.u)(this.frames,e=>e.id,(e,t)=>(0,L.qy)`
${e.title.toString()}
`)}
${e?(0,L.qy)`
${this._curIndex+1}
${e.title.toString()}
`:L.s6}
`}#az=uk(this,u,void 0);get _clone(){return this.#az}set _clone(e){this.#az=e}#e5=(uk(this,p),uk(this,f,void 0));get _container(){return this.#e5}set _container(e){this.#e5=e}#aR=(uk(this,g),uk(this,m,-1));get _curIndex(){return this.#aR}set _curIndex(e){this.#aR=e}#aF=(uk(this,y),uk(this,b,void 0));get _indicatorLine(){return this.#aF}set _indicatorLine(e){this.#aF=e}#i_=(uk(this,w),uk(this,x,void 0));get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#aN=(uk(this,_),uk(this,C,!1));get embed(){return this.#aN}set embed(e){this.#aN=e}#rA=(uk(this,k),uk(this,S,void 0));get frames(){return this.#rA}set frames(e){this.#rA=e}constructor(){super(...arguments),uk(this,M)}static{uk(t,d)}})})();var uS=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},uM=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("edgeless-frame-order-button")],c=[],d=(0,P.Tm)(L.WF),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];(class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.P)(".edgeless-frame-order-button")],s=[(0,D.P)("edgeless-frame-order-menu")],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],uS(this,null,i,{kind:"accessor",name:"_edgelessFrameOrderButton",static:!1,private:!1,access:{has:e=>"_edgelessFrameOrderButton"in e,get:e=>e._edgelessFrameOrderButton,set:(e,t)=>{e._edgelessFrameOrderButton=t}},metadata:C},h,u),uS(this,null,s,{kind:"accessor",name:"_edgelessFrameOrderMenu",static:!1,private:!1,access:{has:e=>"_edgelessFrameOrderMenu"in e,get:e=>e._edgelessFrameOrderMenu,set:(e,t)=>{e._edgelessFrameOrderMenu=t}},metadata:C},p,f),uS(this,null,o,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:C},g,m),uS(this,null,r,{kind:"accessor",name:"frames",static:!1,private:!1,access:{has:e=>"frames"in e,get:e=>e.frames,set:(e,t)=>{e.frames=t}},metadata:C},v,y),uS(this,null,a,{kind:"accessor",name:"popperShow",static:!1,private:!1,access:{has:e=>"popperShow"in e,get:e=>e.popperShow,set:(e,t)=>{e.popperShow=t}},metadata:C},b,w),uS(this,null,n,{kind:"accessor",name:"setPopperShow",static:!1,private:!1,access:{has:e=>"setPopperShow"in e,get:e=>e.setPopperShow,set:(e,t)=>{e.setPopperShow=t}},metadata:C},x,_),uS(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}static{this.styles=(0,L.AH)` edgeless-frame-order-menu { display: none; } edgeless-frame-order-menu[data-show] { display: initial; } `}firstUpdated(){this._edgelessFrameOrderPopper=(0,ai.j)(this._edgelessFrameOrderButton,this._edgelessFrameOrderMenu,({display:e})=>this.setPopperShow("show"===e),{mainAxis:22})}render(){let{readonly:e}=this.edgeless.doc;return(0,L.qy)` {e||this._edgelessFrameOrderPopper?.toggle()}} .iconContainerPadding=${0} > ${G.qK6} `}#aq;get _edgelessFrameOrderButton(){return this.#aq}set _edgelessFrameOrderButton(e){this.#aq=e}#aU;get _edgelessFrameOrderMenu(){return this.#aU}set _edgelessFrameOrderMenu(e){this.#aU=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#rA;get frames(){return this.#rA}set frames(e){this.#rA=e}#aW;get popperShow(){return this.#aW}set popperShow(e){this.#aW=e}#aG;get setPopperShow(){return this.#aG}set setPopperShow(e){this.#aG=e}constructor(){super(...arguments),this._edgelessFrameOrderPopper=null,this.#aq=uM(this,h,void 0),this.#aU=(uM(this,u),uM(this,p,void 0)),this.#i_=(uM(this,f),uM(this,g,void 0)),this.#rA=(uM(this,m),uM(this,v,void 0)),this.#aW=(uM(this,y),uM(this,b,!1)),this.#aG=(uM(this,w),uM(this,x,()=>{})),uM(this,_)}static{uM(t,c)}})})();let uE=new WeakMap;function uI(e){e.style.transform="translateY(0)"}function uB(e){e.style.transform="translateY(calc(100% + 10px))"}function u$(e,t,i){let s=i?.duration??230;uE.has(t)||uE.set(t,new Map);let o=uE.get(t);if((0,H.Z1)(o),o.has(e)){let t=o.get(e);return(0,H.Z1)(t),t.cancel?.(),requestAnimationFrame(()=>uI(t.element)),t}let r=document.createElement("div"),a=document.createElement(e);(0,H.Z1)(t.shadowRoot),r.append(a),t.shadowRoot.append(r),a.style.transition=`all ${s}ms ease`,uB(a),requestAnimationFrame(()=>uI(a)),Object.assign(r.style,{height:"100px",pointerEvents:"none",position:"absolute",overflow:"hidden",width:"100%",maxWidth:"100%",boxSizing:"border-box",left:"0px",bottom:"100%",display:"flex",alignItems:"end"}),Object.assign(a.style,{width:"100%",marginLeft:"30px",maxWidth:"calc(100% - 60px)",bottom:"0%",pointerEvents:"auto"});let n=()=>{r.remove(),a.remove(),uE.get(t)?.delete(e),i?.onDispose?.()},l={element:a,dispose:()=>{uB(a),a.addEventListener("transitionend",n,{once:!0}),l.cancel=()=>a.removeEventListener("transitionend",n)}};return uE.get(t)?.set(e,l),l}var uT=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},uO=function(e,t,i){for(var s=arguments.length>2,o=0;o(()=>{let t,i,s,o,r,a,n,l=(0,P.Tm)(e),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];return class extends l{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;t=[(0,D.MZ)({attribute:!1})],i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,uf.Fg)({context:ux,subscribe:!0})],r=[(0,uf.Fg)({context:u_})],a=[(0,D.MZ)({attribute:!1})],n=[(0,uf.Fg)({context:uw})],uT(this,null,t,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:e},c,d),uT(this,null,i,{kind:"accessor",name:"edgelessTool",static:!1,private:!1,access:{has:e=>"edgelessTool"in e,get:e=>e.edgelessTool,set:(e,t)=>{e.edgelessTool=t}},metadata:e},h,u),uT(this,null,s,{kind:"accessor",name:"popper",static:!1,private:!1,access:{has:e=>"popper"in e,get:e=>e.popper,set:(e,t)=>{e.popper=t}},metadata:e},p,f),uT(this,null,o,{kind:"accessor",name:"theme",static:!1,private:!1,access:{has:e=>"theme"in e,get:e=>e.theme,set:(e,t)=>{e.theme=t}},metadata:e},g,m),uT(this,null,r,{kind:"accessor",name:"toolbar",static:!1,private:!1,access:{has:e=>"toolbar"in e,get:e=>e.toolbar,set:(e,t)=>{e.toolbar=t}},metadata:e},v,y),uT(this,null,a,{kind:"accessor",name:"toolbarContainer",static:!1,private:!1,access:{has:e=>"toolbarContainer"in e,get:e=>e.toolbarContainer,set:(e,t)=>{e.toolbarContainer=t}},metadata:e},b,w),uT(this,null,n,{kind:"accessor",name:"toolbarSlots",static:!1,private:!1,access:{has:e=>"toolbarSlots"in e,get:e=>e.toolbarSlots,set:(e,t)=>{e.toolbarSlots=t}},metadata:e},x,_),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}_applyActiveStyle(){this.enableActiveBackground&&(this.style.background=this.active?(0,iW.Vg)("hoverColor"):"transparent")}_updateActiveEdgelessTool(e){this.edgelessTool=e??this.edgeless.edgelessTool}connectedCallback(){super.connectedCallback(),this.edgeless&&(this._updateActiveEdgelessTool(),this._applyActiveStyle(),this._disposables.add(this.edgeless.slots.edgelessToolUpdated.on(e=>{this._updateActiveEdgelessTool(e),this._applyActiveStyle()})))}createPopper(...e){return this.toolbar.activePopper&&(this.toolbar.activePopper.dispose(),this.toolbar.activePopper=null),this.popper=u$(e[0],e[1],{...e[2],onDispose:()=>{e[2]?.onDispose?.(),this.popper=null}}),this.toolbar.activePopper=this.popper,this.popper}disconnectedCallback(){super.disconnectedCallback(),this.popper?.dispose()}tryDisposePopper(){return!!this.active&&!!this.popper&&(this.popper.dispose(),this.popper=null,!0)}get active(){let{type:e}=this,t=this.edgelessTool.type;return Array.isArray(e)?e.includes(t):t===e}get setEdgelessTool(){return this.edgeless.tools.setEdgelessTool}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#aY;get edgelessTool(){return this.#aY}set edgelessTool(e){this.#aY=e}#aK;get popper(){return this.#aK}set popper(e){this.#aK=e}#aX;get theme(){return this.#aX}set theme(e){this.#aX=e}#aQ;get toolbar(){return this.#aQ}set toolbar(e){this.#aQ=e}#aJ;get toolbarContainer(){return this.#aJ}set toolbarContainer(e){this.#aJ=e}#a1;get toolbarSlots(){return this.#a1}set toolbarSlots(e){this.#a1=e}constructor(){super(...arguments),this.enableActiveBackground=!1,this.#i_=uO(this,c,void 0),this.#aY=(uO(this,d),uO(this,h,void 0)),this.#aK=(uO(this,u),uO(this,p,null)),this.#aX=(uO(this,f),uO(this,g,void 0)),this.#aQ=(uO(this,m),uO(this,v,void 0)),this.#aJ=(uO(this,y),uO(this,b,null)),this.#a1=(uO(this,w),uO(this,x,void 0)),uO(this,_)}}})();var uH=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},uA=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("toggle-switch")],r=[],a=L.WF,n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],uH(this,null,i,{kind:"accessor",name:"on",static:!1,private:!1,access:{has:e=>"on"in e,get:e=>e.on,set:(e,t)=>{e.on=t}},metadata:h},n,l),uH(this,null,s,{kind:"accessor",name:"onChange",static:!1,private:!1,access:{has:e=>"onChange"in e,get:e=>e.onChange,set:(e,t)=>{e.onChange=t}},metadata:h},c,d),uH(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=uL}_toggleSwitch(){this.on=!this.on,this.onChange&&this.onChange(this.on)}render(){return(0,L.qy)` `}#a0=uA(this,n,!1);get on(){return this.#a0}set on(e){this.#a0=e}#eY=(uA(this,l),uA(this,c,void 0));get onChange(){return this.#eY}set onChange(e){this.#eY=e}constructor(){super(...arguments),uA(this,d)}static{uA(t,r)}})})();var uD=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},uZ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d,h,u=[(0,D.EM)("edgeless-navigator-setting-button")],p=[],f=(0,P.Tm)(L.WF),g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],H=[],A=[];(class extends f{static{t=this}static{let P="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;i=[(0,D.P)(".navigator-setting-button")],s=[(0,D.P)(".navigator-setting-menu")],o=[(0,D.wk)()],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],c=[(0,D.MZ)({attribute:!1})],d=[(0,D.MZ)({attribute:!1})],h=[(0,D.MZ)({attribute:!1})],uD(this,null,i,{kind:"accessor",name:"_navigatorSettingButton",static:!1,private:!1,access:{has:e=>"_navigatorSettingButton"in e,get:e=>e._navigatorSettingButton,set:(e,t)=>{e._navigatorSettingButton=t}},metadata:P},g,m),uD(this,null,s,{kind:"accessor",name:"_navigatorSettingMenu",static:!1,private:!1,access:{has:e=>"_navigatorSettingMenu"in e,get:e=>e._navigatorSettingMenu,set:(e,t)=>{e._navigatorSettingMenu=t}},metadata:P},v,y),uD(this,null,o,{kind:"accessor",name:"blackBackground",static:!1,private:!1,access:{has:e=>"blackBackground"in e,get:e=>e.blackBackground,set:(e,t)=>{e.blackBackground=t}},metadata:P},b,w),uD(this,null,r,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:P},x,_),uD(this,null,a,{kind:"accessor",name:"frames",static:!1,private:!1,access:{has:e=>"frames"in e,get:e=>e.frames,set:(e,t)=>{e.frames=t}},metadata:P},C,k),uD(this,null,n,{kind:"accessor",name:"hideToolbar",static:!1,private:!1,access:{has:e=>"hideToolbar"in e,get:e=>e.hideToolbar,set:(e,t)=>{e.hideToolbar=t}},metadata:P},S,M),uD(this,null,l,{kind:"accessor",name:"includeFrameOrder",static:!1,private:!1,access:{has:e=>"includeFrameOrder"in e,get:e=>e.includeFrameOrder,set:(e,t)=>{e.includeFrameOrder=t}},metadata:P},E,I),uD(this,null,c,{kind:"accessor",name:"onHideToolbarChange",static:!1,private:!1,access:{has:e=>"onHideToolbarChange"in e,get:e=>e.onHideToolbarChange,set:(e,t)=>{e.onHideToolbarChange=t}},metadata:P},B,$),uD(this,null,d,{kind:"accessor",name:"popperShow",static:!1,private:!1,access:{has:e=>"popperShow"in e,get:e=>e.popperShow,set:(e,t)=>{e.popperShow=t}},metadata:P},T,O),uD(this,null,h,{kind:"accessor",name:"setPopperShow",static:!1,private:!1,access:{has:e=>"setPopperShow"in e,get:e=>e.setPopperShow,set:(e,t)=>{e.setPopperShow=t}},metadata:P},H,A),uD(null,e={value:t},u,{kind:"class",name:t.name,metadata:P},null,p),t=e.value,P&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:P})}static{this.styles=(0,L.AH)` .navigator-setting-menu { display: none; padding: 8px; border-radius: 8px; font-size: 12px; font-weight: 500; background-color: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-menu-shadow); color: var(--affine-text-primary-color); } .navigator-setting-menu[data-show] { display: flex; flex-direction: column; gap: 4px; } .item-container { padding: 4px 12px; display: flex; justify-content: space-between; align-items: center; min-width: 264px; width: 100%; box-sizing: border-box; } .item-container.header { height: 34px; } .text { padding: 0px 4px; line-height: 22px; font-size: var(--affine-font-sm); color: var(--affine-text-primary-color); } .text.title { font-weight: 500; line-height: 20px; font-size: var(--affine-font-xs); color: var(--affine-text-secondary-color); } .divider { width: 100%; height: 16px; display: flex; align-items: center; } .divider::before { content: ''; width: 100%; height: 1px; background: var(--affine-border-color); } `}_tryRestoreSettings(){let e=this.edgeless.service.editPropsStore.getStorage("presentBlackBackground");this.blackBackground=e??!0}connectedCallback(){super.connectedCallback(),this._tryRestoreSettings()}firstUpdated(){this._navigatorSettingPopper=(0,ai.j)(this._navigatorSettingButton,this._navigatorSettingMenu,({display:e})=>this.setPopperShow("show"===e),{mainAxis:22})}render(){return(0,L.qy)` {this._navigatorSettingPopper?.toggle()}} .iconContainerPadding=${0} > ${sm.I6} `}#a2;get _navigatorSettingButton(){return this.#a2}set _navigatorSettingButton(e){this.#a2=e}#a5;get _navigatorSettingMenu(){return this.#a5}set _navigatorSettingMenu(e){this.#a5=e}#a7;get blackBackground(){return this.#a7}set blackBackground(e){this.#a7=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#rA;get frames(){return this.#rA}set frames(e){this.#rA=e}#a3;get hideToolbar(){return this.#a3}set hideToolbar(e){this.#a3=e}#a4;get includeFrameOrder(){return this.#a4}set includeFrameOrder(e){this.#a4=e}#a6;get onHideToolbarChange(){return this.#a6}set onHideToolbarChange(e){this.#a6=e}#aW;get popperShow(){return this.#aW}set popperShow(e){this.#aW=e}#aG;get setPopperShow(){return this.#aG}set setPopperShow(e){this.#aG=e}constructor(){super(...arguments),this._navigatorSettingPopper=null,this._onBlackBackgroundChange=e=>{this.blackBackground=e,this.edgeless.slots.navigatorSettingUpdated.emit({blackBackground:this.blackBackground})},this.#a2=uZ(this,g,void 0),this.#a5=(uZ(this,m),uZ(this,v,void 0)),this.#a7=(uZ(this,y),uZ(this,b,!0)),this.#i_=(uZ(this,w),uZ(this,x,void 0)),this.#rA=(uZ(this,_),uZ(this,C,void 0)),this.#a3=(uZ(this,k),uZ(this,S,!1)),this.#a4=(uZ(this,M),uZ(this,E,!1)),this.#a6=(uZ(this,I),uZ(this,B,void 0)),this.#aW=(uZ(this,$),uZ(this,T,!1)),this.#aG=(uZ(this,O),uZ(this,H,()=>{})),uZ(this,A)}static{uZ(t,p)}})})();var uj=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},uV=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d=[(0,D.EM)("presentation-toolbar")],h=[],u=uP(L.WF),f=[],g=[],m=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[];(class extends u{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;i=[(0,D.wk)({hasChanged:()=>!0})],s=[(0,D.wk)()],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({type:Boolean})],a=[(0,D.MZ)()],n=[(0,D.MZ)()],l=[(0,D.MZ)({type:Boolean})],c=[(0,D.MZ)({attribute:!0,type:Boolean})],uj(this,null,i,{kind:"accessor",name:"_currentFrameIndex",static:!1,private:!1,access:{has:e=>"_currentFrameIndex"in e,get:e=>e._currentFrameIndex,set:(e,t)=>{e._currentFrameIndex=t}},metadata:p},f,g),uj(this,null,s,{kind:"accessor",name:"_navigatorMode",static:!1,private:!1,access:{has:e=>"_navigatorMode"in e,get:e=>e._navigatorMode,set:(e,t)=>{e._navigatorMode=t}},metadata:p},m,y),uj(this,null,o,{kind:"accessor",name:"containerWidth",static:!1,private:!1,access:{has:e=>"containerWidth"in e,get:e=>e.containerWidth,set:(e,t)=>{e.containerWidth=t}},metadata:p},b,w),uj(this,null,r,{kind:"accessor",name:"frameMenuShow",static:!1,private:!1,access:{has:e=>"frameMenuShow"in e,get:e=>e.frameMenuShow,set:(e,t)=>{e.frameMenuShow=t}},metadata:p},x,_),uj(this,null,a,{kind:"accessor",name:"setFrameMenuShow",static:!1,private:!1,access:{has:e=>"setFrameMenuShow"in e,get:e=>e.setFrameMenuShow,set:(e,t)=>{e.setFrameMenuShow=t}},metadata:p},C,k),uj(this,null,n,{kind:"accessor",name:"setSettingMenuShow",static:!1,private:!1,access:{has:e=>"setSettingMenuShow"in e,get:e=>e.setSettingMenuShow,set:(e,t)=>{e.setSettingMenuShow=t}},metadata:p},S,M),uj(this,null,l,{kind:"accessor",name:"settingMenuShow",static:!1,private:!1,access:{has:e=>"settingMenuShow"in e,get:e=>e.settingMenuShow,set:(e,t)=>{e.settingMenuShow=t}},metadata:p},E,I),uj(this,null,c,{kind:"accessor",name:"visible",static:!1,private:!1,access:{has:e=>"visible"in e,get:e=>e.visible,set:(e,t)=>{e.visible=t}},metadata:p},B,$),uj(null,e={value:t},d,{kind:"class",name:t.name,metadata:p},null,h),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=(0,L.AH)` :host { align-items: inherit; width: 100%; height: 100%; gap: 8px; padding-right: 2px; } .full-divider { width: 8px; height: 100%; display: flex; align-items: center; justify-content: center; } .full-divider::after { content: ''; width: 1px; height: 100%; background: var(--affine-border-color); transform: scaleX(0.5); } .config-buttons { display: flex; gap: 10px; } .edgeless-frame-navigator { width: 140px; display: flex; align-items: center; justify-content: center; } .edgeless-frame-navigator.dense { width: auto; } .edgeless-frame-navigator-title { display: inline-block; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 8px; } .edgeless-frame-navigator-count { color: var(--affine-text-secondary-color); white-space: nowrap; } .edgeless-frame-navigator-stop { border: none; cursor: pointer; padding: 4px; border-radius: 8px; position: relative; overflow: hidden; svg { display: block; } } .edgeless-frame-navigator-stop::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: transparent; border-radius: inherit; } .edgeless-frame-navigator-stop:hover::before { background: var(--affine-hover-color); } `}constructor(e){super(),this._cachedIndex=-1,this.type="frameNavigator",this.#a8=uV(this,f,0),this.#a9=(uV(this,g),uV(this,m,"fit")),this.#ne=(uV(this,y),uV(this,b,1920)),this.#nt=(uV(this,w),uV(this,x,!1)),this.#ni=(uV(this,_),uV(this,C,()=>{})),this.#ns=(uV(this,k),uV(this,S,()=>{})),this.#no=(uV(this,M),uV(this,E,!1)),this.#nr=(uV(this,I),uV(this,B,!0)),uV(this,$),this.edgeless=e}get _cachedPresentHideToolbar(){return!!this.edgeless.service.editPropsStore.getStorage("presentHideToolbar")}set _cachedPresentHideToolbar(e){this.edgeless.service.editPropsStore.setStorage("presentHideToolbar",!!e)}get _frames(){return this.edgeless.service.frames}_moveToCurrentFrame(){let e=this._currentFrameIndex,t=this.edgeless.service.viewport,i=this._frames[e];if(i){let e=p.z.deserialize(i.xywh);if("fill"===this._navigatorMode){let i,s;let o=t.viewportBounds,r=e.center;o.w/o.h>e.w/e.h?s=(i=e.w)*o.h/o.w:i=(s=e.h)*o.w/o.h,e=p.z.fromCenter(r,i,s)}t.setViewportByBound(e,[0,0,0,0],!1),this.edgeless.slots.navigatorFrameChanged.emit(this._frames[this._currentFrameIndex])}}_nextFrame(){let e=this._frames,t=e.length-1;this._currentFrameIndex===e.length-1?(0,e5.o)(this.host,"You have reached the last frame"):this._currentFrameIndex=(0,v.qE)(this._currentFrameIndex+1,0,t)}_previousFrame(){let e=this._frames.length-1;0===this._currentFrameIndex?(0,e5.o)(this.host,"You have reached the first frame"):this._currentFrameIndex=(0,v.qE)(this._currentFrameIndex-1,0,e)}_toggleFullScreen(){if(document.fullscreenElement)clearTimeout(this._timer),document.exitFullscreen().catch(console.error);else{var e;(e=this.edgeless.viewportElement).requestFullscreen?e.requestFullscreen().catch(console.error):"mozRequestFullScreen"in e&&e.mozRequestFullScreen instanceof Function?e.mozRequestFullScreen():"webkitRequestFullscreen"in e&&e.webkitRequestFullscreen instanceof Function?e.webkitRequestFullscreen():"msRequestFullscreen"in e&&e.msRequestFullscreen instanceof Function&&e.msRequestFullscreen(),this._timer=setTimeout(()=>{this._currentFrameIndex=this._cachedIndex},400)}setTimeout(()=>this._moveToCurrentFrame(),400),this.edgeless.slots.fullScreenToggled.emit()}firstUpdated(){let{_disposables:e,edgeless:t}=this,{slots:i}=t;e.add(t.bindHotKey({ArrowLeft:()=>{let{type:e}=this.edgelessTool;"frameNavigator"===e&&this._previousFrame()},ArrowRight:()=>{let{type:e}=this.edgelessTool;"frameNavigator"===e&&this._nextFrame()}},{global:!0})),e.add(i.edgelessToolUpdated.on(e=>{"frameNavigator"===e.type&&(this._cachedIndex=this._currentFrameIndex,this._navigatorMode=e.mode??this._navigatorMode,(0,tE.X8)(t.service.selection.selectedElements[0])&&(this._cachedIndex=this._frames.findIndex(e=>e.id===t.service.selection.selectedElements[0].id)),0===this._frames.length&&(0,e5.o)(this.host,"The presentation requires at least 1 frame. You can firstly create a frame.",5e3),this._toggleFullScreen()),this.requestUpdate()})),e.add(t.slots.navigatorSettingUpdated.on(({fillScreen:e})=>{void 0!==e&&(this._navigatorMode=e?"fill":"fit")})),this._navigatorMode=!0===this.edgeless.service.editPropsStore.getStorage("presentFillScreen")?"fill":"fit"}render(){let e=this._currentFrameIndex,t=this._frames,i=t[e],{doc:s}=this.edgeless;return(0,L.qy)` this._previousFrame()} > ${sm.nC}
${this.dense?L.s6:(0,L.qy)`this._moveToCurrentFrame()} > ${i?.title??"no frame"} `} ${0===t.length?0:e+1} / ${t.length}
this._nextFrame()} .iconContainerPadding=${0} > ${sm.pl}
this._toggleFullScreen()} .iconContainerPadding=${0} .iconContainerWidth=${"24px"} > ${document.fullscreenElement?sm.GX:sm.oO} ${this.dense?L.s6:(0,L.qy)` `} {this._cachedPresentHideToolbar=e}} .popperShow=${this.settingMenuShow} .setPopperShow=${this.setSettingMenuShow} .frames=${this._frames} .includeFrameOrder=${this.dense} >
`}updated(e){e.has("_currentFrameIndex")&&"frameNavigator"===this.edgelessTool.type&&this._moveToCurrentFrame()}get dense(){return this.containerWidth<554}get host(){return this.edgeless.host}#a8;get _currentFrameIndex(){return this.#a8}set _currentFrameIndex(e){this.#a8=e}#a9;get _navigatorMode(){return this.#a9}set _navigatorMode(e){this.#a9=e}#ne;get containerWidth(){return this.#ne}set containerWidth(e){this.#ne=e}#nt;get frameMenuShow(){return this.#nt}set frameMenuShow(e){this.#nt=e}#ni;get setFrameMenuShow(){return this.#ni}set setFrameMenuShow(e){this.#ni=e}#ns;get setSettingMenuShow(){return this.#ns}set setSettingMenuShow(e){this.#ns=e}#no;get settingMenuShow(){return this.#no}set settingMenuShow(e){this.#no=e}#nr;get visible(){return this.#nr}set visible(e){this.#nr=e}static{uV(t,h)}})})();let uz=(e,t,i,s,o)=>{let r={...s};return e.editPropsStore.slots.lastPropsUpdated.on(({type:e,props:s})=>{if(e!==t)return;let a=i.filter(e=>s[e]!==r[e]&&void 0!=s[e]).reduce((e,t)=>({...e,[t]:s[t]}),{});Object.assign(r,a),o?.(a,s)})},uR=(e,t,i,s)=>{let o=e.editPropsStore.getLastProps(t),r=i.reduce((e,t)=>({...e,[t]:o[t]}),s);return Object.assign(s,r),r};var uF=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},uN=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("edgeless-slide-menu")],c=[],d=(0,P.Tm)(L.WF),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];(class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.P)(".menu-container")],s=[(0,D.P)(".slide-menu-content")],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,uf.Fg)({context:uw})],uF(this,null,i,{kind:"accessor",name:"_menuContainer",static:!1,private:!1,access:{has:e=>"_menuContainer"in e,get:e=>e._menuContainer,set:(e,t)=>{e._menuContainer=t}},metadata:C},h,u),uF(this,null,s,{kind:"accessor",name:"_slideMenuContent",static:!1,private:!1,access:{has:e=>"_slideMenuContent"in e,get:e=>e._slideMenuContent,set:(e,t)=>{e._slideMenuContent=t}},metadata:C},p,f),uF(this,null,o,{kind:"accessor",name:"height",static:!1,private:!1,access:{has:e=>"height"in e,get:e=>e.height,set:(e,t)=>{e.height=t}},metadata:C},g,m),uF(this,null,r,{kind:"accessor",name:"showNext",static:!1,private:!1,access:{has:e=>"showNext"in e,get:e=>e.showNext,set:(e,t)=>{e.showNext=t}},metadata:C},v,y),uF(this,null,a,{kind:"accessor",name:"showPrevious",static:!1,private:!1,access:{has:e=>"showPrevious"in e,get:e=>e.showPrevious,set:(e,t)=>{e.showPrevious=t}},metadata:C},b,w),uF(this,null,n,{kind:"accessor",name:"toolbarSlots",static:!1,private:!1,access:{has:e=>"toolbarSlots"in e,get:e=>e.toolbarSlots,set:(e,t)=>{e.toolbarSlots=t}},metadata:C},x,_),uF(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}static{this.styles=(0,L.AH)` :host { max-width: 100%; } ::-webkit-scrollbar { display: none; } .slide-menu-wrapper { position: relative; } .menu-container { background: var(--affine-background-overlay-panel-color); border-radius: 8px 8px 0 0; border: 1px solid var(--affine-border-color); border-bottom: none; display: flex; align-items: center; width: fit-content; max-width: 100%; overflow-x: auto; overscroll-behavior: none; scrollbar-width: none; position: relative; height: calc(var(--menu-height) + 1px); box-sizing: border-box; padding: 0 10px; scroll-snap-type: x mandatory; } .slide-menu-content { display: flex; align-items: center; justify-content: center; height: 100%; transition: left 0.5s ease-in-out; } .next-slide-button, .previous-slide-button { align-items: center; justify-content: center; position: absolute; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--affine-border-color); background: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-shadow-2); color: var(--affine-icon-color); transition: transform 0.3s ease-in-out, opacity 0.5s ease-in-out; z-index: 12; } .next-slide-button { opacity: 0; display: flex; top: 50%; right: 0; transform: translate(50%, -50%) scale(0.5); } .next-slide-button:hover { cursor: pointer; transform: translate(50%, -50%) scale(1); } .previous-slide-button { opacity: 0; top: 50%; left: 0; transform: translate(-50%, -50%) scale(0.5); } .previous-slide-button:hover { cursor: pointer; transform: translate(-50%, -50%) scale(1); } .previous-slide-button svg { transform: rotate(180deg); } `}_handleSlideButtonClick(e){let t=this._slideMenuContent.clientWidth,i=this._menuContainer.scrollLeft,s=this._menuContainer.clientWidth;this._menuContainer.scrollTo({left:Math.max(0,Math.min(i+("left"===e?-s:s),t)),behavior:"smooth"})}_handleWheel(e){e.stopPropagation()}_toggleSlideButton(){let e=this._menuContainer.scrollLeft,t=this._menuContainer.clientWidth,i=this._slideMenuContent.clientWidth-t+2;this.showPrevious=e>0,this.showNext=e{this._toggleSlideButton()}),this._disposables.add(this.toolbarSlots.resize.on(()=>this._toggleSlideButton()))}render(){return(0,L.qy)`
this._handleSlideButtonClick("left")} style=${(0,Z.W)({opacity:this.showPrevious?"1":"0"})} > ${G.OTM}
this._handleSlideButtonClick("right")} > ${G.OTM}
`}#na=uN(this,h,void 0);get _menuContainer(){return this.#na}set _menuContainer(e){this.#na=e}#nn=(uN(this,u),uN(this,p,void 0));get _slideMenuContent(){return this.#nn}set _slideMenuContent(e){this.#nn=e}#iU=(uN(this,f),uN(this,g,"40px"));get height(){return this.#iU}set height(e){this.#iU=e}#nl=(uN(this,m),uN(this,v,!1));get showNext(){return this.#nl}set showNext(e){this.#nl=e}#nc=(uN(this,y),uN(this,b,!1));get showPrevious(){return this.#nc}set showPrevious(e){this.#nc=e}#a1=(uN(this,w),uN(this,x,void 0));get toolbarSlots(){return this.#a1}set toolbarSlots(e){this.#a1=e}constructor(){super(...arguments),uN(this,_)}static{uN(t,c)}})})();var uq=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},uU=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("edgeless-brush-menu")],a=[],n=uP(L.WF),l=[],c=[],d=[],h=[],u=[],p=[];(class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],uq(this,null,i,{kind:"accessor",name:"color",static:!1,private:!1,access:{has:e=>"color"in e,get:e=>e.color,set:(e,t)=>{e.color=t}},metadata:f},l,c),uq(this,null,s,{kind:"accessor",name:"lineWidth",static:!1,private:!1,access:{has:e=>"lineWidth"in e,get:e=>e.lineWidth,set:(e,t)=>{e.lineWidth=t}},metadata:f},d,h),uq(this,null,o,{kind:"accessor",name:"onChange",static:!1,private:!1,access:{has:e=>"onChange"in e,get:e=>e.onChange,set:(e,t)=>{e.onChange=t}},metadata:f},u,p),uq(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` :host { display: flex; position: absolute; z-index: -1; } .menu-content { display: flex; align-items: center; } menu-divider { height: 24px; margin: 0 9px; } `}render(){let e=j.Q.getColorValue(this.color,tL());return(0,L.qy)` `}#ig;get color(){return this.#ig}set color(e){this.#ig=e}#nd;get lineWidth(){return this.#nd}set lineWidth(e){this.#nd=e}#eY;get onChange(){return this.#eY}set onChange(e){this.#eY=e}constructor(){super(...arguments),this.type="brush",this.#ig=uU(this,l,void 0),this.#nd=(uU(this,c),uU(this,d,void 0)),this.#eY=(uU(this,h),uU(this,u,void 0)),uU(this,p)}static{uU(t,a)}})})();var uW=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},uG=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-brush-tool-button")],s=[],o=uP(L.WF),r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;uW(this,null,[(0,D.wk)()],{kind:"accessor",name:"states",static:!1,private:!1,access:{has:e=>"states"in e,get:e=>e.states,set:(e,t)=>{e.states=t}},metadata:n},r,a),uW(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` :host { display: flex; height: 100%; overflow-y: hidden; } .edgeless-brush-button { height: 100%; } .pen-wrapper { width: 35px; height: 64px; display: flex; align-items: flex-end; justify-content: center; } #edgeless-pen-icon { transition: transform 0.3s ease-in-out; transform: translateY(8px); } .edgeless-brush-button:hover #edgeless-pen-icon, .pen-wrapper.active #edgeless-pen-icon { transform: translateY(0); } `}_toggleBrushMenu(){this.tryDisposePopper()||(this.active||this.setEdgelessTool({type:this.type}),Object.assign(this.createPopper("edgeless-brush-menu",this).element,{edgeless:this.edgeless,onChange:e=>{this.edgeless.service.editPropsStore.recordLastProps("brush",e),this.setEdgelessTool({type:"brush"})}}),this.updateMenu())}connectedCallback(){super.connectedCallback();let{edgeless:e,states:t,statesKeys:i}=this;uR(e.service,"brush",i,t),this.disposables.add(uz(e.service,"brush",i,t,e=>{this.states={...this.states,...e}}))}render(){let{active:e,theme:t}=this,i="dark"===t?sm.ZM:sm.vN,s=j.Q.generateColorProperty(this.states.color);return(0,L.qy)` this._toggleBrushMenu()} >
${i}
`}updateMenu(){let{popper:e}=this;e&&Object.assign(e.element,this.states)}updated(e){e.has("states")&&this.popper&&this.updateMenu()}get statesKeys(){return Object.keys(this.states)}#nh;get states(){return this.#nh}set states(e){this.#nh=e}constructor(){super(...arguments),this.enableActiveBackground=!0,this.type="brush",this.#nh=uG(this,r,{color:tZ,lineWidth:O.D9.Four}),uG(this,a)}static{uG(t,s)}})})();let uY=e=>{let t=e.service.editPropsStore.getLastProps("connector").mode??v.B1.Curve,i="connector"===e.tools.edgelessTool.type,s=(t,i=!0)=>()=>{e.tools.setEdgelessTool({type:"connector",mode:t}),i&&e.service.editPropsStore.recordLastProps("connector",{mode:t})};return{type:"sub-menu",name:"Connector",icon:sm.zN,select:s(t,!1),isSelected:i,options:{items:[{type:"action",name:"Curve",icon:sm.Rj,select:s(v.B1.Curve),isSelected:i&&t===v.B1.Curve},{type:"action",name:"Elbowed",icon:sm.CW,select:s(v.B1.Orthogonal),isSelected:i&&t===v.B1.Orthogonal},{type:"action",name:"Straight",icon:sm._U,select:s(v.B1.Straight),isSelected:i&&t===v.B1.Straight}]}}},uK=e=>{class t extends uP(e){}return t};var uX=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},uQ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("edgeless-connector-menu")],n=[],l=uP(L.WF),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],uX(this,null,i,{kind:"accessor",name:"mode",static:!1,private:!1,access:{has:e=>"mode"in e,get:e=>e.mode,set:(e,t)=>{e.mode=t}},metadata:v},c,d),uX(this,null,s,{kind:"accessor",name:"onChange",static:!1,private:!1,access:{has:e=>"onChange"in e,get:e=>e.onChange,set:(e,t)=>{e.onChange=t}},metadata:v},h,u),uX(this,null,o,{kind:"accessor",name:"stroke",static:!1,private:!1,access:{has:e=>"stroke"in e,get:e=>e.stroke,set:(e,t)=>{e.stroke=t}},metadata:v},p,f),uX(this,null,r,{kind:"accessor",name:"strokeWidth",static:!1,private:!1,access:{has:e=>"strokeWidth"in e,get:e=>e.strokeWidth,set:(e,t)=>{e.strokeWidth=t}},metadata:v},g,m),uX(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { position: absolute; display: flex; z-index: -1; } .connector-submenu-content { display: flex; height: 24px; align-items: center; justify-content: center; } .connector-mode-button-group { display: flex; justify-content: center; align-items: center; gap: 14px; } .connector-mode-button-group > edgeless-tool-icon-button svg { fill: var(--affine-icon-color); } .submenu-divider { width: 1px; height: 24px; margin: 0 16px; background-color: var(--affine-border-color); display: inline-block; } `}render(){var e,t;let{stroke:i,strokeWidth:s}=this,o=(e=this.mode,t=this.onChange,(0,L.qy)`
t({mode:v.B1.Curve})} > ${G.Rjd} t({mode:v.B1.Orthogonal})} > ${G.CW5} t({mode:v.B1.Straight})} > ${G._Uo}
`),r=j.Q.getColorValue(i,tj);return(0,L.qy)`
${o} this.onChange({strokeWidth:e.detail})} > this.onChange({stroke:e.detail})} >
`}#is;get mode(){return this.#is}set mode(e){this.#is=e}#eY;get onChange(){return this.#eY}set onChange(e){this.#eY=e}#nu;get stroke(){return this.#nu}set stroke(e){this.#nu=e}#oH;get strokeWidth(){return this.#oH}set strokeWidth(e){this.#oH=e}constructor(){super(...arguments),this.type="connector",this.#is=uQ(this,c,void 0),this.#eY=(uQ(this,d),uQ(this,h,void 0)),this.#nu=(uQ(this,u),uQ(this,p,void 0)),this.#oH=(uQ(this,f),uQ(this,g,void 0)),uQ(this,m)}static{uQ(t,n)}})})();var uJ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},u1=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-connector-tool-button")],s=[],o=uK(L.WF),r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;uJ(this,null,[(0,D.wk)()],{kind:"accessor",name:"states",static:!1,private:!1,access:{has:e=>"states"in e,get:e=>e.states,set:(e,t)=>{e.states=t}},metadata:n},r,a),uJ(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` :host { display: flex; } .edgeless-connector-button { display: flex; position: relative; } .arrow-up-icon { position: absolute; top: 4px; right: 2px; font-size: 0; } `}_toggleMenu(){if(this.tryDisposePopper())return;let e=this.createPopper("edgeless-connector-menu",this);e.element.edgeless=this.edgeless,e.element.onChange=e=>{this.edgeless.service.editPropsStore.recordLastProps(this.type,e),this.updateMenu(),this.setEdgelessTool({type:this.type,mode:this.states.mode})},this.updateMenu()}connectedCallback(){super.connectedCallback();let{edgeless:e,states:t,stateKeys:i,type:s}=this;uR(e.service,s,i,t),this.disposables.add(uz(e.service,s,i,t,e=>{this.states={...this.states,...e},this.updateMenu()}))}render(){let{active:e}=this;return(0,L.qy)` {this._toggleMenu(),this.edgeless.tools.setEdgelessTool({type:"connector",mode:this.states.mode})}} > ${G.zNy} ${G.Kpk} `}updateMenu(){this.popper&&Object.assign(this.popper.element,this.states)}get stateKeys(){return Object.keys(this.states)}#nh;get states(){return this.#nh}set states(e){this.#nh=e}constructor(){super(...arguments),this.type="connector",this.#nh=u1(this,r,{mode:v.B1.Curve,stroke:tj,strokeWidth:O.D9.Two}),u1(this,a)}static{u1(t,s)}})})();var u0=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},u2=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-default-tool-button")],s=[],o=uK(L.WF),r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;u0(this,null,[(0,D.P)(".current-icon")],{kind:"accessor",name:"currentIcon",static:!1,private:!1,access:{has:e=>"currentIcon"in e,get:e=>e.currentIcon,set:(e,t)=>{e.currentIcon=t}},metadata:n},r,a),u0(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` .current-icon { transition: 100ms; width: 24px; height: 24px; } .current-icon > svg { display: block; } .arrow-up-icon { position: absolute; top: 4px; right: 2px; font-size: 0; color: var(--affine-icon-secondary); } .active .arrow-up-icon { color: inherit; } `}_changeTool(){this.toolbar.activePopper&&this.toolbar.activePopper.dispose();let e=this.edgelessTool?.type;if("default"!==e&&"pan"!==e){"default"===localStorage.defaultTool?this.setEdgelessTool({type:"default"}):"pan"===localStorage.defaultTool&&this.setEdgelessTool({type:"pan",panning:!1});return}this._fadeOut(),setTimeout(()=>{"default"===e?this.setEdgelessTool({type:"pan",panning:!1}):"pan"===e&&this.setEdgelessTool({type:"default"}),this._fadeIn()},100)}_fadeIn(){this.currentIcon.style.opacity="1",this.currentIcon.style.transform="translateY(0px)"}_fadeOut(){this.currentIcon.style.opacity="0",this.currentIcon.style.transform="translateY(-5px)"}connectedCallback(){super.connectedCallback(),localStorage.defaultTool||(localStorage.defaultTool="default"),this.disposables.add(this.edgeless.slots.edgelessToolUpdated.on(({type:e})=>{("default"===e||"pan"===e)&&(localStorage.defaultTool=e)}))}render(){let e=this.edgelessTool?.type,{active:t}=this;return(0,L.qy)` ${"default"===localStorage.defaultTool?G.wBL:G.jNf} ${G.Kpk} `}#np;get currentIcon(){return this.#np}set currentIcon(e){this.#np=e}constructor(){super(...arguments),this.type=["default","pan"],this.#np=u2(this,r,void 0),u2(this,a)}static{u2(t,s)}})})();var u5=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},u7=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-eraser-tool-button")],s=[],o=uP(L.WF);(class extends o{static{t=this}constructor(){super(...arguments),this.enableActiveBackground=!0,this.type="eraser"}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;u5(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` :host { height: 100%; overflow-y: hidden; } .eraser-button { display: flex; justify-content: center; align-items: flex-end; position: relative; width: 49px; height: 64px; } #edgeless-eraser-icon { transition: transform 0.3s ease-in-out; transform: translateY(8px); } .eraser-button:hover #edgeless-eraser-icon, .eraser-button.active #edgeless-eraser-icon { transform: translateY(0); } `}firstUpdated(){this.disposables.add(this.edgeless.bindHotKey({Escape:()=>{"eraser"===this.edgelessTool.type&&this.setEdgelessTool({type:"default"})}},{global:!0}))}render(){let e=this.edgelessTool?.type,{theme:t}=this,i="dark"===t?G.eQl:G.Ec4;return(0,L.qy)` this.setEdgelessTool({type:"eraser"})} >
${i}
`}static{u7(t,s)}})})();let u3=[{name:"1:1",wh:[1200,1200]},{name:"4:3",wh:[1600,1200]},{name:"16:9",wh:[1600,900]},{name:"2:1",wh:[1600,800]}],u4=(e,t)=>{let i=e.service.frames,s=e.service.viewport.center,o=new p.z(s.x-t[0]/2,s.y-t[1]/2,t[0],t[1]),r=e.service.addBlock("affine:frame",{title:new f.rl.Y.Text(`Frame ${i.length+1}`),xywh:o.serialize()},e.surface.model);e.doc.captureSync();let a=e.service.getElementById(r);(0,H.Z1)(a),e.tools.setEdgelessTool({type:"default"}),e.service.selection.set({elements:[a.id],editing:!1})},u6=e=>({type:"sub-menu",name:"Frame",icon:sm.H0,select:()=>e.tools.setEdgelessTool({type:"frame"}),isSelected:"frame"===e.tools.edgelessTool.type,options:{items:[{type:"action",name:"Custom",select:()=>e.tools.setEdgelessTool({type:"frame"})},...u3.map(t=>({type:"action",name:`Slide ${t.name}`,select:()=>u4(e,t.wh)}))]}});var u8=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},u9=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-frame-menu")],s=[],o=uP(L.WF);(class extends o{static{t=this}constructor(){super(...arguments),this.type="frame"}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;u8(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` :host { position: absolute; display: flex; z-index: -1; } .menu-content { display: flex; align-items: center; justify-content: center; gap: 14px; } .frame-add-button { width: 40px; height: 24px; border-radius: 4px; border: 1px solid var(--affine-border-color); color: var(--affine-text-primary-color); line-height: 20px; font-weight: 400; font-size: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; position: relative; } .frame-add-button::before { content: ''; position: absolute; width: 100%; height: 100%; left: 0; top: 0; border-radius: 3px; background: transparent; transition: background-color 0.23s ease; pointer-events: none; } .frame-add-button:hover::before { background: var(--affine-hover-color); } .custom { width: 60px; background: var(--affine-hover-color); } .divider { width: 1px; height: 20px; background: var(--affine-border-color); transform: scaleX(0.5); } `}render(){let{edgeless:e}=this;return(0,L.qy)` `}static{u9(t,s)}})})();var pe=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},pt=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-frame-tool-button")],s=[],o=uK(L.WF);(class extends o{static{t=this}constructor(){super(...arguments),this.type="frame"}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;pe(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` :host { display: flex; } .arrow-up-icon { position: absolute; top: 4px; right: 2px; font-size: 0; } `}_toggleFrameMenu(){this.tryDisposePopper()||(this.createPopper("edgeless-frame-menu",this).element.edgeless=this.edgeless)}render(){let e=this.edgelessTool?.type;return(0,L.qy)` {this._toggleFrameMenu(),this.setEdgelessTool({type:"frame"})}} > ${G.u4h} ${G.Kpk} `}static{pt(t,s)}})})();let pi=e=>({type:"action",name:"Link",icon:sv.qY,select:()=>{let{insertedLinkType:t}=e.service.std.command.exec("insertLinkByQuickSearch");t?.then(t=>{t&&(e.service.telemetryService?.track("CanvasElementAdded",{control:"toolbar:general",page:"whiteboard editor",module:"toolbar",type:t.flavour.split(":")[1]}),t.isNewDoc&&e.service.telemetryService?.track("DocCreated",{control:"toolbar:general",page:"whiteboard editor",module:"edgeless toolbar",type:t.flavour.split(":")[1]}))}).catch(console.error)}});var ps=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},po=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-link-tool-button")],s=[],o=uK(L.WF);(class extends o{static{t=this}constructor(){super(...arguments),this.type="default"}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;ps(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` .link-icon, .link-icon > svg { width: 24px; height: 24px; } `}_onClick(){this.edgeless.service.insertLinkByQuickSearch().then(e=>{e&&(this.edgeless.service.telemetryService?.track("CanvasElementAdded",{control:"toolbar:general",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:e.flavour.split(":")[1]}),e.isNewDoc?(this.edgeless.service.telemetryService?.track("DocCreated",{control:"toolbar:general",page:"whiteboard editor",module:"edgeless toolbar",segment:"whiteboard",type:e.flavour.split(":")[1]}),this.edgeless.service.telemetryService?.track("LinkedDocCreated",{control:"links",page:"whiteboard editor",module:"edgeless toolbar",segment:"whiteboard",type:e.flavour.split(":")[1],other:"new doc"})):this.edgeless.service.telemetryService?.track("LinkedDocCreated",{control:"links",page:"whiteboard editor",module:"edgeless toolbar",segment:"whiteboard",type:e.flavour.split(":")[1],other:"existing doc"}))}).catch(console.error)}render(){return(0,L.qy)` ${sv.qY} `}static{po(t,s)}})})();let pr=e=>({inputType:"touch",x:e.touches[0].clientX,y:e.touches[0].clientY,el:e.currentTarget,originalEvent:e}),pa=e=>({inputType:"mouse",x:e.clientX,y:e.clientY,el:e.currentTarget,originalEvent:e}),pn={startPos:{x:0,y:0},offsetPos:{x:0,y:0},startTime:0,scopeRect:{},edgelessRect:{},elementRectOriginal:{},element:null,elementInfo:null,parentToMount:null,moved:!1,validMoved:!1},pl=e=>`edgeless-draggable-control-overlay-${e}`,pc=(e,t)=>e.classList.add(pl(t)),pd=e=>{let{edgelessRect:t,parentToMount:i,element:s}=e,o=getComputedStyle(s),r=document.createElement("div");pc(r,"mask"),Object.assign(r.style,{position:"absolute",top:"0",left:"0",width:t.width+"px",height:t.height+"px",overflow:"hidden",zIndex:"9999"});let a=document.createElement("div");pc(a,"element");let n=document.createElement("div");pc(n,"transition-wrapper"),Object.assign(n.style,{transition:"all 0.18s ease",transform:"scale(var(--scale, 1)) rotate(var(--rotate, 0deg))",width:o.width,height:o.height}),n.style.setProperty("--rotate","0deg"),n.style.setProperty("--scale","1"),(0,L.XX)(e.elementInfo.preview,n),Object.assign(a.style,{transform:"translate(var(--translate-x, 0), var(--translate-y, 0)) rotate(var(--rotate, 0deg)) scale(var(--scale, 1))",position:"absolute",cursor:"grabbing",transition:"inherit"});let l=document.createElement("style");return l.textContent=` .${pl("transition-wrapper")} > * { display: block; width: 100%; height: 100%; } `,r.append(l),a.append(n),r.append(a),i.append(r),{mask:r,element:a,transitionWrapper:n}},ph=e=>Math.abs(e.x)>50||Math.abs(e.y)>50;class pu{constructor(e,t){this.host=e,this.options=t,this.clearTimeout=null,this.events={},this.info=pn,this.overlay=null,this.states={cancelled:!1,draggingElement:null,dragOut:null},this.host=e,e.addController(this)}_animateCancelDrop(e,t=230){let{overlay:i,info:s}=this;if(!i)return;this.options?.onCanceled?.(i,s.elementInfo),i.mask.style.pointerEvents="none",s.scopeRect&&(i.mask.style.height=s.scopeRect.bottom-s.edgelessRect.top+"px");let{element:o,elementRectOriginal:r}=s,a=o.getBoundingClientRect(),n=a.left-r.left,l=a.top-r.top;i.element.style.transition=`transform ${t}ms ease`,i.element.style.setProperty("--translate-x",`${n}px`),i.element.style.setProperty("--translate-y",`${l}px`),i.transitionWrapper.style.setProperty("--scale","1"),this.clearTimeout=setTimeout(()=>{if(e)return e();this.reset(),this.removeAllEvents(),this.clearTimeout=null},t)}_createOverlay({x:e,y:t}){let{info:i}=this,{elementInfo:s,elementRectOriginal:o,offsetPos:r,edgelessRect:a}=i;this.reset(),this._updateState("draggingElement",s),this.overlay=pd(i);let{overlay:n}=this,{width:l,height:c,left:d,top:h}=o,u=d-a.left,p=h-a.top,f=`${((e-d)/l*100).toFixed(0)}%`,g=`${((t-h)/c*100).toFixed(0)}%`;Object.assign(n.element.style,{left:`${u}px`,top:`${p}px`}),n.element.style.setProperty("--translate-x",`${r.x}px`),n.element.style.setProperty("--translate-y",`${r.y}px`),n.transitionWrapper.style.transformOrigin=`${f} ${g}`,this.options.onOverlayCreated?.(n,s)}_onDragEnd(){let{overlay:e,info:t,options:i}=this,{startTime:s,elementInfo:o,edgelessRect:r,validMoved:a}=t,{service:n,clickThreshold:l=1500}=i,c=n.viewport.zoom;if(!a)return Date.now()-s{this._updateOverlayScale(c)},50),!1):(this.reset(),!0);if(this.states.dragOut&&!this.states.cancelled&&e){let t=e.transitionWrapper.getBoundingClientRect(),[s,a]=this.options.service.viewport.toModelCoord(t.left-r.left,t.top-r.top),n=new p.z(s,a,t.width/c,t.height/c);return i?.onDrop?.(o,n),this.reset(),!0}return this.states.dragOut||this._animateCancelDrop(),!0}_onDragMove(e){if(this.states.cancelled)return;let{info:t,options:i}=this;t.moved||(t.moved=!0,this._createOverlay(e));let{overlay:s}=this;(0,H.Z1)(s);let{x:o,y:r}=e,{startPos:a,scopeRect:n}=t,l=o-a.x,c=r-a.y;if(t.offsetPos={x:l,y:c},!t.validMoved){let e=i.isValidMove??ph;t.validMoved=e(t.offsetPos)}let d=!n||rn.bottom||on.right;d!==this.states.dragOut&&i.onEnterOrLeaveScope?.(s,d),this._updateState("dragOut",d),s.element.style.setProperty("--translate-x",`${l}px`),s.element.style.setProperty("--translate-y",`${c}px`);let h=i.service.viewport.zoom;this._updateOverlayScale(h)}_onDragStart(e,t){let{scopeElement:i,edgeless:s}=this.options;e.originalEvent.stopPropagation(),e.originalEvent.preventDefault();let o=s.host.getBoundingClientRect();if(0===o.width&&(o.width=s.viewport.clientWidth),this.info={startTime:Date.now(),startPos:{x:e.x,y:e.y},offsetPos:{x:0,y:0},scopeRect:i?.getBoundingClientRect()??null,edgelessRect:o,elementRectOriginal:e.el.getBoundingClientRect(),element:e.el,elementInfo:t,moved:!1,validMoved:!1,parentToMount:s.host},this.removeAllEvents(),"mouse"===e.inputType){let e=e=>{this._onDragMove(pa(e))},t=i=>{this._onDragEnd()&&(s.host.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t))};s.host.addEventListener("mousemove",e),window.addEventListener("mouseup",t),this.events={onMouseMove:e,onMouseUp:t}}else{let e=e=>{this._onDragMove(pr(e))},t=i=>{this._onDragEnd()&&(s.host.removeEventListener("touchmove",e),window.removeEventListener("touchend",t))};s.host.addEventListener("touchmove",e),window.addEventListener("touchend",t),this.events={onTouchMove:e,onTouchEnd:t}}}_updateOverlayScale(e){let t=this.overlay?.transitionWrapper;if(!t)return;let i=this.info.elementInfo.standardWidth??this.options.standardWidth??100,{elementRectOriginal:s}=this.info,o=i*e/s.width,r=this.options.clickToDragScale??1.2,a=this.states.dragOut?o:this.options.clickToDrag?r:1;t.style.setProperty("--scale",a.toFixed(2))}_updateState(e,t){this.states[e]=t,this.host.requestUpdate()}_updateStates(e){Object.assign(this.states,e),this.host.requestUpdate()}cancel(){this.states.cancelled||(this._updateState("cancelled",!0),this._animateCancelDrop())}cancelWithoutAnimation(){this.states.cancelled||(this._updateState("cancelled",!0),this.reset(),this.removeAllEvents())}clickToDrag(e,t){this.options.clickToDrag||(this.options.clickToDrag=!0,console.warn("clickToDrag is not enabled, it will be enabled automatically"));let i=e.getBoundingClientRect(),s={x:i.left+i.width/2,y:i.top+i.height/2},o=new MouseEvent("mousedown",{clientX:s.x,clientY:s.y}),r=new MouseEvent("mouseup",{clientX:s.x,clientY:s.y});e.dispatchEvent(o),window.dispatchEvent(r);let a=new MouseEvent("mousemove",{clientX:t.x,clientY:t.y});this.options.edgeless.host.dispatchEvent(a)}hostConnected(){this.host.disposables.add(this.options.service.viewport.viewportUpdated.on(({zoom:e})=>{this._updateOverlayScale(e)})),this.host.disposables.addFromEvent(window,"keydown",e=>{"Escape"===e.key&&this.states.draggingElement&&this.cancel()})}hostDisconnected(){this.removeAllEvents(),this.reset()}onMouseDown(e,t){this._onDragStart(pa(e),t)}onTouchStart(e,t){this._onDragStart(pr(e),t)}removeAllEvents(){let{events:e,options:t}=this,i=t.edgeless.host,{onMouseUp:s,onMouseMove:o,onTouchMove:r,onTouchEnd:a}=e;s&&window.removeEventListener("mouseup",s),o&&i.removeEventListener("mousemove",o),r&&i.removeEventListener("touchmove",r),a&&window.removeEventListener("touchend",a),this.events={}}reset(){this.clearTimeout&&clearTimeout(this.clearTimeout),this.overlay?.mask.remove(),this.overlay=null,this._updateStates({cancelled:!1,draggingElement:null,dragOut:null})}updateElementInfo(e){this.info.elementInfo={...this.info.elementInfo,...e},e.preview&&this.overlay&&(0,L.XX)(e.preview,this.overlay.transitionWrapper)}}let pp={x:"px",y:"px",r:"deg",s:"",z:"",o:""},pf={default:{x:-20,y:-8,r:7.74,s:.92,z:2},active:{x:-22,y:-9,r:-8,s:.92},hover:{x:-22,y:-9,r:-8,s:1,z:3},next:{x:-22,y:64,r:0}},pg={default:{x:4,y:-4,s:1,z:1,r:-7},active:{x:11,y:-14,r:9,s:1},hover:{x:11,y:-14,r:9,s:1.16,z:3},next:{y:64,r:0}},pm=e=>(t,i)=>{let[s,o,r,a]=t.toXYWH(),n=i.addElement("mindmap",{style:e});i.telemetryService?.track("CanvasElementAdded",{control:"toolbar:dnd",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"mindmap"});let l=i.getElementById(n),c=o+a/2,d=(...e)=>{let t=l.addNode(...e);return{node:i.getElementById(t),id:t}},h=d(null,void 0,void 0,{text:"Mind Map",xywh:`[${s},${c-25},145,50]`});for(let e=0;e<3;e++){let t=s+145+300,i=c-17.5+(e-1)*50;d(h.id,void 0,void 0,{text:"Text",xywh:`[${t},${i},80,35]`},tx.p5.RIGHT)}return n},pv=(e,t,i)=>{let s;let o=e.y+e.h/2;if(i.doc.awarenessStore.getFlag("enable_edgeless_text"))s=i.host.spec.getService("affine:edgeless-text").initEdgelessTextBlock({edgeless:i,x:e.x,y:o-16});else{s=t.addElement(v.J9.TEXT,{xywh:new p.z(e.x,o-16,100,32).serialize(),text:new f.rl.Y.Text}),i.doc.captureSync();let r=i.service.getElementById(s);(0,H.nn)(r,v.n6),ih(r,i)}return t.telemetryService?.track("CanvasElementAdded",{control:"toolbar:dnd",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"text"}),s},py=(e,t={})=>{let i={};for(let[s,o]of Object.entries(t))i[`--${e}-${s}`]=`${o}${pp[s]}`;return i},pb=e=>{let t={};for(let[i,s]of Object.entries(e))Object.assign(t,py(i,{...e.default,...s}));return t},pw=(0,L.JW)` `,px=(0,L.JW)` `,p_=(0,L.JW)` `,pC=(0,L.JW)` `,pk=(0,L.JW)` `,pS=(0,L.JW)` `,pM=(0,L.JW)` `,pE=(0,L.JW)` `,pI=(0,L.JW)` `,pB=e=>[{type:"mindmap",icon:e===j.z.Dark?pk:pC,style:v.cy.ONE,render:pm(v.cy.ONE)},{type:"mindmap",icon:pI,style:v.cy.FOUR,render:pm(v.cy.FOUR)},{type:"mindmap",icon:pE,style:v.cy.THREE,render:pm(v.cy.THREE)},{type:"mindmap",icon:"light"===e?pS:pM,style:v.cy.TWO,render:pm(v.cy.TWO)}];var p$=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},pT=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("edgeless-mindmap-menu")],r=[],a=uP(L.WF),n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],p$(this,null,i,{kind:"accessor",name:"activeStyle",static:!1,private:!1,access:{has:e=>"activeStyle"in e,get:e=>e.activeStyle,set:(e,t)=>{e.activeStyle=t}},metadata:h},n,l),p$(this,null,s,{kind:"accessor",name:"onActiveStyleChange",static:!1,private:!1,access:{has:e=>"onActiveStyleChange"in e,get:e=>e.onActiveStyleChange,set:(e,t)=>{e.onActiveStyleChange=t}},metadata:h},c,d),p$(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` :host { display: flex; z-index: -1; justify-content: flex-end; } .text-and-mindmap { display: flex; gap: 10px; padding: 8px 0px; box-sizing: border-box; } .thin-divider { width: 1px; transform: scaleX(0.5); height: 48px; background: var(--affine-border-color); } .text-item { width: 60px; } .mindmap-item { width: 64px; } .text-item, .mindmap-item { border-radius: 4px; height: 48px; position: relative; display: flex; align-items: center; justify-content: center; } .text-item > button, .mindmap-item > button { position: absolute; border-radius: inherit; border: none; background: none; cursor: grab; padding: 0; } .text-item:hover, .mindmap-item:hover { background: var(--affine-hover-color); } .text-item > button.next, .mindmap-item > button.next { transition: transform 0.3s ease-in-out; } `}initDragController(){!this.draggableController&&this.edgeless&&(this.draggableController=new pu(this,{service:this.edgeless.service,edgeless:this.edgeless,scopeElement:this,clickToDrag:!0,onOverlayCreated:()=>{this.setEdgelessTool({type:"mindmap"})},onDrop:(e,t)=>{let i=e.data.render(t,this.edgeless.service,this.edgeless);"mindmap"===e.data.type?(this.onActiveStyleChange?.(e.data.style),this.setEdgelessTool({type:"default"},{elements:[i],editing:!1})):"text"===e.data.type&&this.setEdgelessTool({type:"default"})}}))}render(){let{cancelled:e,draggingElement:t,dragOut:i}=this.draggableController?.states||{},s=t?.data?.type==="text";return(0,L.qy)`
${s?(0,L.qy)``:L.s6} ${c2("Edgeless Text","T")}
${(0,t$.u)(this.mindMaps,s=>{let o=t?.data?.type!=="text",r=t?.data,a=o&&r?.style===s.style;return(0,L.qy)`
${a?(0,L.qy)``:L.s6} ${c2("Mind Map","M")}
`})}
`}updated(e){e.has("edgeless")&&this.initDragController()}get mindMaps(){return pB(this.theme)}#nf;get activeStyle(){return this.#nf}set activeStyle(e){this.#nf=e}#ng;get onActiveStyleChange(){return this.#ng}set onActiveStyleChange(e){this.#ng=e}constructor(){super(...arguments),this.type="mindmap",this.#nf=pT(this,n,void 0),this.#ng=(pT(this,l),pT(this,c,void 0)),pT(this,d)}static{pT(t,r)}})})();var pP=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},pH=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("edgeless-mindmap-tool-button")],n=[],l=uP(L.WF),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.MZ)({type:Boolean})],o=[(0,D.P)(".basket-tool-item.mindmap")],r=[(0,D.wk)()],pP(this,null,i,{kind:"accessor",name:"activeStyle",static:!1,private:!1,access:{has:e=>"activeStyle"in e,get:e=>e.activeStyle,set:(e,t)=>{e.activeStyle=t}},metadata:v},c,d),pP(this,null,s,{kind:"accessor",name:"enableBlur",static:!1,private:!1,access:{has:e=>"enableBlur"in e,get:e=>e.enableBlur,set:(e,t)=>{e.enableBlur=t}},metadata:v},h,u),pP(this,null,o,{kind:"accessor",name:"mindmapElement",static:!1,private:!1,access:{has:e=>"mindmapElement"in e,get:e=>e.mindmapElement,set:(e,t)=>{e.mindmapElement=t}},metadata:v},p,f),pP(this,null,r,{kind:"accessor",name:"readyToDrop",static:!1,private:!1,access:{has:e=>"readyToDrop"in e,get:e=>e.readyToDrop,set:(e,t)=>{e.readyToDrop=t}},metadata:v},g,m),pP(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; } .partial-clip { flex-shrink: 0; box-sizing: border-box; width: calc(100% + 20px); pointer-events: none; padding: 0 10px; overflow: hidden; } .basket-wrapper { pointer-events: auto; height: 64px; width: 96px; display: flex; justify-content: center; align-items: flex-end; position: relative; } .basket, .basket-tool-item { transition: transform 0.3s ease-in-out; position: absolute; } .basket { bottom: 0; height: 17px; width: 76px; } .basket > div, .basket > svg { position: absolute; } .glass { width: 76px; height: 17px; border-radius: 2px; mask: url(#mindmap-basket-body-mask); } .glass.enabled { backdrop-filter: blur(2px); } .basket { z-index: 3; } .basket-tool-item { cursor: grab; } .basket-tool-item svg { display: block; } .basket-tool-item { transform: translate(var(--default-x, 0), var(--default-y, 0)) rotate(var(--default-r, 0)) scale(var(--default-s, 1)); z-index: var(--default-z, 0); } .basket-tool-item.next { transform: translate(var(--next-x, 0), var(--next-y, 0)) rotate(var(--next-r, 0)) scale(var(--next-s, 1)); z-index: var(--next-z, 0); } /* active & hover */ .basket-wrapper:hover .basket, .basket-wrapper.active .basket { z-index: 0; } .basket-wrapper:hover .basket-tool-item.current, .basket-wrapper.active .basket-tool-item.current { transform: translate(var(--active-x, 0), var(--active-y, 0)) rotate(var(--active-r, 0)) scale(var(--active-s, 1)); z-index: var(--active-z, 0); } .basket-tool-item.next.coming, .basket-wrapper:hover .basket-tool-item.current:hover { transform: translate(var(--hover-x, 0), var(--hover-y, 0)) rotate(var(--hover-r, 0)) scale(var(--hover-s, 1)); z-index: var(--hover-z, 0); } `}_toggleMenu(){this.tryDisposePopper()||(this.setEdgelessTool({type:"default"}),Object.assign(this.createPopper("edgeless-mindmap-menu",this).element,{edgeless:this.edgeless,activeStyle:this.activeStyle,onActiveStyleChange:e=>{this.activeStyle=e}}))}initDragController(){if(!this.edgeless||!this.toolbarContainer||this.draggableController)return;this.draggableController=new pu(this,{service:this.edgeless.service,edgeless:this.edgeless,scopeElement:this.toolbarContainer,standardWidth:100,clickToDrag:!0,onOverlayCreated:(e,{data:t})=>{let i=this.draggableTools.find(e=>e.name===t.name);if(!i)return;let s=i.config?.hover?.r??i.config?.default?.r??0;e.element.style.setProperty("--rotate",s+"deg"),setTimeout(()=>{e.transitionWrapper.style.setProperty("--rotate",-s+"deg")},50);let o=i.config?.hover?.s??i.config?.default?.s??1;e.element.style.setProperty("--scale",`${o}`);let r=parseInt(e.element.style.left),a=parseInt(e.element.style.top);"mindmap"===t.name?(e.element.style.left=r+3+"px",e.element.style.top=a+5+"px"):"text"===t.name&&(e.element.style.left=r+0+"px",e.element.style.top=a+3+"px"),this.readyToDrop=!0},onCanceled:e=>{e.transitionWrapper.style.transformOrigin="unset",e.transitionWrapper.style.setProperty("--rotate","0deg"),this.readyToDrop=!1},onDrop:(e,t)=>{let i=e.data.render(t,this.edgeless.service,this.edgeless);this.readyToDrop=!1,"mindmap"===e.data.name?this.setEdgelessTool({type:"default"},{elements:[i],editing:!1}):"text"===e.data.name&&this.setEdgelessTool({type:"default"})}});let e=this.edgeless.bindHotKey({m:()=>{let e=this.edgeless.service;if(e.locked||e.selection.editing)return;if(this.readyToDrop){let e=(this.mindmaps.findIndex(e=>e.style===this.activeStyle)+1)%this.mindmaps.length,t=this.mindmaps[e];this.activeStyle=t.style;let i=this.draggableTools.find(e=>"mindmap"===e.name);(0,H.Z1)(i),this.draggableController.updateElementInfo({data:i,preview:t.icon});return}this.setEdgelessTool({type:"mindmap"});let t=this.mindmapElement;(0,H.Z1)(t);let{x:i,y:s}=e.tool.lastMousePos,{left:o,top:r}=this.edgeless.viewport;this.draggableController.clickToDrag(t,{x:i+o,y:s+r})}},{global:!0});this.disposables.add(e)}render(){let{popper:e,theme:t}=this,{cancelled:i,dragOut:s,draggingElement:o}=this.draggableController?.states||{},r=e||o;return(0,L.qy)`
${(0,t$.u)(this.draggableTools,e=>e.name,e=>{let t=o?.data.name===e.name,r=pb(e.config),a=(0,Z.W)({...r}),n=(0,Z.W)({...r,opacity:t?0:1,pointerEvents:o?"none":"auto"});return(0,L.qy)`${t?(0,L.qy)`
${e.icon}
`:L.s6}
this.draggableController.onMouseDown(t,{data:e,preview:e.icon,standardWidth:e.standardWidth})} @touchstart=${t=>this.draggableController.onTouchStart(t,{data:e,preview:e.icon,standardWidth:e.standardWidth})} class="basket-tool-item current ${e.name}" > ${e.icon}
`})}
${"light"===t?pw:px}
`}updated(e){["edgeless","toolbarContainer"].some(t=>e.has(t))&&!this.draggableController&&this.initDragController()}get draggableTools(){return[{name:"text",icon:p_,config:pf,standardWidth:100,render:pv},{name:"mindmap",icon:this.mindmaps.find(e=>e.style===this.activeStyle).icon,config:pg,standardWidth:350,render:pm(this.activeStyle)}]}get mindmaps(){return pB(this.theme)}#nf;get activeStyle(){return this.#nf}set activeStyle(e){this.#nf=e}#nm;get enableBlur(){return this.#nm}set enableBlur(e){this.#nm=e}#nv;get mindmapElement(){return this.#nv}set mindmapElement(e){this.#nv=e}#ny;get readyToDrop(){return this.#ny}set readyToDrop(e){this.#ny=e}constructor(){super(...arguments),this.enableActiveBackground=!0,this.type=["mindmap","text"],this.#nf=pH(this,c,v.cy.ONE),this.#nm=(pH(this,d),pH(this,h,!0)),this.#nv=(pH(this,u),pH(this,p,void 0)),this.#ny=(pH(this,f),pH(this,g,!1)),pH(this,m)}static{pH(t,n)}})})();let pA=(0,L.JW)` `,pL=[{flavour:"affine:list",type:"bulleted",name:"Bulleted List",description:"A simple bulleted list.",icon:sv.Ry,tooltip:"Drag/Click to insert Bulleted List"},{flavour:"affine:list",type:"numbered",name:"Numbered List",description:"A list with numbering.",icon:sv.gZ,tooltip:"Drag/Click to insert Numbered List"},{flavour:"affine:list",type:"todo",name:"To-do List",description:"Track tasks with a to-do list.",icon:sv.lO,tooltip:"Drag/Click to insert To-do List"}],pD=[{flavour:"affine:paragraph",type:"text",name:"Text",description:"Start typing with plain text.",icon:sv.N$,tooltip:"Drag/Click to insert Text block"},{flavour:"affine:paragraph",type:"h1",name:"Heading 1",description:"Headings in the largest font.",icon:sv.BQ,tooltip:"Drag/Click to insert Heading 1"},{flavour:"affine:paragraph",type:"h2",name:"Heading 2",description:"Headings in the 2nd font size.",icon:sv.So,tooltip:"Drag/Click to insert Heading 2"},{flavour:"affine:paragraph",type:"h3",name:"Heading 3",description:"Headings in the 3rd font size.",icon:sv.Nr,tooltip:"Drag/Click to insert Heading 3"},{flavour:"affine:paragraph",type:"h4",name:"Heading 4",description:"Heading in the 4th font size.",icon:sv.WX,tooltip:"Drag/Click to insert Heading 4"},{flavour:"affine:paragraph",type:"h5",name:"Heading 5",description:"Heading in the 5th font size.",icon:sv.TX,tooltip:"Drag/Click to insert Heading 5"},{flavour:"affine:paragraph",type:"h6",name:"Heading 6",description:"Heading in the 6th font size.",icon:sv.m,tooltip:"Drag/Click to insert Heading 6"},{flavour:"affine:code",type:"code",name:"Code Block",description:"Capture a code snippet.",icon:sv.I5,tooltip:"Drag/Click to insert Code Block"},{flavour:"affine:paragraph",type:"quote",name:"Quote",description:"Capture a quote.",icon:sv.cy,tooltip:"Drag/Click to insert Quote"},{flavour:"affine:divider",type:null,name:"Divider",description:"A visual divider.",icon:sv.z,tooltip:"A visual divider"}].concat(pL).filter(e=>"Divider"!==e.name).map(e=>({icon:e.icon,tooltip:"text"!==e.type?e.tooltip.replace("Drag/Click to insert ",""):"Text",childFlavour:e.flavour,childType:e.type}));var pZ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},pj=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n=[(0,D.EM)("edgeless-note-menu")],l=[],c=uP(L.WF),d=[],h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[];(class extends c{static{t=this}static{let w="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],pZ(this,null,i,{kind:"accessor",name:"_imageLoading",static:!1,private:!1,access:{has:e=>"_imageLoading"in e,get:e=>e._imageLoading,set:(e,t)=>{e._imageLoading=t}},metadata:w},d,h),pZ(this,null,s,{kind:"accessor",name:"childFlavour",static:!1,private:!1,access:{has:e=>"childFlavour"in e,get:e=>e.childFlavour,set:(e,t)=>{e.childFlavour=t}},metadata:w},u,p),pZ(this,null,o,{kind:"accessor",name:"childType",static:!1,private:!1,access:{has:e=>"childType"in e,get:e=>e.childType,set:(e,t)=>{e.childType=t}},metadata:w},f,g),pZ(this,null,r,{kind:"accessor",name:"onChange",static:!1,private:!1,access:{has:e=>"onChange"in e,get:e=>e.onChange,set:(e,t)=>{e.onChange=t}},metadata:w},m,v),pZ(this,null,a,{kind:"accessor",name:"tip",static:!1,private:!1,access:{has:e=>"tip"in e,get:e=>e.tip,set:(e,t)=>{e.tip=t}},metadata:w},y,b),pZ(null,e={value:t},n,{kind:"class",name:t.name,metadata:w},null,l),t=e.value,w&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:w})}static{this.styles=(0,L.AH)` :host { position: absolute; display: flex; z-index: -1; } .menu-content { display: flex; align-items: center; justify-content: center; } .button-group-container { display: flex; justify-content: center; align-items: center; gap: 14px; fill: var(--affine-icon-color); } .button-group-container svg { width: 20px; height: 20px; } .divider { width: 1px; height: 24px; background: var(--affine-border-color); transform: scaleX(0.5); margin: 0 14px; } `}async _addImages(){this._imageLoading=!0;let e=await (0,O.UE)(),t=await this.edgeless.addImages(e);this._imageLoading=!1,this.edgeless.service.tool.setEdgelessTool({type:"default"},{elements:t,editing:!1})}_onHandleLinkButtonClick(){let{insertedLinkType:e}=this.edgeless.service.std.command.exec("insertLinkByQuickSearch");e?.then(e=>{e&&(this.edgeless.service.telemetryService?.track("CanvasElementAdded",{control:"toolbar:general",page:"whiteboard editor",module:"toolbar",type:e.flavour.split(":")[1]}),e.isNewDoc&&this.edgeless.service.telemetryService?.track("DocCreated",{control:"toolbar:general",page:"whiteboard editor",module:"edgeless toolbar",type:e.flavour.split(":")[1]}))}).catch(console.error)}disconnectedCallback(){super.disconnectedCallback()}firstUpdated(){this.disposables.add(this.edgeless.slots.edgelessToolUpdated.on(e=>{"affine:note"===e.type&&(this.childFlavour=e.childFlavour,this.childType=e.childType,this.tip=e.tip)}))}render(){let{childType:e}=this;return(0,L.qy)` `}#nb;get _imageLoading(){return this.#nb}set _imageLoading(e){this.#nb=e}#nw;get childFlavour(){return this.#nw}set childFlavour(e){this.#nw=e}#nx;get childType(){return this.#nx}set childType(e){this.#nx=e}#eY;get onChange(){return this.#eY}set onChange(e){this.#eY=e}#n_;get tip(){return this.#n_}set tip(e){this.#n_=e}constructor(){super(...arguments),this.type="affine:note",this.#nb=pj(this,d,!1),this.#nw=(pj(this,h),pj(this,u,void 0)),this.#nx=(pj(this,p),pj(this,f,void 0)),this.#eY=(pj(this,g),pj(this,m,void 0)),this.#n_=(pj(this,v),pj(this,y,void 0)),pj(this,b)}static{pj(t,l)}})})();var pV=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},pz=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("edgeless-note-senior-button")],n=[],l=uP(L.WF),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.wk)()],pV(this,null,i,{kind:"accessor",name:"_noteBg",static:!1,private:!1,access:{has:e=>"_noteBg"in e,get:e=>e._noteBg,set:(e,t)=>{e._noteBg=t}},metadata:v},c,d),pV(this,null,s,{kind:"accessor",name:"childFlavour",static:!1,private:!1,access:{has:e=>"childFlavour"in e,get:e=>e.childFlavour,set:(e,t)=>{e.childFlavour=t}},metadata:v},h,u),pV(this,null,o,{kind:"accessor",name:"childType",static:!1,private:!1,access:{has:e=>"childType"in e,get:e=>e.childType,set:(e,t)=>{e.childType=t}},metadata:v},p,f),pV(this,null,r,{kind:"accessor",name:"tip",static:!1,private:!1,access:{has:e=>"tip"in e,get:e=>e.tip,set:(e,t)=>{e.tip=t}},metadata:v},g,m),pV(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host, .edgeless-note-button { display: block; width: 100%; height: 100%; } :host * { box-sizing: border-box; } .note-root { --paper-border-color: var(--affine-pure-white); --paper-foriegn-color: rgba(0, 0, 0, 0.1); --paper-shadow: 0px 2px 4px rgba(0, 0, 0, 0.25); --icon-card-bg: #fff; --icon-card-shadow: 0px 2px 4px rgba(0, 0, 0, 0.22), inset 0px -2px 1px rgba(0, 0, 0, 0.14); } .note-root[data-dark='true'] { --paper-border-color: var(--affine-divider-color); --paper-foriegn-color: rgba(255, 255, 255, 0.12); --paper-shadow: 0px 2px 6px rgba(0, 0, 0, 0.8); --icon-card-bg: #343434; --icon-card-shadow: 0px 2px 4px rgba(0, 0, 0, 0.6), inset 0px -2px 1px rgba(255, 255, 255, 0.06); } .note-root { width: 100%; height: 64px; background: transparent; position: relative; overflow: hidden; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; } .paper { --y: 20px; --r: 4.42deg; width: 60px; height: 72px; background: var(--paper-bg); border: 1px solid var(--paper-border-color); position: absolute; transform: translateY(var(--y)) rotate(var(--r)); color: var(--paper-foriegn-color); box-shadow: var(--paper-shadow); padding-top: 32px; padding-left: 3px; transition: transform 0.4s ease; } .edgeless-toolbar-note-icon { position: absolute; width: 26px; height: 26px; border-radius: 2px; display: flex; align-items: center; justify-content: center; color: var(--affine-icon-secondary); background: var(--icon-card-bg); box-shadow: var(--icon-card-shadow); bottom: 12px; transition: transform 0.4s ease; transform: translateX(var(--x)) translateY(var(--y)) rotate(var(--r)); } .edgeless-toolbar-note-icon.link { --x: -22px; --y: -5px; --r: -6deg; transform-origin: 0% 100%; } .edgeless-toolbar-note-icon.text { --r: 4deg; --x: 0px; --y: 0px; } .edgeless-toolbar-note-icon.heading { --x: 21px; --y: -7px; --r: 8deg; transform-origin: 0% 100%; } .note-root:hover .paper { --y: 15px; } .note-root:hover .link { --x: -25px; --y: -5px; --r: -9.5deg; } .note-root:hover .text { --y: -10px; } .note-root:hover .heading { --x: 23px; --y: -8px; --r: 15deg; } `}_toggleNoteMenu(){if(this.tryDisposePopper())return;let{edgeless:e,childFlavour:t,childType:i,tip:s}=this;this.setEdgelessTool({type:"affine:note",childFlavour:t,childType:i,tip:s}),Object.assign(this.createPopper("edgeless-note-menu",this).element,{edgeless:e,childFlavour:t,childType:i,tip:s,onChange:e=>{this._states.forEach(t=>{void 0!=e[t]&&Object.assign(this,{[t]:e[t]})}),this.setEdgelessTool({type:"affine:note",childFlavour:this.childFlavour,childType:this.childType,tip:this.tip})}})}connectedCallback(){super.connectedCallback();let{background:e}=this.edgeless.service.editPropsStore.getLastProps(this.type);this._noteBg=j.Q.generateColorProperty(e,W.KI),this.disposables.add(this.edgeless.service.editPropsStore.slots.lastPropsUpdated.on(({type:e,props:t})=>{e===this.type&&t.background&&(this._noteBg=j.Q.generateColorProperty(t.background,W.KI))}))}render(){let{theme:e,_noteBg:t}=this;return(0,L.qy)`
${pA}
${sv.BQ}
${sv.N$}
`}#nC;get _noteBg(){return this.#nC}set _noteBg(e){this.#nC=e}#nw;get childFlavour(){return this.#nw}set childFlavour(e){this.#nw=e}#nx;get childType(){return this.#nx}set childType(e){this.#nx=e}#n_;get tip(){return this.#n_}set tip(e){this.#n_=e}constructor(){super(...arguments),this._states=["childFlavour","childType","tip"],this.enableActiveBackground=!0,this.type="affine:note",this.#nC=pz(this,c,`var(${W.KI})`),this.#nw=(pz(this,d),pz(this,h,"affine:paragraph")),this.#nx=(pz(this,u),pz(this,p,"text")),this.#n_=(pz(this,f),pz(this,g,"Note")),pz(this,m)}static{pz(t,n)}})})();var pR=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},pF=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("edgeless-note-tool-button")],a=[],n=uK(L.WF),l=[],c=[],d=[],h=[],u=[],p=[];(class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],pR(this,null,i,{kind:"accessor",name:"childFlavour",static:!1,private:!1,access:{has:e=>"childFlavour"in e,get:e=>e.childFlavour,set:(e,t)=>{e.childFlavour=t}},metadata:f},l,c),pR(this,null,s,{kind:"accessor",name:"childType",static:!1,private:!1,access:{has:e=>"childType"in e,get:e=>e.childType,set:(e,t)=>{e.childType=t}},metadata:f},d,h),pR(this,null,o,{kind:"accessor",name:"tip",static:!1,private:!1,access:{has:e=>"tip"in e,get:e=>e.tip,set:(e,t)=>{e.tip=t}},metadata:f},u,p),pR(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` :host { display: flex; } .arrow-up-icon { position: absolute; top: 4px; right: 2px; font-size: 0; } `}_disposeMenu(){this._noteMenu?.dispose(),this._noteMenu=null}_toggleNoteMenu(){this._noteMenu?(this._disposeMenu(),this.requestUpdate()):(this.edgeless.tools.setEdgelessTool({type:"affine:note",childFlavour:this.childFlavour,childType:this.childType,tip:this.tip}),this._noteMenu=u$("edgeless-note-menu",this),this._noteMenu.element.edgeless=this.edgeless,this._noteMenu.element.childFlavour=this.childFlavour,this._noteMenu.element.childType=this.childType,this._noteMenu.element.tip=this.tip,this._noteMenu.element.onChange=e=>{this._states.forEach(t=>{void 0!=e[t]&&Object.assign(this,{[t]:e[t]})}),this.edgeless.tools.setEdgelessTool({type:"affine:note",childFlavour:this.childFlavour,childType:this.childType,tip:this.tip})})}connectedCallback(){super.connectedCallback(),this._disposables.add(this.edgeless.slots.edgelessToolUpdated.on(e=>{"affine:note"!==e.type&&this._disposeMenu()}))}disconnectedCallback(){this._disposeMenu(),super.disconnectedCallback()}render(){let{active:e}=this;return(0,L.qy)` {this._toggleNoteMenu()}} > ${G.Qvf} ${G.Kpk} `}#nw;get childFlavour(){return this.#nw}set childFlavour(e){this.#nw=e}#nx;get childType(){return this.#nx}set childType(e){this.#nx=e}#n_;get tip(){return this.#n_}set tip(e){this.#n_=e}constructor(){super(...arguments),this._noteMenu=null,this._states=["childFlavour","childType","tip"],this.type="affine:note",this.#nw=pF(this,l,"affine:paragraph"),this.#nx=(pF(this,c),pF(this,d,"text")),this.#n_=(pF(this,h),pF(this,u,"Text")),pF(this,p)}static{pF(t,a)}})})();class pN extends iy{constructor(){super(...arguments),this._disableOverlay=!1,this._draggingArea=null,this._draggingElement=null,this._draggingElementId=null,this._moveWithSpaceShapePosTemp=null,this._moveWithSpaceStartPos=[0,0],this._shapeOverlay=null,this.tool={type:"shape",shapeType:"rect"}}_addNewShape(e,t,i){let{viewport:s}=this._service,o=this._edgeless.service.editPropsStore.getLastProps("shape"),{shapeType:r}=this.tool;"rect"===r&&o.radius>0&&(t+=40);let[a,n]=s.toModelCoord(e.point.x,e.point.y),l=new p.z(a,n,t,i),c=this._service.addElement(v.J9.SHAPE,{shapeType:r,xywh:l.serialize(),radius:o.radius});return this._service.telemetryService?.track("CanvasElementAdded",{control:"canvas:draw",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:v.J9.SHAPE,other:{shapeType:r}}),c}_hideOverlay(){this._shapeOverlay&&(this._shapeOverlay.globalAlpha=0,this._edgeless.surface.refresh())}_move(){let{_draggingArea:e,_moveWithSpaceStartPos:t,_moveWithSpaceShapePosTemp:i}=this;if(!e||!i)return;let{x:s,y:o}=e.end,r=s-t[0],a=o-t[1],{start:n,end:l}=i;e.start.x=n.x+r,e.start.y=n.y+a,e.end.x=l.x+r,e.end.y=l.y+a}_resize(e=!1){let{_draggingElementId:t,_draggingArea:i}=this;if(!t||!i)return;let{viewport:s}=this._service,{zoom:o}=s,{start:{x:r,y:a},end:n}=i,{x:l,y:c}=n;if(e){let e=Math.max(Math.abs(l-r),Math.abs(c-a));l=r+(l>r?e:-e),c=a+(c>a?e:-e)}let[d,h]=s.toModelCoord(Math.min(r,l),Math.min(a,c)),u=Math.abs(r-l)/o,f=Math.abs(a-c)/o,g=new p.z(d,h,u,f);this._service.updateElement(t,{xywh:g.serialize()})}_updateOverlayPosition(e,t){this._shapeOverlay&&(this._shapeOverlay.x=e,this._shapeOverlay.y=t,this._edgeless.surface.refresh())}afterModeSwitch(e){"shape"===e.type&&this.createOverlay()}beforeModeSwitch(){this.clearOverlay()}clearOverlay(){this._shapeOverlay&&(this._shapeOverlay.dispose(),this._edgeless.surface.renderer.removeOverlay(this._shapeOverlay),this._shapeOverlay=null,this._edgeless.surface.refresh())}createOverlay(){if(this.clearOverlay(),this._disableOverlay)return;let e=this._edgeless.service.editPropsStore.getLastProps("shape");switch(ii.stroke=j.Q.getColorValue(e.strokeColor,a3.vt,!0),ii.fill=j.Q.getColorValue(e.fillColor,a3.SO,!0),e.strokeStyle){case"dash":ii.strokeLineDash=[12,12];break;case"none":ii.strokeLineDash=[],ii.stroke="transparent";break;default:ii.strokeLineDash=[]}let t=e.shapeType;e.radius>0&&"rect"===t&&(t="roundedRect"),this._shapeOverlay=new hz(this._edgeless,t,ii,{shapeStyle:e.shapeStyle,fillColor:e.fillColor,strokeColor:e.strokeColor}),this._edgeless.surface.renderer.addOverlay(this._shapeOverlay)}onContainerClick(e){if(this.clearOverlay(),this._disableOverlay)return;this._doc.captureSync();let t=this._addNewShape(e,100,100),i=this._service.getElementById(t);i&&this._edgeless.tools.switchToDefaultMode({elements:[i.id],editing:!1})}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(){(0,td.lQ)()}onContainerDragEnd(){if(this._disableOverlay)return;this._draggingElement&&this._draggingElement.pop("xywh");let e=this._draggingElementId;if(!e)return;if(this._draggingArea){let t=Math.abs(this._draggingArea?.end.x-this._draggingArea?.start.x),i=Math.abs(this._draggingArea?.end.y-this._draggingArea?.start.y);if(t<20&&i<20){this._service.removeElement(e);return}}this._draggingElement=null,this._draggingElementId=null,this._draggingArea=null,this._doc.captureSync();let t=this._service.getElementById(e);t&&this._edgeless.tools.switchToDefaultMode({elements:[t.id],editing:!1})}onContainerDragMove(e){!this._disableOverlay&&this._draggingElementId&&this._draggingArea&&(this._draggingArea.end=new DOMPoint(e.x,e.y),this._edgeless.tools.spaceBar&&this._move(),this._resize(e.keys.shift||this._edgeless.tools.shiftKey))}onContainerDragStart(e){if(this._disableOverlay)return;this.clearOverlay(),this._doc.captureSync();let t=this._addNewShape(e,0,0);this._draggingElementId=t,this._draggingElement=this._service.getElementById(t),this._draggingElement.stash("xywh"),this._draggingArea={start:new DOMPoint(e.x,e.y),end:new DOMPoint(e.x,e.y)}}onContainerMouseMove(e){if(!this._shapeOverlay)return;0===this._shapeOverlay.globalAlpha&&(this._shapeOverlay.globalAlpha=1);let[t,i]=this._service.viewport.toModelCoord(e.x,e.y);this._updateOverlayPosition(t,i)}onContainerMouseOut(e){e.raw.relatedTarget&&(0,O.Xn)(e.raw.relatedTarget,ia)||this._hideOverlay()}onContainerPointerDown(){(0,td.lQ)()}onContainerTripleClick(){(0,td.lQ)()}onPressShiftKey(e){this._draggingElementId&&this._resize(e)}onPressSpaceBar(e){let{tools:t}=this._edgeless;if(t.dragging&&e){if(!this._draggingArea)return;let e=this._draggingArea.end.x,t=this._draggingArea.end.y;this._moveWithSpaceStartPos=[e,t];let{start:{x:i,y:s},end:{x:o,y:r}}=this._draggingArea;this._moveWithSpaceShapePosTemp={start:new DOMPoint(i,s),end:new DOMPoint(o,r)}}}setDisableOverlay(e){this._disableOverlay=e}}let pq=e=>{let t=["x","y","s","z"],i=(e,t)=>["x","y"].includes(e)&&"number"==typeof t?`${t}px`:t;return["default","hover","next"].reduce((s,o)=>({...s,...t.reduce((t,s)=>{let r=e.default?.[s],a=e[o]?.[s]??r;return void 0===a?t:{...t,[`--${o}-${s}`]:i(s,a)}},{})}),{})};var pU=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},pW=function(e,t,i){for(var s=arguments.length>2,o=0;o{Object.values(e.style).forEach(e=>{e.y&&(e.y+=-2),e.x&&(e.x+=0)})}),(()=>{let e,t,i,s,o,r,a,n=[(0,D.EM)("edgeless-toolbar-shape-draggable")],l=[],c=uP(L.WF),d=[],h=[],u=[],p=[],f=[],g=[],m=[],y=[],b=[],w=[];(class extends c{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.wk)()],r=[(0,D.P)(".edgeless-shape-draggable")],a=[(0,D.MZ)({attribute:!1})],pU(this,null,i,{kind:"accessor",name:"color",static:!1,private:!1,access:{has:e=>"color"in e,get:e=>e.color,set:(e,t)=>{e.color=t}},metadata:v},d,h),pU(this,null,s,{kind:"accessor",name:"onShapeClick",static:!1,private:!1,access:{has:e=>"onShapeClick"in e,get:e=>e.onShapeClick,set:(e,t)=>{e.onShapeClick=t}},metadata:v},u,p),pU(this,null,o,{kind:"accessor",name:"readyToDrop",static:!1,private:!1,access:{has:e=>"readyToDrop"in e,get:e=>e.readyToDrop,set:(e,t)=>{e.readyToDrop=t}},metadata:v},f,g),pU(this,null,r,{kind:"accessor",name:"shapeContainer",static:!1,private:!1,access:{has:e=>"shapeContainer"in e,get:e=>e.shapeContainer,set:(e,t)=>{e.shapeContainer=t}},metadata:v},m,y),pU(this,null,a,{kind:"accessor",name:"stroke",static:!1,private:!1,access:{has:e=>"stroke"in e,get:e=>e.stroke,set:(e,t)=>{e.stroke=t}},metadata:v},b,w),pU(null,e={value:t},n,{kind:"class",name:t.name,metadata:v},null,l),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { display: flex; justify-content: center; align-items: flex-end; } .edgeless-shape-draggable { /* avoid shadow clipping */ --shadow-safe-area: 10px; box-sizing: border-box; flex-shrink: 0; width: calc(100% + 2 * var(--shadow-safe-area)); height: calc(100% + var(--shadow-safe-area)); padding-top: var(--shadow-safe-area); padding-left: var(--shadow-safe-area); padding-right: var(--shadow-safe-area); overflow: hidden; display: flex; align-items: center; justify-content: center; position: relative; pointer-events: none; } .shape { width: fit-content; height: fit-content; position: absolute; transition: transform 0.3s, z-index 0.1s; transform: translateX(var(--default-x, 0)) translateY(var(--default-y, 0)) scale(var(--default-s, 1)); z-index: var(--default-z, 0); pointer-events: none; } .shape svg { display: block; } .shape svg path, .shape svg circle, .shape svg rect { pointer-events: auto; cursor: grab; } .shape:hover, .shape.cancel { transform: translateX(var(--hover-x, 0)) translateY(var(--hover-y, 0)) scale(var(--hover-s, 1)); z-index: var(--hover-z, 0); } .shape.next { transition: all 0.5s cubic-bezier(0.39, 0.28, 0.09, 0.95); pointer-events: none; transform: translateX(var(--next-x, 0)) translateY(var(--next-y, 0)) scale(var(--next-s, 1)); } .shape.next.coming { transform: translateX(var(--default-x, 0)) translateY(var(--default-y, 0)) scale(var(--default-s, 1)); } `}_setShapeOverlayLock(e){let t=this.edgeless.tools.currentController;t instanceof pN&&t.setDisableOverlay(e)}initDragController(){this.edgeless&&this.toolbarContainer&&!this.draggableController&&(this.draggableController=new pu(this,{service:this.edgeless.service,edgeless:this.edgeless,scopeElement:this.toolbarContainer,standardWidth:100,clickToDrag:!0,onOverlayCreated:(e,t)=>{Object.assign(e.element.style,{color:this.color,stroke:this.stroke});let i=this.edgeless.tools.currentController;i instanceof pN&&i.clearOverlay(),e.element.style.filter=`drop-shadow(${this.shapeShadow})`,this.readyToDrop=!0,this.draggingShape=t.data.name},onDrop:(e,t)=>{let i=t.serialize(),s=e.data,o=this.edgeless.service.addElement(v.J9.SHAPE,{shapeType:"roundedRect"===s.name?v.IO.Rect:s.name,xywh:i,radius:"roundedRect"===s.name?.1:0});this.edgeless.service.telemetryService?.track("CanvasElementAdded",{control:"toolbar:dnd",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"shape",other:{shapeType:"roundedRect"===s.name?v.IO.Rect:s.name}}),this._setShapeOverlayLock(!1),this.readyToDrop=!1,this.edgeless.service.tool.setEdgelessTool({type:"default"},{elements:[o],editing:!1})},onCanceled:()=>{this._setShapeOverlayLock(!1),this.readyToDrop=!1},onElementClick:e=>{this.onShapeClick?.(e.data),this._setShapeOverlayLock(!0)},onEnterOrLeaveScope:(e,t)=>{e.element.style.filter=t?"none":`drop-shadow(${this.shapeShadow})`}}),this._disposables.add(this.edgeless.bindHotKey({s:e=>{if(e.get("keyboardState").raw.shiftKey)return;let t=this.edgeless.service;if(t.locked||t.selection.editing)return;if(this.readyToDrop){let e=(pG.findIndex(e=>e.name===this.draggingShape)+1)%pG.length,t=pG[e];this.draggingShape=t.name,this.draggableController.cancelWithoutAnimation()}let i=this.shapeContainer.querySelector(`.shape.${this.draggingShape}`);(0,H.Z1)(i,"Edgeless toolbar Shape element not found");let{x:s,y:o}=t.tool.lastMousePos,{left:r,top:a}=this.edgeless.viewport;this.draggableController.clickToDrag(i,{x:s+r,y:o+a})}},{global:!0})))}render(){let{cancelled:e,dragOut:t,draggingElement:i}=this.draggableController?.states||{},s=i?.data;return(0,L.qy)`
${(0,t$.u)(pG,e=>e.name,i=>{let o=s?.name===i.name,r={...pq(i.style),filter:`drop-shadow(${this.shapeShadow})`},a=(0,Z.W)({...r,opacity:o?0:1}),n=(0,Z.W)(r);return(0,L.qy)`${o?(0,L.qy)`
${i.svg}
`:L.s6}
this.draggableController.onMouseDown(e,{data:i,preview:i.svg})} @touchstart=${e=>this.draggableController.onTouchStart(e,{data:i,preview:i.svg})} @click=${e=>e.stopPropagation()} > ${i.svg}
`})}
`}updated(e){["edgeless","toolbarContainer"].some(t=>e.has(t))&&!this.draggableController&&this.initDragController()}get shapeShadow(){return"dark"===this.theme?"0 0 7px rgba(0, 0, 0, .22)":"0 0 5px rgba(0, 0, 0, .2)"}#ig;get color(){return this.#ig}set color(e){this.#ig=e}#nk;get onShapeClick(){return this.#nk}set onShapeClick(e){this.#nk=e}#ny;get readyToDrop(){return this.#ny}set readyToDrop(e){this.#ny=e}#nS;get shapeContainer(){return this.#nS}set shapeContainer(e){this.#nS=e}#nu;get stroke(){return this.#nu}set stroke(e){this.#nu=e}constructor(){super(...arguments),this.draggingShape="roundedRect",this.type="shape",this.#ig=pW(this,d,void 0),this.#nk=(pW(this,h),pW(this,u,()=>{})),this.#ny=(pW(this,p),pW(this,f,!1)),this.#nS=(pW(this,g),pW(this,m,void 0)),this.#nu=(pW(this,y),pW(this,b,void 0)),pW(this,w)}static{pW(t,l)}})})();var pY=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},pK=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-shape-tool-button")],s=[],o=uP(L.WF),r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;pY(this,null,[(0,D.wk)()],{kind:"accessor",name:"states",static:!1,private:!1,access:{has:e=>"states"in e,get:e=>e.states,set:(e,t)=>{e.states=t}},metadata:n},r,a),pY(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` :host { display: block; width: 100%; height: 100%; } edgeless-toolbar-button, .shapes { width: 100%; height: 64px; } `}_handleShapeClick(e){let t=e.name;if(t!==this.states.shapeType){let e=dO.find(e=>e.name===t);if(!e)return;this.edgeless.service.editPropsStore.recordLastProps("shape",e?.value),this.updateMenu()}this.popper||this._toggleMenu()}_toggleMenu(){this.tryDisposePopper()||(this.setEdgelessTool({type:this.type,shapeType:this.states.shapeType}),Object.assign(this.createPopper("edgeless-shape-menu",this).element,{edgeless:this.edgeless,onChange:e=>{this.edgeless.service.editPropsStore.recordLastProps("shape",e),this.updateMenu(),this._updateOverlay(),this.setEdgelessTool({type:"shape",shapeType:e.shapeType??this.states.shapeType})}}),this.updateMenu())}_updateOverlay(){let e=this.edgeless.tools.currentController;e instanceof pN&&e.createOverlay()}connectedCallback(){super.connectedCallback();let{edgeless:e,states:t,stateKeys:i,type:s}=this;uR(e.service,s,i,t),this.disposables.add(uz(e.service,"shape",i,t,e=>{this.states={...this.states,...e},this.updateMenu()}))}render(){let{active:e,states:{fillColor:t,strokeColor:i}}=this,s=j.Q.generateColorProperty(t),o=j.Q.generateColorProperty(i);return(0,L.qy)` `}updateMenu(){this.popper&&Object.assign(this.popper.element,this.states)}get stateKeys(){return Object.keys(this.states)}#nh;get states(){return this.#nh}set states(e){this.#nh=e}constructor(){super(...arguments),this.type="shape",this.#nh=pK(this,r,{shapeStyle:v.lH.Scribbled,shapeType:pX,fillColor:a3.SO,strokeColor:a3.vt,radius:0}),pK(this,a)}static{pK(t,s)}})})();let pQ=(0,L.qy)` `,pJ={light:(0,L.JW)` `,dark:(0,L.JW)` `},p1={light:(0,L.JW)` `,dark:(0,L.JW)` `},p0={light:(0,L.JW)` `,dark:(0,L.JW)` `},p2=(0,L.qy)` `;var p5=i(50334),p7=i(61677),p3=i(19057);function p4(e,t,i){let s=i.get(e.id),o=i.get(t.id);return s&&o?s.id===o.id?e.index===t.index?0:e.index>t.index?1:-1:s.index>o.index?1:-1:s?s.id===t.id?1:s.index===t.index?0:s.index>t.index?1:-1:o?e.id===o.id?-1:e.index===o.index?0:e.index>o.index?1:-1:e.index===t.index?0:e.index>t.index?1:-1}let p6=e=>{let t=new Map;e.slots.beforeInsert.on(e=>{"block"===e.type&&i(e.data)});let i=i=>{let{blockJson:s}=i,o=t.has(s.id)?t.get(s.id):e.model.doc.collection.idGenerator();if(t.has(s.id)||t.set(s.id,o),s.id=o,i.parent=i.parent?t.get(i.parent)??i.parent:void 0,"affine:surface-ref"===s.flavour&&((0,H.j)(s),s.props.reference=t.get(s.props.reference)??""),"affine:surface"===s.flavour){let i={},o=[];Object.entries(s.props.elements).forEach(([e,s])=>{let r=(0,p3.Fb)();t.set(e,r),s.id=r,i[r]=s,["connector","group"].includes(s.type)&&o.push(r)}),s.children.forEach(i=>{t.set(i.id,e.model.doc.collection.idGenerator())}),o.forEach(e=>{let s=i[e];switch(s.type){case"group":{let e=s.children,i={};Object.entries(e.json).forEach(([e,s])=>{i[t.get(e)??e]=s}),e.json=i}break;case"connector":{let e=s.target;e.id&&(s.target={...e,id:t.get(e.id)});let i=s.source;i.id&&(s.source={...i,id:t.get(i.id)})}}}),s.props.elements=i}}},p8=e=>t=>{let i;if("template"!==t.type)return;let s=null;t.slots.beforeInsert.on(t=>{"template"===t.type?(s=t.bound)&&(i={x:e.x-s.x,y:e.y-s.y},s.x=e.x,s.y=e.y):s&&i&&r(t.data.blockJson)});let o=["group","connector"],r=e=>{if((0,H.Z1)(s),e.props.xywh){let t=p.z.deserialize(e.props.xywh);e.props.xywh=new p.z(t.x+i.x,t.y+i.y,t.w,t.h).serialize()}"affine:surface"===e.flavour&&Object.entries(e.props.elements).forEach(([e,t])=>{let s=t.type;if(o.includes(s)&&t.xywh&&delete t.xywh,t.xywh){let e=p.z.deserialize(t.xywh);t.xywh=new p.z(e.x+i.x,e.y+i.y,e.w,e.h).serialize()}"connector"===s&&["target","source"].forEach(e=>{let s=t[e];if((0,H.j)(s),s.id||!s.position)return;let o=s.position;s.position=[o[0]+i.x,o[1]+i.y]})})}},p9=(e,t)=>i=>{i.slots.beforeInsert.on(e=>{"block"===e.type&&s(e.data.blockJson)});let s=i=>{if("affine:image"===i.flavour&&i.props.xywh){let s=p.z.deserialize(i.props.xywh);i.props.xywh=new p.z(e.x-s.w/2,e.y-s.h/2,s.w,s.h).serialize(),i.props.index=t()}}},fe=e=>t=>{t.slots.beforeInsert.on(e=>{"template"===e.type&&s(),"block"===e.type&&o(e.data.blockJson)});let i=new Map,s=()=>{let s=[],o=[],r=new Map;t.walk(e=>{e.props.index&&("affine:frame"===e.flavour?o.push({id:e.id,index:e.props.index}):s.push({id:e.id,index:e.props.index,flavour:e.flavour})),"affine:surface"===e.flavour&&Object.entries(e.props.elements).forEach(([e,t])=>{if(s.push({index:t.index,flavour:t.type,id:t.id,element:!0}),"group"===t.type){let e=t.children,i={index:t.index,id:t.id};Object.keys(e.json).forEach(e=>{r.set(e,i)})}})}),s.sort((e,t)=>p4(e,t,r)),o.sort((e,t)=>p4(e,t,r)),o.forEach(t=>{i.set(t.id,e("affine:frame"))}),s.forEach(t=>{i.set(t.id,e(t.flavour))})},o=e=>{e.props.index&&(e.props.index=i.get(e.id)??e.props.index),"affine:surface"===e.flavour&&Object.entries(e.props.elements).forEach(([e,t])=>{t.index&&(t.index=i.get(t.id))})}},ft=[],fi=[],fs=e=>e.reduce((e,t)=>t?e.concat(t):e,[]),fo={list:async e=>{let t=fs(await Promise.all(fi.map(t=>t.list(e)))),i=ft.find(t=>t.name===e);return i?(i.templates instanceof Function?await i.templates():await Promise.all((0,sk.HP)(i.templates).map(e=>i.templates[e]()))).concat(t):t},categories:async()=>{let e=fs(await Promise.all(fi.map(e=>e.categories())));return ft.map(e=>e.name).concat(e)},search:async(e,t)=>{let i=fs(await Promise.all(fi.map(i=>i.search(e,t))));return e=e.trim().toLocaleLowerCase(),await Promise.all(ft.map(async s=>{if((!t||t===s.name)&&!(s.templates instanceof Function))return Promise.all((0,sk.HP)(s.templates).map(async t=>{if(function(e,t){let i=Array.from({length:e.length+1},()=>Array.from({length:t.length+1},()=>0));for(let s=1;s<=e.length;s++)for(let o=1;o<=t.length;o++)e[s-1]===t[o-1]?i[s][o]=i[s-1][o-1]+1:i[s][o]=Math.max(i[s-1][o],i[s][o-1]);return i[e.length][t.length]}(e,t.toLocaleLowerCase())===e.length){let e=await s.templates[t]();i.push(e)}}))})),i},extend(e){fi.includes(e)||fi.push(e)}};var fr=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},fa=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("overlay-scrollbar")],s=[],o=L.WF,r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;fr(this,null,[(0,D.P)(".overlay-handle")],{kind:"accessor",name:"_handle",static:!1,private:!1,access:{has:e=>"_handle"in e,get:e=>e._handle,set:(e,t)=>{e._handle=t}},metadata:n},r,a),fr(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` :host { position: fixed; top: 0; right: 0; bottom: 0; width: 10px; opacity: 0; transition: opacity 0.3s; } .overlay-handle { position: absolute; top: 0; left: 2px; background-color: rgba(0, 0, 0, 0.44); border-radius: 3px; width: 6px; } `}_dragHandle(e){let t=e.clientY;this._handleVisible=!0;let i=(0,sy.on)(document,"pointermove",e=>{this._scroll(e.clientY-t),t=e.clientY});(0,sy.Oo)(document,"pointerup",e=>{this._handleVisible=!1,e.stopPropagation(),setTimeout(()=>{this._toggleScrollbarVisible(!1)},800),i()})}_initWheelHandler(){let e=this.parentElement;e.style.contain="layout",e.style.overflow="hidden";let t=null,i=()=>{t&&clearTimeout(t),t=setTimeout(()=>{this._toggleScrollbarVisible(!1),t=null},800)},s=null;this._disposable.addFromEvent(e,"wheel",t=>{if(s=s?.isConnected?s:e.querySelector("[data-scrollable]"),this._scrollable=s,!s)return;let o=0===t.deltaMode?t.deltaY:16*t.deltaY;this._scroll(o??0),i()})}_scroll(e){let t=this._scrollable;t&&(t.scrollBy({left:0,top:e,behavior:"instant"}),(0,sy.Ak)(()=>{this._updateScrollbarRect(t),this._toggleScrollbarVisible(!0)},this))}_toggleScrollbarVisible(e){let t=e||this._handleVisible?"1":"0";this.style.opacity!==t&&(this.style.opacity=t)}_updateScrollbarRect(e){void 0!==e.scrollHeight&&void 0!==e.clientHeight&&(this._handle.style.height=`${e.clientHeight/e.scrollHeight*100}%`),void 0!==e.scrollTop&&void 0!==e.scrollHeight&&(this._handle.style.top=`${e.scrollTop/e.scrollHeight*100}%`)}connectedCallback(){super.connectedCallback(),this._disposable.dispose()}firstUpdated(){this._initWheelHandler()}render(){return(0,L.qy)`
`}#nM;get _handle(){return this.#nM}set _handle(e){this.#nM=e}constructor(){super(...arguments),this._disposable=new eg.K,this._handleVisible=!1,this._scrollable=null,this.#nM=fa(this,r,void 0),fa(this,a)}static{fa(t,s)}})})();var fn=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},fl=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-template-loading")],s=[],o=L.WF;(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;fn(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` @keyframes affine-template-block-rotate { from { rotate: 0deg; } to { rotate: 360deg; } } .affine-template-block-container { width: 20px; height: 20px; overflow: hidden; } .affine-template-block-loading { display: inline-block; width: 20px; height: 20px; position: relative; background: conic-gradient( rgba(30, 150, 235, 1) 90deg, rgba(0, 0, 0, 0.1) 90deg 360deg ); border-radius: 50%; animation: affine-template-block-rotate 1s infinite ease-in; } .affine-template-block-loading::before { content: ''; width: 14px; height: 14px; border-radius: 50%; background-color: white; position: absolute; top: 3px; left: 3px; } `}render(){return(0,L.qy)`
`}static{fl(t,s)}})})();var fc=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},fd=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d=[(0,D.EM)("edgeless-templates-panel")],h=[],u=(0,P.Tm)(L.WF),f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[];var $=class extends u{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.wk)()],a=[(0,D.wk)()],n=[(0,D.wk)()],l=[(0,D.MZ)({attribute:!1})],c=[(0,D.wk)()],fc(this,null,i,{kind:"accessor",name:"_categories",static:!1,private:!1,access:{has:e=>"_categories"in e,get:e=>e._categories,set:(e,t)=>{e._categories=t}},metadata:p},f,g),fc(this,null,s,{kind:"accessor",name:"_currentCategory",static:!1,private:!1,access:{has:e=>"_currentCategory"in e,get:e=>e._currentCategory,set:(e,t)=>{e._currentCategory=t}},metadata:p},m,v),fc(this,null,o,{kind:"accessor",name:"_loading",static:!1,private:!1,access:{has:e=>"_loading"in e,get:e=>e._loading,set:(e,t)=>{e._loading=t}},metadata:p},y,b),fc(this,null,r,{kind:"accessor",name:"_loadingTemplate",static:!1,private:!1,access:{has:e=>"_loadingTemplate"in e,get:e=>e._loadingTemplate,set:(e,t)=>{e._loadingTemplate=t}},metadata:p},w,x),fc(this,null,a,{kind:"accessor",name:"_searchKeyword",static:!1,private:!1,access:{has:e=>"_searchKeyword"in e,get:e=>e._searchKeyword,set:(e,t)=>{e._searchKeyword=t}},metadata:p},_,C),fc(this,null,n,{kind:"accessor",name:"_templates",static:!1,private:!1,access:{has:e=>"_templates"in e,get:e=>e._templates,set:(e,t)=>{e._templates=t}},metadata:p},k,S),fc(this,null,l,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:p},M,E),fc(this,null,c,{kind:"accessor",name:"isDragging",static:!1,private:!1,access:{has:e=>"isDragging"in e,get:e=>e.isDragging,set:(e,t)=>{e.isDragging=t}},metadata:p},I,B),fc(null,e={value:t},d,{kind:"class",name:t.name,metadata:p},null,h),$=t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=(0,L.AH)` :host { position: absolute; font-family: ${(0,L.iz)(iW.$7.fontSansFamily)}; z-index: 1; } .edgeless-templates-panel { width: 467px; height: 568px; border-radius: 12px; background-color: var(--affine-background-overlay-panel-color); box-shadow: 0px 10px 80px 0px rgba(0, 0, 0, 0.2); display: flex; flex-direction: column; } .search-bar { padding: 21px 24px; font-size: 18px; color: var(--affine-secondary); border-bottom: 1px solid var(--affine-divider-color); flex-shrink: 0; } .search-input { border: 0; color: var(--affine-text-primary-color); font-size: 20px; background-color: inherit; outline: none; width: 100%; } .search-input::placeholder { color: var(--affine-text-secondary-color); } .template-categories { display: flex; padding: 6px 8px; gap: 4px; overflow-x: scroll; flex-shrink: 0; } .category-entry { color: var(--affine-text-primary-color); font-size: 12px; font-weight: 600; line-height: 20px; border-radius: 8px; flex-shrink: 0; flex-grow: 0; width: fit-content; padding: 4px 9px; cursor: pointer; } .category-entry.selected, .category-entry:hover { color: var(--affine-text-primary-color); background-color: var(--affine-background-tertiary-color); } .template-viewport { position: relative; flex-grow: 1; } .template-scrollcontent { overflow: hidden; height: 100%; width: 100%; } .template-list { padding: 10px; display: flex; align-items: flex-start; align-content: flex-start; gap: 10px 20px; flex-wrap: wrap; } .template-item { position: relative; width: 135px; height: 80px; box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.02); background-color: var(--affine-background-primary-color); border-radius: 4px; cursor: pointer; } .template-item > svg { display: block; margin: 0 auto; width: 135px; height: 80px; color: var(--affine-background-primary-color); } /* .template-item:hover::before { content: attr(data-hover-text); position: absolute; display: block; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 110px; border-radius: 8px; padding: 4px 22px; box-sizing: border-box; z-index: 1; text-align: center; font-size: 12px; background-color: var(--affine-primary-color); color: var(--affine-white); } */ .template-item:hover::after { content: ''; position: absolute; left: 0; top: 0; width: 100%; height: 100%; box-sizing: border-box; border: 1px solid var(--affine-black-10); border-radius: 4px; background-color: var(--affine-hover-color); } .template-item.loading::before { display: none; } .template-item.loading > affine-template-loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); } .template-item img.template-preview { object-fit: contain; width: 100%; height: 100%; display: block; } .arrow { bottom: 0; position: absolute; transform: translateY(20px); color: var(--affine-background-overlay-panel-color); } `}static{this.templates=fo}_closePanel(){this.isDragging||this.dispatchEvent(new CustomEvent("closepanel"))}_createTemplateJob(e,t){let i=[],s=this.edgeless.service;if("template"===e){let e=(0,p7.ql)(s.blocks.map(e=>p.z.deserialize(e.xywh)).concat(s.elements));e&&(e.x+=e.w+20/s.viewport.zoom,i.push(p8(e)));let t=s.layer.createIndexGenerator(!0);i.push(fe(e=>t(e)))}return"sticker"===e&&i.push(p9(t,()=>s.layer.generateIndex("affine:image"))),i.push(p6),this.edgeless.service.TemplateJob.create({model:this.edgeless.surfaceBlockModel,type:e,middlewares:i})}_fetch(e){this._fetchJob&&this._fetchJob.cancel(),this._loading=!0;let t={canceled:!1},i={cancel:()=>{t.canceled=!0}};this._fetchJob=i,e(t).catch(()=>{}).finally(()=>{t.canceled||i!==this._fetchJob||(this._loading=!1,this._fetchJob=null)})}_getLocalSelectedCategory(){return this.edgeless.service.editPropsStore.getStorage("templateCache")}async _initCategory(){try{this._categories=await $.templates.categories(),this._currentCategory=this._getLocalSelectedCategory()??this._categories[0],this._updateTemplates()}catch(e){console.error("Failed to load categories",e)}}_initDragController(){this.draggableController||(this.draggableController=new pu(this,{service:this.edgeless.service,edgeless:this.edgeless,clickToDrag:!0,standardWidth:560,onOverlayCreated:e=>{this.isDragging=!0,e.mask.style.color="transparent"},onDrop:(e,t)=>{this._insertTemplate(e.data,t).finally(()=>{this.isDragging=!1}).catch(console.error)},onCanceled:()=>{this.isDragging=!1}}))}async _insertTemplate(e,t){this._loadingTemplate=e,e=function(e){let t=new WeakMap,i=e=>{if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);let s=Array.isArray(e)?[]:{};return t.set(e,s),Object.keys(e).forEach(t=>{s[t]=i(e[t])}),s};return i(e)}(e);let i={x:t.x+t.w/2,y:t.y+t.h/2},s=this._createTemplateJob(e.type,i),o=this.edgeless.service;try{let{assets:t}=e;t&&await Promise.all(Object.entries(t).map(([e,t])=>fetch(t).then(e=>e.blob()).then(t=>s.job.assets.set(e,t))));let i=await s.insertTemplate(e.content);if(i&&"template"===e.type){let e=20/o.viewport.zoom;o.viewport.setViewportByBound(i,[e,e,e,e],!0)}}finally{this._loadingTemplate=null,this.edgeless.service.tool.setEdgelessTool({type:"default"})}}_updateSearchKeyword(e){this._searchKeyword=e.target.value,this._updateTemplates()}_updateTemplates(){this._fetch(async e=>{try{let t=this._searchKeyword?await $.templates.search(this._searchKeyword):await $.templates.list(this._currentCategory);if(e.canceled)return;this._templates=t}catch(t){if(e.canceled)return;console.error("Failed to load templates",t)}})}connectedCallback(){super.connectedCallback(),this._initDragController(),this.addEventListener("keydown",sy.dG,!1),this._disposables.add(()=>{this._currentCategory&&this.edgeless.service.editPropsStore.setStorage("templateCache",this._currentCategory)})}firstUpdated(){(0,sy.Ak)(()=>{this._disposables.addFromEvent(document,"click",e=>{this.contains(e.target)||this._closePanel()})},this),this._disposables.addFromEvent(this,"click",sy.dG),this._disposables.addFromEvent(this,"wheel",sy.dG),this._initCategory().catch(()=>{})}render(){let{_categories:e,_currentCategory:t,_templates:i}=this,{draggingElement:s}=this.draggableController?.states||{};return(0,L.qy)`
${(0,t$.u)(e,e=>e,e=>(0,L.qy)`
{this._currentCategory=e,this._updateTemplates()}} > ${e}
`)}
${this._loading?(0,L.qy)``:(0,t$.u)(i,e=>e.name,e=>{let t=e.preview?e.preview.startsWith("`:p2,i=s&&s.data.name===e.name;return(0,L.qy)`
this.draggableController.onMouseDown(i,{data:e,preview:t})} @touchstart=${i=>{this.draggableController.onTouchStart(i,{data:e,preview:t})}} > ${t} ${e===this._loadingTemplate?(0,L.qy)``:L.s6} ${e.name?(0,L.qy)` ${e.name} `:L.s6}
`})}
${pQ}
`}#nE;get _categories(){return this.#nE}set _categories(e){this.#nE=e}#nI;get _currentCategory(){return this.#nI}set _currentCategory(e){this.#nI=e}#i5;get _loading(){return this.#i5}set _loading(e){this.#i5=e}#nB;get _loadingTemplate(){return this.#nB}set _loadingTemplate(e){this.#nB=e}#n$;get _searchKeyword(){return this.#n$}set _searchKeyword(e){this.#n$=e}#nT;get _templates(){return this.#nT}set _templates(e){this.#nT=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#nO;get isDragging(){return this.#nO}set isDragging(e){this.#nO=e}constructor(){super(...arguments),this._fetchJob=null,this.#nE=fd(this,f,[]),this.#nI=(fd(this,g),fd(this,m,"")),this.#i5=(fd(this,v),fd(this,y,!1)),this.#nB=(fd(this,b),fd(this,w,null)),this.#n$=(fd(this,x),fd(this,_,"")),this.#nT=(fd(this,C),fd(this,k,[])),this.#i_=(fd(this,S),fd(this,M,void 0)),this.#nO=(fd(this,E),fd(this,I,!1)),fd(this,B)}static{fd(t,h)}};return $=t})();var fu=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},fp=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("edgeless-template-button")],s=[],o=uP(L.WF),r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;fu(this,null,[(0,D.wk)()],{kind:"accessor",name:"_openedPanel",static:!1,private:!1,access:{has:e=>"_openedPanel"in e,get:e=>e._openedPanel,set:(e,t)=>{e._openedPanel=t}},metadata:n},r,a),fu(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` :host { position: relative; width: 100%; height: 100%; } edgeless-template-button { cursor: pointer; } .template-cards { width: 100%; height: 64px; overflow: hidden; display: flex; justify-content: center; align-items: center; position: relative; } .template-card, .arrow-icon { --x: 0; --y: 0; --r: 0; --s: 1; position: absolute; transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(var(--s)); transition: all 0.3s ease; } .arrow-icon { --y: 17px; background: var(--affine-black-10); width: 24px; height: 24px; border-radius: 50%; display: flex; justify-content: center; align-items: center; } .arrow-icon > svg { color: var(--affine-icon-color); fill: currentColor; width: 20px; height: 20px; } .template-card.card1 { transform-origin: 100% 50%; --x: 15px; --y: 8px; } .template-card.card2 { transform-origin: 0% 50%; --x: -17px; } .template-card.card3 { --y: 27px; } /* hover */ .template-cards:not(.expanded):hover .card1 { --r: 8.69deg; } .template-cards:not(.expanded):hover .card2 { --r: -10.93deg; } .template-cards:not(.expanded):hover .card3 { --y: 22px; --r: 5.19deg; } /* expanded */ .template-cards.expanded .card1 { --x: 17px; --y: -5px; --r: 8.69deg; --s: 0.64; } .template-cards.expanded .card2 { --x: -19px; --y: -6px; --r: -10.93deg; --s: 0.64; } .template-cards.expanded .card3 { --y: -10px; --s: 0.599; --r: 5.19deg; } `}_closePanel(){this._openedPanel&&(this._openedPanel.remove(),this._openedPanel=null,this._cleanup?.(),this._cleanup=null,this.requestUpdate(),this._prevTool&&"template"!==this._prevTool.type?(this.setEdgelessTool(this._prevTool),this._prevTool=null):this.setEdgelessTool({type:"default"}))}_togglePanel(){if(this._openedPanel){this._closePanel(),this._prevTool&&(this.setEdgelessTool(this._prevTool),this._prevTool=null);return}this._prevTool=this.edgelessTool?{...this.edgelessTool}:null,this.setEdgelessTool({type:"template"});let e=document.createElement("edgeless-templates-panel");e.edgeless=this.edgeless,this._cleanup=(0,sy.Oo)(e,"closepanel",()=>{this._closePanel()}),this._openedPanel=e,this.renderRoot.append(e),requestAnimationFrame(()=>{let t=e.renderRoot.querySelector(".arrow");(0,sI.ll)(this,e,()=>{(0,sI.rD)(this,e,{placement:"top",middleware:[(0,sI.cY)(20),(0,sI.UE)({element:t}),(0,sI.BN)()]}).then(({x:i,y:s,middlewareData:o})=>{e.style.left=`${i}px`,e.style.top=`${s}px`,t.style.left=`${(o.arrow?.x??0)-(o.shift?.x??0)}px`}).catch(e=>{console.warn("Can't compute position",e)})})})}render(){let{cards:e,_openedPanel:t}=this;return(0,L.qy)`
${sv.SA}
${(0,t$.u)(e,(e,t)=>(0,L.qy)`
${e}
`)}
`}get cards(){let{theme:e}=this;return[pJ[e],p1[e],p0[e]]}#nP;get _openedPanel(){return this.#nP}set _openedPanel(e){this.#nP=e}constructor(){super(...arguments),this._cleanup=null,this._prevTool=null,this.enableActiveBackground=!0,this.type="template",this.#nP=fp(this,r,null),fp(this,a)}static{fp(t,s)}})})();let ff=({edgeless:e})=>{let{doc:t}=e,i=[];return i.push({type:"default",content:(0,L.qy)``}),t.readonly||i.push({type:"frame",content:(0,L.qy)``,menu:u6(e)}),i.push({type:"connector",content:(0,L.qy)``,menu:uY(e)}),i.push({content:(0,L.qy)``,menu:pi(e)}),i},fg=({edgeless:e,toolbarContainer:t})=>{let{doc:i}=e,s=[];return i.readonly||s.push({name:"Note",content:(0,L.qy)` `}),s.push({name:"Pen",content:(0,L.qy)`
`}),s.push({name:"Shape",content:(0,L.qy)``}),s.push({name:"Mind Map",content:(0,L.qy)``}),s.push({name:"Template",content:(0,L.qy)` `}),s};var fm=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},fv=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("edgeless-toolbar")],c=[],d=(0,P.Tm)(L.WF),h=[],u=[],p=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[];return class extends d{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.wk)()],a=[(0,D.wk)()],n=[(0,D.P)(".edgeless-toolbar-container")],fm(this,null,i,{kind:"accessor",name:"containerWidth",static:!1,private:!1,access:{has:e=>"containerWidth"in e,get:e=>e.containerWidth,set:(e,t)=>{e.containerWidth=t}},metadata:f},h,u),fm(this,null,s,{kind:"accessor",name:"edgelessTool",static:!1,private:!1,access:{has:e=>"edgelessTool"in e,get:e=>e.edgelessTool,set:(e,t)=>{e.edgelessTool=t}},metadata:f},p,g),fm(this,null,o,{kind:"accessor",name:"presentFrameMenuShow",static:!1,private:!1,access:{has:e=>"presentFrameMenuShow"in e,get:e=>e.presentFrameMenuShow,set:(e,t)=>{e.presentFrameMenuShow=t}},metadata:f},m,v),fm(this,null,r,{kind:"accessor",name:"presentSettingMenuShow",static:!1,private:!1,access:{has:e=>"presentSettingMenuShow"in e,get:e=>e.presentSettingMenuShow,set:(e,t)=>{e.presentSettingMenuShow=t}},metadata:f},y,b),fm(this,null,a,{kind:"accessor",name:"scrollSeniorToolIndex",static:!1,private:!1,access:{has:e=>"scrollSeniorToolIndex"in e,get:e=>e.scrollSeniorToolIndex,set:(e,t)=>{e.scrollSeniorToolIndex=t}},metadata:f},w,x),fm(this,null,n,{kind:"accessor",name:"toolbarContainer",static:!1,private:!1,access:{has:e=>"toolbarContainer"in e,get:e=>e.toolbarContainer,set:(e,t)=>{e.toolbarContainer=t}},metadata:f},_,C),fm(null,e={value:t},l,{kind:"class",name:t.name,metadata:f},null,c),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` :host { font-family: ${(0,L.iz)(iW.$7.fontSansFamily)}; position: absolute; z-index: 1; left: calc(50%); transform: translateX(-50%); bottom: 0; -webkit-user-select: none; user-select: none; width: 100%; pointer-events: none; } .edgeless-toolbar-wrapper { width: 100%; display: flex; justify-content: center; } .edgeless-toolbar-toggle-control { pointer-events: auto; padding-bottom: 16px; width: fit-content; max-width: calc(100% - ${(0,L.iz)(64)}px * 2); min-width: 264px; } .edgeless-toolbar-toggle-control[data-enable='true'] { transition: 0.23s ease; padding-top: 100px; transform: translateY(100px); } .edgeless-toolbar-toggle-control[data-enable='true']:hover { padding-top: 0; transform: translateY(0); } .edgeless-toolbar-smooth-corner { display: block; width: fit-content; max-width: 100%; } .edgeless-toolbar-container { position: relative; display: flex; align-items: center; padding: 0 ${(0,L.iz)(12)}px; height: ${(0,L.iz)(64)}px; } :host([disabled]) .edgeless-toolbar-container { pointer-events: none; } .edgeless-toolbar-container[level='second'] { position: absolute; bottom: 8px; transform: translateY(-100%); } .edgeless-toolbar-container[hidden] { display: none; } .quick-tools { display: flex; align-items: center; justify-content: center; gap: ${(0,L.iz)(10)}px; } .full-divider { width: ${(0,L.iz)(8)}px; height: 100%; margin: 0 ${(0,L.iz)(8)}px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; } .full-divider::after { content: ''; display: block; width: 1px; height: 100%; background-color: var(--affine-border-color); } .brush-and-eraser { display: flex; height: 100%; gap: 4px; justify-content: center; } .senior-tools { display: flex; align-items: center; justify-content: flex-start; gap: ${(0,L.iz)(0)}px; height: 100%; min-width: ${(0,L.iz)(96)}px; } .quick-tool-item { width: ${(0,L.iz)(36)}px; height: ${(0,L.iz)(36)}px; display: flex; justify-content: center; align-items: center; flex-shrink: 0; } .quick-tool-more { width: 0; height: ${(0,L.iz)(36)}px; flex-shrink: 0; display: flex; justify-content: center; align-items: center; transition: all 0.23s ease; overflow: hidden; } [data-dense-quick='true'] .quick-tool-more { width: ${(0,L.iz)(20)}px; margin-left: ${(0,L.iz)(8)}px; } .quick-tool-more-button { padding: 0; } .senior-tool-item { width: ${(0,L.iz)(96)}px; height: 100%; display: flex; justify-content: center; align-items: center; flex-shrink: 0; } .senior-nav-button-wrapper { flex-shrink: 0; width: 0px; height: ${(0,L.iz)(20)}px; transition: width 0.23s ease; overflow: hidden; } .senior-nav-button { padding: 0; } .senior-nav-button svg { width: 20px; height: 20px; } [data-dense-senior='true'] .senior-nav-button-wrapper { width: ${(0,L.iz)(20)}px; } [data-dense-senior='true'] .senior-nav-button-wrapper.prev { margin-right: ${(0,L.iz)(8)}px; } [data-dense-senior='true'] .senior-nav-button-wrapper.next { margin-left: ${(0,L.iz)(8)}px; } .transform-button svg { transition: 0.3s ease-in-out; } .transform-button:hover svg { transform: scale(1.15); } `}constructor(e){super(),this._moreQuickToolsMenu=null,this._moreQuickToolsMenuRef=null,this._onContainerResize=(0,td.sg)(({w:e})=>{this.slots.resize.emit({w:e,h:64}),this.containerWidth=e,this._denseSeniorTools?this.scrollSeniorToolIndex=Math.min(this._seniorTools.length-this.scrollSeniorToolSize,this.scrollSeniorToolIndex):this.scrollSeniorToolIndex=0,this._denseQuickTools&&this._moreQuickToolsMenu&&this._moreQuickToolsMenuRef&&(this._moreQuickToolsMenu.close(),this._openMoreQuickToolsMenu({currentTarget:this._moreQuickToolsMenuRef})),!this._denseQuickTools&&this._moreQuickToolsMenu&&(this._moreQuickToolsMenu.close(),this._moreQuickToolsMenu=null)},300),this._resizeObserver=null,this._slotsProvider=new uf.DT(this,{context:uw,initialValue:{resize:new f.DX}}),this._themeProvider=new uf.DT(this,{context:ux,initialValue:j.z.Light}),this._toolbarProvider=new uf.DT(this,{context:u_,initialValue:this}),this.activePopper=null,this.setEdgelessTool=e=>{this.edgeless.tools.setEdgelessTool(e)},this.#ne=fv(this,h,1920),this.#aY=(fv(this,u),fv(this,p,{type:localStorage.defaultTool??"default"})),this.#nH=(fv(this,g),fv(this,m,!1)),this.#nA=(fv(this,v),fv(this,y,!1)),this.#nL=(fv(this,b),fv(this,w,0)),this.#aJ=(fv(this,x),fv(this,_,void 0)),fv(this,C),this.edgeless=e}get _availableWidth(){return this.containerWidth-128}get _cachedPresentHideToolbar(){return!!this.edgeless.service.editPropsStore.getStorage("presentHideToolbar")}get _denseQuickTools(){return this._availableWidth-this._seniorToolNavWidth-96-24!!e.menu)}_onSeniorNavNext(){this._seniorScrollNextDisabled||(this.scrollSeniorToolIndex=Math.min(this._seniorTools.length-this.scrollSeniorToolSize,this.scrollSeniorToolIndex+this.scrollSeniorToolSize))}_onSeniorNavPrev(){this._seniorScrollPrevDisabled||(this.scrollSeniorToolIndex=Math.max(0,this.scrollSeniorToolIndex-this.scrollSeniorToolSize))}_openMoreQuickToolsMenu(e){this._hiddenQuickTools.length&&(this._moreQuickToolsMenuRef=e.currentTarget,this._moreQuickToolsMenu=(0,U.zs)(e.currentTarget,{placement:"top",middleware:[(0,sI.cY)({mainAxis:30})],options:{onClose:()=>{this._moreQuickToolsMenu=null,this._moreQuickToolsMenuRef=null},items:this._hiddenQuickTools.map(e=>e.menu)}}))}get _quickTools(){return ff({edgeless:this.edgeless})}get _quickToolsWidthTotal(){return 46*this._quickTools.length-10}_renderContent(){return(0,L.qy)`
${this._quickTools.slice(0,this._visibleQuickToolSize).map(e=>(0,L.qy)`
${e.content}
`)}
e.type===this.edgelessTool?.type)} > ${G.jNK} More Tools
${this._seniorTools.slice(this.scrollSeniorToolIndex,this.scrollSeniorToolIndex+this.scrollSeniorToolSize).map(e=>(0,L.qy)`
${e.content}
`)}
`}get _seniorNextTooltip(){if(this._seniorScrollNextDisabled)return"";let e=this._seniorTools[this.scrollSeniorToolIndex+this.scrollSeniorToolSize];return e?.name??""}get _seniorPrevTooltip(){if(this._seniorScrollPrevDisabled)return"";let e=this._seniorTools[this.scrollSeniorToolIndex-1];return e?.name??""}get _seniorScrollNextDisabled(){return this.scrollSeniorToolIndex+this.scrollSeniorToolSize>=this._seniorTools.length}get _seniorScrollPrevDisabled(){return 0===this.scrollSeniorToolIndex}get _seniorToolNavWidth(){return this._denseSeniorTools?56:0}get _seniorTools(){return fg({edgeless:this.edgeless,toolbarContainer:this.toolbarContainer})}get _seniorToolsWidthTotal(){return 96*this._seniorTools.length-0}get _spaceWidthTotal(){return 48}get _visibleQuickToolSize(){return this._denseQuickTools?Math.max(1,Math.floor((this._availableWidth-this._seniorToolNavWidth-this._spaceWidthTotal-96-20-8)/46)):this._quickTools.length}connectedCallback(){super.connectedCallback(),this._toolbarProvider.setValue(this),this._resizeObserver=new ResizeObserver(e=>{for(let t of e){let{width:e}=t.contentRect;this._onContainerResize({w:e})}}),this._resizeObserver.observe(this),this._disposables.add(j.Q.subscribe(e=>this._themeProvider.setValue(e))),this._disposables.add(this.edgeless.slots.edgelessToolUpdated.on(e=>{this.edgelessTool=e})),this._disposables.add(this.edgeless.bindHotKey({Escape:()=>{if(!this.edgeless.service.selection.editing&&"frameNavigator"!==this.edgelessTool.type){if("default"===this.edgelessTool.type){this.activePopper&&(this.activePopper.dispose(),this.activePopper=null);return}this.setEdgelessTool({type:"default"})}}},{global:!0}))}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver&&this._resizeObserver.disconnect()}firstUpdated(){let{_disposables:e,edgeless:t}=this;e.add(t.service.viewport.viewportUpdated.on(()=>this.requestUpdate())),e.add(t.slots.readonlyUpdated.on(()=>{this.requestUpdate()})),e.add(t.slots.toolbarLocked.on(e=>{this.toggleAttribute("disabled",e)})),e.add(this.edgeless.service.editPropsStore.slots.storageUpdated.on(({key:e})=>{"presentHideToolbar"===e&&this.requestUpdate()}))}render(){let{type:e}=this.edgelessTool||{};return this.edgeless.doc.readonly&&"frameNavigator"!==e?L.s6:(0,L.qy)`
0} data-dense-senior=${this._denseSeniorTools} @dblclick=${sy.dG} @mousedown=${sy.dG} @pointerdown=${sy.dG} > this.presentSettingMenuShow=e} .setFrameMenuShow=${e=>this.presentFrameMenuShow=e} .containerWidth=${this.containerWidth} > ${this.isPresentMode?L.s6:this._renderContent()}
`}get host(){return this.edgeless.host}get isPresentMode(){return"frameNavigator"===this.edgelessTool.type}get scrollSeniorToolSize(){if(this._denseQuickTools)return 1;let e=this._availableWidth-this._quickToolsWidthTotal-this._spaceWidthTotal;return e>=this._seniorToolsWidthTotal?this._seniorTools.length:Math.floor((e-56)/96)||1}get slots(){return this._slotsProvider.value}#ne;get containerWidth(){return this.#ne}set containerWidth(e){this.#ne=e}#aY;get edgelessTool(){return this.#aY}set edgelessTool(e){this.#aY=e}#nH;get presentFrameMenuShow(){return this.#nH}set presentFrameMenuShow(e){this.#nH=e}#nA;get presentSettingMenuShow(){return this.#nA}set presentSettingMenuShow(e){this.#nA=e}#nL;get scrollSeniorToolIndex(){return this.#nL}set scrollSeniorToolIndex(e){this.#nL=e}#aJ;get toolbarContainer(){return this.#aJ}set toolbarContainer(e){this.#aJ=e}static{fv(t,c)}},t})();var fb=i(672),fw=i(82936),fx=i(66397);let f_="blocksuite/surface",fC="image/png",{GROUP:fk,MINDMAP:fS}=tw.J9;class fM extends tl{constructor(e){super(e),this.host=e,this._blockConfigs=[],this._initEdgelessClipboard=()=>{this.host.handleEvent("copy",e=>{let{surfaceSelections:t,selectedIds:i}=this.selectionManager;if(0===i.length)return!1;this._onCopy(e,t)},{global:!0}),this.host.handleEvent("paste",e=>{this._onPaste(e).catch(console.error)},{global:!0}),this.host.handleEvent("cut",e=>{this._onCut(e)},{global:!0})},this._onCopy=(e,t)=>{e.get("clipboardState").raw.preventDefault();let i=(0,tM.Z2)(this.selectionManager.selectedElements,this.surface.edgeless.service.frame);if(t[0]&&t[0].editing){if((0,tE.or)(i[0]))return;this.onPageCopy(e);return}this.std.clipboard.writeToClipboard(async e=>{let t=await fE(i,this.std);return{...e,[f_]:JSON.stringify(t)}}).catch(console.error)},this._onCut=e=>{let{surfaceSelections:t,selectedElements:i}=this.selectionManager;if(0===i.length)return;if(e.get("clipboardState").event.preventDefault(),this._onCopy(e,t),t[0]?.editing){if((0,tE.or)(i[0]))return;this.onPageCut(e);return}let s=(0,tM.Z2)(this.selectionManager.selectedElements,this.surface.edgeless.service.frame);this.doc.transact(()=>{t8(this.surface,s)}),this.selectionManager.set({editing:!1,elements:[]})},this._onPaste=async e=>{if(document.activeElement instanceof HTMLInputElement||document.activeElement instanceof HTMLTextAreaElement)return;let t=e.get("clipboardState").raw;t.preventDefault();let{surfaceSelections:i,selectedElements:s}=this.selectionManager;if(i[0]?.editing){if((0,tE.or)(s[0]))return;this.onPagePaste(e);return}let o=t.clipboardData;if(!o)return;let{lastMousePos:r}=this.toolManager,a=[r.x,r.y];if(function(e){let t=e.types;return 1===t.length&&"Files"===t[0]||2===t.length&&(t.includes("text/plain")||t.includes("text/html"))&&t.includes("Files")}(o)){let e=o.files;if(0===e.length)return;let t=[],i=[];[...e].forEach(e=>{e.type.startsWith("image/")?t.push(e):i.push(e)}),0===i.length?await this.host.addImages(t,a):await this.host.addAttachments([...e],a),this._rootService.telemetryService?.track("CanvasElementAdded",{control:"canvas:paste",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:0===i.length?"image":"attachment"});return}if((0,oT.XH)(o)){let e=o.getData("text/plain"),{lastMousePos:t}=this.toolManager,[i,s]=this.host.service.viewport.toModelCoord(t.x,t.y),r=await this._rootService.quickSearchService?.searchDoc({action:"insert",userInput:e,skipSelection:!0}),a=r&&"docId"in r?r.docId:void 0,n=this._rootService.getEmbedBlockOptions(e),l=a?"affine:embed-linked-doc":n?n.flavour:"affine:bookmark",c=a?"vertical":n?n.styles[0]:ah.HO[0],d=eh.Cd[c],h=eh.Hn[c],u={xywh:p.z.fromCenter(tm.l.toVec({x:i,y:s}),d,h).serialize(),style:c};a?u.pageId=a:u.url=e;let f=this.host.service.addBlock(l,u,this.surface.model.id);this._rootService.telemetryService?.track("CanvasElementAdded",{control:"canvas:paste",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:l.split(":")[1]}),this._rootService.telemetryService?.track("LinkedDocCreated",{page:"whiteboard editor",segment:"whiteboard",category:"pasted link",other:"existing doc"}),this.selectionManager.set({editing:!1,elements:[f]});return}let n=function(e){let t=e.types;if(1===t.length&&"text/plain"!==t[0])return null;let i=new DOMParser().parseFromString(e.getData("text/plain"),"image/svg+xml"),s=i.documentElement;return"svg"===s.tagName&&s.hasAttribute("xmlns")?new File([new Blob([fb.sanitize(i.documentElement,{USE_PROFILES:{svg:!0}})],{type:"image/svg+xml"})],"pasted-image.svg",{type:"image/svg+xml"}):null}(o);if(n){await this.host.addImages([n],a);return}try{let e=this.std.clipboard.readFromClipboard(o),t=e[f_];if(void 0!==t){let{snapshot:e,blobs:i}=JSON.parse(t),s=new f._O({collection:this.std.collection}),o=s.assetsManager.getAssets();for(let e of(e9(i,o),o.keys()))await s.assetsManager.writeToBlob(e);await this._pasteShapesAndBlocks(e);return}let i=e[te.MIME];if(void 0===i)return;let s=JSON.parse(i),r=s?.snapshot;await this._pasteTextContentAsNote(r.content)}catch(e){await this._pasteTextContentAsNote(o.getData("text/plain"))}},this.registerBlock("affine:note",this._createNoteBlocks),this.registerBlock("affine:edgeless-text",this._createEdgelessTextBlocks),this.registerBlock("affine:image",this._createImageBlocks),this.registerBlock("affine:frame",this._createFrameBlocks),this.registerBlock("affine:attachment",this._createAttachmentBlocks),this.registerBlock("affine:bookmark",this._createBookmarkBlocks),this.registerBlock("affine:embed-github",this._createGithubEmbedBlocks),this.registerBlock("affine:embed-youtube",this._createYoutubeEmbedBlocks),this.registerBlock("affine:embed-figma",this._createFigmaEmbedBlocks),this.registerBlock("affine:embed-linked-doc",this._createLinkedDocEmbedBlocks),this.registerBlock("affine:embed-synced-doc",this._createSyncedDocEmbedBlocks),this.registerBlock("affine:embed-html",this._createHtmlEmbedBlocks),this.registerBlock("affine:embed-loom",this._createLoomEmbedBlocks)}_checkCanContinueToCanvas(e,t,i){if(location.pathname!==t||(0,of.zU)(e)!==i)throw Error("Unable to export content to canvas")}async _createAttachmentBlocks(e){let t=[];for(let{props:i}of e){let{xywh:e,rotate:s,sourceId:o,name:r,size:a,type:n,embed:l,style:c}=i;if(!await this.host.std.collection.blobSync.get(o))continue;let d=this.host.service.addBlock("affine:attachment",{xywh:e,rotate:s,sourceId:o,name:r,size:a,type:n,embed:l,style:c},this.surface.model.id);t.push(d)}return t}_createBookmarkBlocks(e){return e.map(({props:e})=>{let{xywh:t,style:i,url:s,caption:o,description:r,icon:a,image:n,title:l}=e;return this.host.service.addBlock("affine:bookmark",{xywh:t,style:i,url:s,caption:o,description:r,icon:a,image:n,title:l},this.surface.model.id)})}_createCanvasElement(e,t){if(e.type===fk){let i=new f.rl.Y.Map;for(let[s,o]of Object.entries(e.children??{})){let e=t.get(s);(0,H.Z1)(e,"Copy failed: cannot find the copied child in group"),i.set(e,o)}e.children=i}if(e.type===fS){let i=new f.rl.Y.Map;for(let[s,o]of Object.entries(e.children??{})){let e=t.get(s),r={...o};if((0,H.Z1)(e,"Copy failed: cannot find the copied node in mind map"),o.parent){let e=t.get(o.parent);(0,H.Z1)(e,"Copy failed: cannot find the copied node in mind map"),r.parent=e}i.set(e,r)}e.children=i}let i=this.host.service.addElement(e.type,e);this.host.service.telemetryService?.track("CanvasElementAdded",{control:"canvas:paste",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:e.type});let s=this.host.service.getElementById(i);return(0,H.Z1)(s),s}_createCanvasElements(e,t){let i=(0,sk.$z)(e,e=>{switch(e.type){case"connector":return"connectors";case"group":return"groups";case"mindmap":return"mindmaps";default:return"others"}});return[...i.others?.map(e=>{let i=e.id;H.Z1(i);let s=this._createCanvasElement(e,t);return t.set(i,s.id),s}).filter(e=>!!e)??[],...i.connectors?.map(e=>{let i=e.id,s=e.source.id;s&&(e.source.id=t.get(s)??s);let o=e.target.id;o&&(e.target.id=t.get(o)??o);let r=this._createCanvasElement(e,t);return t.set(i,r.id),r})??[],...i.groups?.map(e=>{let i=e.id;H.Z1(i);let s=this._createCanvasElement(e,t);return t.set(i,s.id),s})??[],...i.mindmaps?.map(e=>{let i=e.id;H.Z1(i);let s=this._createCanvasElement(e,t);return t.set(i,s.id),s})??[]]}async _createEdgelessTextBlocks(e,t){return(await Promise.all(e.map(async e=>{let i=e.id;if(delete e.props.index,!e.props.xywh)return console.error(`EdgelessText block(id: ${i}) does not have xywh property`),null;let s=await this.onBlockSnapshotPaste(e,this.doc,this.edgeless.surface.model.id);return s?(t.set(i,s),s):(console.error(`Failed to paste EdgelessText block(id: ${i})`),null)}))).filter(e=>null!==e)}_createFigmaEmbedBlocks(e){return e.map(({props:e})=>{let{xywh:t,style:i,url:s,caption:o,title:r,description:a}=e;return this.host.service.addBlock("affine:embed-figma",{xywh:t,style:i,url:s,caption:o,title:r,description:a},this.surface.model.id)})}_createFrameBlocks(e){return e.map(({props:e})=>{let{xywh:t,title:i,background:s}=e;return this.host.service.addBlock("affine:frame",{xywh:t,background:s,title:(0,f.rS)(i)},this.surface.model.id)})}_createGithubEmbedBlocks(e){return e.map(({props:e})=>{let{xywh:t,style:i,owner:s,repo:o,githubType:r,githubId:a,url:n,caption:l,image:c,status:d,statusReason:h,title:u,description:p,createdAt:f,assignees:g}=e;return this.host.service.addBlock("affine:embed-github",{xywh:t,style:i,owner:s,repo:o,githubType:r,githubId:a,url:n,caption:l,image:c,status:d,statusReason:h,title:u,description:p,createdAt:f,assignees:g},this.surface.model.id)})}_createHtmlEmbedBlocks(e){return e.map(({props:e})=>{let{xywh:t,style:i,caption:s,html:o,design:r}=e;return this.host.service.addBlock("affine:embed-html",{xywh:t,style:i,caption:s,html:o,design:r},this.surface.model.id)})}async _createImageBlocks(e,t){let i=[];for(let{props:s,id:o}of e){let{xywh:e,rotate:r,sourceId:a,size:n,width:l,height:c,caption:d}=s;if(!await this.host.std.collection.blobSync.get(a))continue;let h=this.host.service.addBlock("affine:image",{caption:d,sourceId:a,xywh:e,rotate:r,size:n,width:l,height:c},this.surface.model.id);o&&t.set(o,h),i.push(h)}return i}_createLinkedDocEmbedBlocks(e){return e.map(({props:e})=>{let{xywh:t,style:i,caption:s,pageId:o}=e;return this.host.service.addBlock("affine:embed-linked-doc",{xywh:t,style:i,caption:s,pageId:o},this.surface.model.id)})}_createLoomEmbedBlocks(e){return e.map(({props:e})=>{let{xywh:t,style:i,url:s,caption:o,videoId:r,image:a,title:n,description:l}=e;return this.host.service.addBlock("affine:embed-loom",{xywh:t,style:i,url:s,caption:o,videoId:r,image:a,title:n,description:l},this.surface.model.id)})}async _createNoteBlocks(e,t){return(await Promise.all(e.map(async e=>{let i=e.id;if(delete e.props.index,!e.props.xywh)return console.error(`Note block(id: ${i}) does not have xywh property`),null;let s=await this.onBlockSnapshotPaste(e,this.doc,this.doc.root.id);return s?(t.set(i,s),s):(console.error(`Failed to paste note block(id: ${i})`),null)}))).filter(e=>null!==e)}_createSyncedDocEmbedBlocks(e){return e.map(({props:e})=>{let{xywh:t,style:i,caption:s,scale:o,pageId:r}=e;return this.host.service.addBlock("affine:embed-synced-doc",{xywh:t,style:i,caption:s,scale:o,pageId:r},this.surface.model.id)})}_createYoutubeEmbedBlocks(e){return e.map(({props:e})=>{let{xywh:t,style:i,url:s,caption:o,videoId:r,image:a,title:n,description:l,creator:c,creatorUrl:d,creatorImage:h}=e;return this.host.service.addBlock("affine:embed-youtube",{xywh:t,style:i,url:s,caption:o,videoId:r,image:a,title:n,description:l,creator:c,creatorUrl:d,creatorImage:h},this.surface.model.id)})}async _edgelessToCanvas(e,t,s,o=[],{background:r,padding:a=5,dpr:n=window.devicePixelRatio||1}={}){let l=e.host;if(!this.doc.root)return;let c=(await i.e(421).then(i.t.bind(i,72052,19))).default;if(!(c instanceof Function))return;let d=location.pathname,h=(0,of.zU)(l),u=(0,of.$n)(l);if((0,H.Z1)(u),!u.querySelector(".affine-block-children-container"))return;let f=document.createElement("canvas");f.width=(t.w+2*a)*n,f.height=(t.h+2*a)*n;let g=f.getContext("2d");if(!g)return;r&&(g.fillStyle=r,g.fillRect(0,0,f.width,f.height)),g.scale(n,n);let m=this._exportManager.replaceImgSrcWithSvg,v=this._replaceRichTextWithSvgElement.bind(this),y=l.std.clipboard.configs.get("imageProxy"),b={ignoreElements:function(e){return!!(eh.PT.includes(e.tagName)||e.classList.contains("dg"))},onclone:async function(e,t){t.style.setProperty("transform","none");let i=e.querySelector(".affine-edgeless-layer");i&&i instanceof HTMLElement&&i.style.setProperty("transform","none"),e.querySelectorAll("[style*='box-shadow']").forEach(function(e){e instanceof HTMLElement&&e.style.setProperty("box-shadow","none")}),await m(t),await v(t)},backgroundColor:"transparent",useCORS:!y,proxy:y},w=async(e,i=!1)=>{let s=of.Au(e,this.std.view)?.parentElement,o=e.flavour.replace("affine:",".edgeless-block-portal-");if(!(s=s?.closest(o)))throw Error("Could not find edgeless block portal.");let r=p.z.deserialize(e.xywh),n=await c(s,b);g.drawImage(n,r.x-t.x+a,r.y-t.y+a,r.w,i?r.w/n.width*n.height:r.h)};for(let i of s??e.service.pickElementsByBound(t,"blocks")){if(await w(i),(0,O.op)(i,["affine:frame"])){let e=[];this.edgeless.service.frame.getElementsInFrame(i,!1).forEach(t=>{(0,tE.Te)(t)?e.push(t):o.push(t)});for(let t=0;t(0,tE.Te)(this.doc.getBlockById(e)))];this.selectionManager.set({editing:!1,elements:i})}get _exportManager(){return this._rootService.exportManager}async _pasteShapesAndBlocks(e){let{canvasElements:t,blockModels:i}=await this.createElementsFromClipboardData(e);this._emitSelectionChangeAfterPaste(t.map(e=>e.id),i.map(e=>e.id))}async _pasteTextContentAsNote(e){let t=this.host,{lastMousePos:i}=this.toolManager,[s,o]=t.service.viewport.toModelCoord(i.x,i.y),r={xywh:new p.z(s,o,448,72).serialize()},a=t.service.addBlock("affine:note",r,this.doc.root.id);if(t.service.telemetryService?.track("CanvasElementAdded",{control:"canvas:paste",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"note"}),"string"==typeof e)(0,fw.I9)(e).forEach((e,i)=>{t.service.addBlock("affine:paragraph",{text:new f.rl.Y.Text(e)},a,i)});else for(let t=0;t{let t=this._elementToSvgElement(e.cloneNode(!0),e.clientWidth,e.clientHeight+1);e.parentElement?.append(t),e.remove()}))}get _rootService(){return this.std.spec.getService("affine:page")}_updatePastedElementsIndex(e,t){let i=this.edgeless.service.layer.createIndexGenerator(!0);e.sort(function(e,i){if(e instanceof ty.$b&&e.hasDescendant(i))return fx.xB.BEFORE;if(i instanceof ty.$b&&i.hasDescendant(e))return fx.xB.AFTER;{let s=e.groups,o=i.groups,r=1,a=(0,sk.E7)(s,r),n=(0,sk.E7)(o,r);for(;a===n&&a;)++r,a=(0,sk.E7)(s,r),n=(0,sk.E7)(o,r);return a=a??e,n=n??i,t.get(a.id)===t.get(n.id)?fx.xB.SAME:t.get(a.id){let t=i((0,tE.Te)(e)?e.flavour:e.type);this.edgeless.service.updateElement(e.id,{index:t})})}get doc(){return this.host.doc}get edgeless(){return this.surface.edgeless}get selectionManager(){return this.host.service.selection}get std(){return this.host.std}get surface(){return this.host.surface}get toolManager(){return this.host.tools}copy(){document.dispatchEvent(new Event("copy",{bubbles:!0,cancelable:!0}))}async copyAsPng(e,t){if(e.length+t.length===0)return;let i=await this.toCanvas(e,t);if((0,H.Z1)(i),window.apis?.clipboard?.copyAsImageFromString)await window.apis.clipboard?.copyAsImageFromString(i.toDataURL(fC));else{let e=await new Promise((e,t)=>i.toBlob(i=>i?e(i):t("Canvas can not export blob"),fC));(0,H.Z1)(e),this.std.clipboard.writeToClipboard(t=>({...t,[fC]:e})).catch(console.error)}}async createElementsFromClipboardData(e,t){let i=new Map,s=[],o=[];e.forEach(e=>{let{data:t}=f.T1.safeParse(e);if(t){let e=t.props;i.set(t.id,e.index),s.push(t)}else i.set(e.id,e.index),o.push(e)});let r=new Map,a=[];for(let e of this._blockConfigs){let t=s.filter(t=>t.flavour===e.flavour),i=await e.createFunction(t,r);a.push(...i)}let n=a.flatMap(e=>this.host.doc.getBlock(e)?.model??[]),l=this._createCanvasElements(o,r),c=[...n,...l],{lastMousePos:d}=this.toolManager,[h,u]=t=t??this.host.service.viewport.toModelCoord(d.x,d.y),g=tS(c),m=h-g.w/2,y=u-g.h/2;return n.forEach(e=>{let t=p.z.deserialize(e.xywh);t.x+=m-g.x,t.y+=y-g.y,this.edgeless.service.updateElement(e.id,{xywh:t.serialize()})}),l.forEach(e=>{let t=new p.z(m+e.x-g.x,y+e.y-g.y,e.w,e.h);e instanceof v.lw?e.moveTo(t):this.host.service.updateElement(e.id,{xywh:t.serialize()})}),i.forEach((e,t)=>{let s=r.get(t);s&&i.set(s,e)}),this._updatePastedElementsIndex(c,i),{canvasElements:l,blockModels:n}}hostConnected(){this._disposables.disposed&&(this._disposables=new eg.K),this._init(),this._initEdgelessClipboard()}registerBlock(e,t){this._blockConfigs.push({flavour:e,createFunction:t.bind(this)})}async toCanvas(e,t,i){e.sort(fx.UD),t.sort(fx.UD);let s=[];e.forEach(e=>{s.push(p.z.deserialize(e.xywh))}),t.forEach(e=>{s.push((0,v.e0)(e.elementBound))});let o=(0,p7.ql)(s);return(0,H.Z1)(o,"bound not exist"),await this._edgelessToCanvas(this.host,o,e,t,i)}}async function fE(e,t){let i=new f._O({collection:t.collection}),s=await Promise.all(e.map(async t=>{let s=await (0,tM.Nt)(t,e,i);if(s)return((0,tE.BG)(t)||(0,tE.TW)(t))&&await i.assetsManager.readFromBlob(s.props.sourceId),s})),o=await e8(i.assetsManager.getAssets());return{snapshot:s.filter(e=>!!e),blobs:o}}class fI extends iy{constructor(){super(...arguments),this._draggingElement=null,this._draggingElementId=null,this._draggingPathPoints=null,this._draggingPathPressures=null,this._lastPoint=null,this._lastPopLength=0,this._pressureSupportedPointerIds=new Set,this._straightLineType=null,this.tool={type:"brush"}}static{this.BRUSH_POP_GAP=20}_getStraightLineType(e){let t=this._lastPoint;if(!t)return null;let i=e[0]-t[0],s=Math.abs(Math.atan2(e[1]-t[1],i));return sMath.PI/4*3?"horizontal":"vertical"}_tryGetPressurePoints(e){(0,H.Z1)(this._draggingPathPressures);let t=[...this._draggingPathPressures,e.pressure];this._draggingPathPressures=t;let i=e.raw.pointerId;t.some(e=>e!==t[0])&&this._pressureSupportedPointerIds.add(i),(0,H.Z1)(this._draggingPathPoints);let s=this._draggingPathPoints;return this._pressureSupportedPointerIds.has(i)?s.map(([e,i],s)=>[e,i,t[s]]):s}afterModeSwitch(){(0,td.lQ)()}beforeModeSwitch(){(0,td.lQ)()}onContainerClick(){(0,td.lQ)()}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(){(0,td.lQ)()}onContainerDragEnd(){if(this._draggingElement){let{_draggingElement:e}=this;this._doc.withoutTransact(()=>{e.pop("points"),e.pop("xywh")})}this._draggingElement=null,this._draggingElementId=null,this._draggingPathPoints=null,this._draggingPathPressures=null,this._lastPoint=null,this._straightLineType=null,this._doc.captureSync()}onContainerDragMove(e){if(!this._draggingElementId)return;(0,H.Z1)(this._draggingElementId),(0,H.Z1)(this._draggingPathPoints);let t=e.point.x,i=e.point.y;e.keys.shift||this._edgeless.tools.shiftKey?(this._straightLineType||(this._straightLineType=this._getStraightLineType([t,i])),"horizontal"===this._straightLineType?i=this._lastPoint?.[1]??i:"vertical"===this._straightLineType&&(t=this._lastPoint?.[0]??t)):this._straightLineType&&(this._straightLineType=null);let[s,o]=this._service.viewport.toModelCoord(t,i),r=[...this._draggingPathPoints,[s,o]];this._lastPoint=[t,i],this._draggingPathPoints=r,this._edgeless.service.updateElement(this._draggingElementId,{points:this._tryGetPressurePoints(e)}),this._lastPopLength+fI.BRUSH_POP_GAP{this._draggingElement.pop("points"),this._draggingElement.pop("xywh")}),this._draggingElement.stash("points"),this._draggingElement.stash("xywh"))}onContainerDragStart(e){this._doc.captureSync();let{viewport:t}=this._edgeless.service,[i,s]=t.toModelCoord(e.point.x,e.point.y),o=[[i,s]],r=this._service.addElement(v.J9.BRUSH,{points:o});this._service.telemetryService?.track("CanvasElementAdded",{control:"canvas:draw",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:v.J9.BRUSH});let a=this._service.getElementById(r);a.stash("points"),a.stash("xywh"),this._lastPoint=[e.point.x,e.point.y],this._draggingElementId=r,this._draggingElement=a,this._draggingPathPoints=o,this._draggingPathPressures=[e.pressure],this._lastPopLength=0}onContainerMouseMove(){(0,td.lQ)()}onContainerMouseOut(){(0,td.lQ)()}onContainerPointerDown(){(0,td.lQ)()}onContainerTripleClick(){(0,td.lQ)()}onPressShiftKey(e){(0,td.lQ)()}onPressSpaceBar(e){(0,td.lQ)()}}!function(e){e[e.Dragging=0]="Dragging",e[e.Quick=1]="Quick"}(l||(l={}));class fB extends iy{constructor(){super(...arguments),this._allowCancel=!1,this._connector=null,this._mode=l.Dragging,this._source=null,this._sourceBounds=null,this._sourceLocations=tC.Zv,this._startPoint=null,this.tool={type:"connector"}}_createConnector(){if(!(this._source&&this._startPoint)){this._source=null,this._startPoint=null;return}this._doc.captureSync();let e=this._edgeless.service.addElement(v.J9.CONNECTOR,{mode:this.tool.mode,controllers:[],source:this._source,target:{position:this._startPoint}});this._edgeless.service.telemetryService?.track("CanvasElementAdded",{control:"canvas:draw",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:v.J9.CONNECTOR});let t=this._edgeless.service.getElementById(e);if(!t){this._source=null,this._startPoint=null;return}this._connector=t}afterModeSwitch(){(0,td.lQ)()}beforeModeSwitch(e){if("connector"===e.type)return;let t=this._connector?.id;this._allowCancel&&t&&this._edgeless.service.removeElement(t),this._surface.overlays.connector.clear(),this._mode=l.Dragging,this._connector=null,this._source=null,this._sourceBounds=null,this._startPoint=null,this._allowCancel=!1}findTargetByPoint(e){if(!this._connector)return;let{_connector:t,_edgeless:i,_surface:{overlays:s},_service:{viewport:o}}=this;e=o.toModelCoord(e[0],e[1]);let r=[];t.source?.id&&r.push(t.source.id);let a=s.connector.renderConnector(e,r);i.service.updateElement(t.id,{target:a})}onContainerClick(){if(this._mode===l.Dragging||!this._connector)return;let{id:e,source:t,target:i}=this._connector,s=e;t?.id&&!i?.id&&(s=t.id,this._allowCancel=!0),this._edgeless.tools.switchToDefaultMode({elements:[s],editing:!1})}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(){(0,td.lQ)()}onContainerDragEnd(){this._mode!==l.Quick&&this._connector&&(this._doc.captureSync(),this._edgeless.tools.switchToDefaultMode({elements:[this._connector.id],editing:!1}))}onContainerDragMove(e){this.findTargetByPoint([e.x,e.y])}onContainerDragStart(){this._mode!==l.Quick&&this._createConnector()}onContainerMouseMove(e){if(this._mode===l.Dragging||!this._sourceBounds||!this._connector)return;let t=this._connector.source?.id;if(!t)return;let i=this._service.viewport.toModelCoord(e.x,e.y),s=this._surface.overlays.connector.renderConnector(i,[t]);this._allowCancel=!s.id,this._connector.source.position=(0,tC.ML)(i,this._sourceBounds,this._sourceLocations),this._edgeless.service.updateElement(this._connector.id,{target:s,source:this._connector.source})}onContainerMouseOut(){(0,td.lQ)()}onContainerPointerDown(e){this._startPoint=this._service.viewport.toModelCoord(e.x,e.y),this._source=this._surface.overlays.connector.renderConnector(this._startPoint)}onContainerTripleClick(){(0,td.lQ)()}onPressShiftKey(e){(0,td.lQ)()}onPressSpaceBar(e){(0,td.lQ)()}quickConnect(e,t){this._startPoint=this._service.viewport.toModelCoord(e[0],e[1]),this._mode=l.Quick,this._sourceBounds=p.z.deserialize(t.xywh),this._sourceBounds.rotate=t.rotate,this._sourceLocations=t instanceof v.B5&&t.shapeType===v.IO.Triangle?tC.SP:tC.Zv,this._source={id:t.id,position:(0,tC.ML)(this._startPoint,this._sourceBounds,this._sourceLocations)},this._allowCancel=!0,this._createConnector(),t instanceof v.$f&&(this._surface.overlays.connector.sourceBounds=this._sourceBounds),this.findTargetByPoint(e)}}class f$ extends iy{constructor(){super(...arguments),this._dragging=!1,this.dragLastPoint=[0,0],this.dragStartPoint=[0,0],this.draggingAreaUpdated=new f.DX,this.tool={type:"copilot"}}_initDragState(e){this.dragStartPoint=this._service.viewport.toModelCoord(e.x,e.y),this.dragLastPoint=this.dragStartPoint}abort(){this._dragging=!1,this.dragStartPoint=[0,0],this.dragLastPoint=[0,0],this._edgeless.tools.setEdgelessTool({type:"default"})}afterModeSwitch(){}beforeModeSwitch(e){this._service.locked=e?.type==="copilot"}onContainerClick(){}onContainerContextMenu(){}onContainerDblClick(){}onContainerDragEnd(){this._dragging&&(this._dragging=!1,this.draggingAreaUpdated.emit(!0))}onContainerDragMove(e){if(!this._dragging)return;this.dragLastPoint=this._service.viewport.toModelCoord(e.x,e.y);let t=this.area,i=new p.z(t.x,t.y,t.width,t.height);if(t.width&t.height){let e=new Set(this._service.pickElementsByBound(i));this.selection.set({elements:Array.from(e).map(e=>e.id),editing:!1,inoperable:!0})}this.draggingAreaUpdated.emit()}onContainerDragStart(e){this.processing||(this._initDragState(e),this._dragging=!0,this.draggingAreaUpdated.emit())}onContainerMouseMove(){}onContainerMouseOut(){}onContainerPointerDown(e){if(this.processing){e.raw.stopPropagation();return}this._edgeless.tools.setEdgelessTool({type:"default"})}onContainerTripleClick(){}onPressShiftKey(){}onPressSpaceBar(){}updateDragPointsWith(e,t=0){let i=(0,v.qZ)(e.map(e=>e.elementBound)).expand(t/this._edgeless.service.zoom);this.dragStartPoint=i.tl,this.dragLastPoint=i.br}updateSelectionWith(e,t=0){let{selection:i}=this._edgeless.service;i.clear(),this.updateDragPointsWith(e,t),i.set({elements:e.map(e=>e.id),editing:!1,inoperable:!0}),this.draggingAreaUpdated.emit(!0)}get area(){let e=new DOMPoint(this.dragStartPoint[0],this.dragStartPoint[1]),t=new DOMPoint(this.dragLastPoint[0],this.dragLastPoint[1]),i=Math.min(e.x,t.x),s=Math.min(e.y,t.y);return new DOMRect(i,s,Math.max(e.x,t.x)-i,Math.max(e.y,t.y)-s)}get processing(){let e=this._edgeless.host.view.getWidget(nU,this._edgeless.doc.root.id);return e&&"hidden"!==e.state}get selectedElements(){return this.selection.selectedElements}get selection(){return this._edgeless.service.selection}}class fT extends v.hJ{constructor(){super(...arguments),this.d=""}render(e){e.globalAlpha=.33;let t=new Path2D(this.d);e.fillStyle="#aaa",e.fill(t)}}class fO extends iy{constructor(){super(...arguments),this._erasables=new Set,this._eraseTargets=new Set,this._eraserPoints=[],this._loop=()=>{let e=Date.now(),t=e-this._timestamp,i=!1;if(this._prevEraserPoint!==this._prevPoint&&(i=!0,this._eraserPoints.push(this._prevPoint),this._prevEraserPoint=this._prevPoint),t>32&&this._eraserPoints.length>1&&(i=!0,this._eraserPoints.splice(0,Math.ceil(.1*this._eraserPoints.length)),this._timestamp=e),i){let e=this._service.viewport.zoom,t=(0,v.op)((0,v.$4)(this._eraserPoints,{size:16/e,start:{taper:!0}}));this._overlay.d=t,this._edgeless.surface.refresh()}this._timer=requestAnimationFrame(this._loop)},this._overlay=new fT,this._prevEraserPoint=[0,0],this._prevPoint=[0,0],this._timer=0,this._timestamp=0,this.tool={type:"eraser"}}_reset(){cancelAnimationFrame(this._timer),this._edgeless.surface.renderer.removeOverlay(this._overlay),this._erasables.clear(),this._eraseTargets.clear()}toModelCoord(e){return this._service.viewport.toModelCoord(e.x,e.y)}afterModeSwitch(e){(0,td.lQ)()}beforeModeSwitch(){this._eraseTargets.forEach(e=>{if((0,tE.Te)(e)){let t=this._edgeless.host.view.viewFromPath("block",(0,O.UL)(e));t&&(t.style.opacity="1")}else e.opacity=1}),this._reset()}onContainerClick(){(0,td.lQ)()}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(){(0,td.lQ)()}onContainerDragEnd(){t8(this._surface,Array.from(this._eraseTargets)),this._reset(),this._doc.captureSync()}onContainerDragMove(e){let t=this.toModelCoord(e.point);this._erasables.forEach(e=>{if(!this._eraseTargets.has(e)){if((0,tE.Te)(e)){let i=p.z.deserialize(e.xywh);if((0,v.Dx)(this._prevPoint,t,i.points)){this._eraseTargets.add(e);let t=this._edgeless.host.view.viewFromPath("block",(0,O.UL)(e));t&&(t.style.opacity="0.3")}}else e.getLineIntersections(this._prevPoint,t)&&(this._eraseTargets.add(e),e.opacity=.3)}}),this._prevPoint=t}onContainerDragStart(e){this._doc.captureSync();let{point:t}=e,[i,s]=this.toModelCoord(t);this._eraserPoints=[[i,s]],this._prevPoint=[i,s],this._erasables=new Set([...this._service.elements,...this._service.blocks]),this._loop(),this._edgeless.surface.renderer.addOverlay(this._overlay)}onContainerMouseMove(){(0,td.lQ)()}onContainerMouseOut(){(0,td.lQ)()}onContainerPointerDown(){(0,td.lQ)()}onContainerTripleClick(){(0,td.lQ)()}onPressShiftKey(e){(0,td.lQ)()}onPressSpaceBar(e){(0,td.lQ)()}}class fP extends iy{constructor(){super(...arguments),this.tool={type:"frameNavigator"}}afterModeSwitch(){(0,td.lQ)()}beforeModeSwitch(){(0,td.lQ)()}onContainerClick(){(0,td.lQ)()}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(){(0,td.lQ)()}onContainerDragEnd(){(0,td.lQ)()}onContainerDragMove(){(0,td.lQ)()}onContainerDragStart(){(0,td.lQ)()}onContainerMouseMove(){(0,td.lQ)()}onContainerMouseOut(){(0,td.lQ)()}onContainerPointerDown(){(0,td.lQ)()}onContainerTripleClick(){(0,td.lQ)()}onPressShiftKey(){(0,td.lQ)()}onPressSpaceBar(e){(0,td.lQ)()}}class fH extends iy{constructor(){super(...arguments),this._frame=null,this._startPoint=null,this.tool={type:"frame"}}_toModelCoord(e){return this._service.viewport.toModelCoord(e.x,e.y)}afterModeSwitch(){(0,td.lQ)()}beforeModeSwitch(){(0,td.lQ)()}onContainerClick(){(0,td.lQ)()}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(){(0,td.lQ)()}onContainerDragEnd(){if(this._frame){let e=this._frame;this._doc.transact(()=>{e.pop("xywh")}),this._edgeless.tools.setEdgelessTool({type:"default"}),this._edgeless.service.selection.set({elements:[this._frame.id],editing:!1}),this._doc.captureSync()}this._frame=null,this._startPoint=null}onContainerDragMove(e){let t=this._toModelCoord(e.point);if((0,H.Z1)(this._startPoint),!(8>tm.l.dist(this._startPoint,t))||this._frame){if(!this._frame){let e=this._service.frames,i=this._service.addBlock("affine:frame",{title:new f.rl.Y.Text(`Frame ${e.length+1}`),xywh:p.z.fromPoints([this._startPoint,t]).serialize()},this._service.surface);this._service.telemetryService?.track("CanvasElementAdded",{control:"canvas:draw",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"frame"}),this._frame=this._service.getElementById(i),this._frame.stash("xywh");return}(0,H.Z1)(this._frame),this._service.updateElement(this._frame.id,{xywh:p.z.fromPoints([this._startPoint,t]).serialize()})}}onContainerDragStart(e){this._doc.captureSync();let{point:t}=e;this._startPoint=this._toModelCoord(t)}onContainerMouseMove(){(0,td.lQ)()}onContainerMouseOut(){(0,td.lQ)()}onContainerPointerDown(){(0,td.lQ)()}onContainerTripleClick(){(0,td.lQ)()}onPressShiftKey(){(0,td.lQ)()}onPressSpaceBar(e){(0,td.lQ)()}}class fA extends v.hJ{constructor(){super(...arguments),this.d="",this.startPoint=null}render(e){let t=new Path2D(this.d),i=this._renderer?.viewport.zoom??1;e.save();let s=j.Q.getPropertyValue("--affine-primary-color"),o=j.Q.getPropertyValue("--affine-secondary-color");if(this.startPoint){let[t,o]=this.startPoint;e.beginPath(),e.arc(t,o,2/i,0,2*Math.PI),e.fillStyle=s,e.fill()}e.strokeStyle=o,e.fillStyle="rgba(255, 255, 255, 0.1)",e.lineWidth=2/i,e.lineJoin="round",e.lineCap="round",e.setLineDash([2,5]),e.fill(t),e.stroke(t),e.restore()}}class fL extends iy{constructor(){super(...arguments),this._currentSelectionState=new Set,this._isSelecting=!1,this._lassoPoints=[],this._lastPoint=[0,0],this._loop=()=>{let e=this.tool.mode===e$.yN.FreeHand?(0,v.op)(this._lassoPoints):(0,tk.hr)(this._lassoPoints);this._overlay.d=e,this._surface.refresh(),this._raf=requestAnimationFrame(this._loop)},this._overlay=new fA,this._raf=0,this.tool={type:"lasso"}}_clearLastSelection(){this.selection.empty&&this.selection.clearLast()}_getElementsInsideLasso(){let e=(0,v.O3)(this._lassoPoints);return this._service.pickElementsByBound(e).filter(e=>this.isInsideLassoSelection(p.z.deserialize(e.xywh),e.rotate))}_getSelectionMode(e){let t=e.keys.shift??this._edgeless.tools.shiftKey,i=e.keys.alt??!1;return t?"add":i?"sub":"set"}_reset(){cancelAnimationFrame(this._raf),this._edgeless.surface.renderer.removeOverlay(this._overlay),this._overlay.d="",this._overlay.startPoint=null;let e=this._getElementsInsideLasso();this._currentSelectionState=new Set([...Array.from(this._currentSelectionState),...e.map(e=>e.id)]),this._lassoPoints=[],this._isSelecting=!1}_setSelectionState(e,t){this.selection.set({elements:e,editing:t})}_updateSelection(e){let t;let i=this._getElementsInsideLasso().map(e=>e.id),s=this.selection.selectedElements.map(e=>e.id);switch(this._getSelectionMode(e)){case"add":t=new Set([...i,...s.filter(e=>this._currentSelectionState.has(e))]);break;case"sub":{let e=new Set(i);t=new Set(Array.from(this._currentSelectionState).filter(t=>!e.has(t)));break}case"set":t=new Set(i)}this._setSelectionState(Array.from(t),!1)}isInsideLassoSelection(e,t){let{points:i,center:s}=e,o=this._lassoPoints[0],r=this._lassoPoints.concat(o?[o]:[]),a=(0,tk.Hb)(i,s,t),n=r.length;return a.some(e=>(0,tk.s3)(e,r))||r.some((e,t,i)=>(0,tk.Dx)(e,i[(t+1)%n],a))}toModelCoord(e){return this._service.viewport.toModelCoord(e.x,e.y)}abort(){this._reset()}afterModeSwitch(e){e?.type==="lasso"&&(this._currentSelectionState=new Set(this.selection.selectedElements.map(e=>e.id))),this._reset()}beforeModeSwitch(e){e?.type==="pan"&&this._clearLastSelection()}onContainerClick(){}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(){(0,td.lQ)()}onContainerDragEnd(e){this.tool.mode===e$.yN.FreeHand&&(this._updateSelection(e),this._reset())}onContainerDragMove(e){if(this.tool.mode!==e$.yN.FreeHand)return;let{point:t}=e,[i,s]=this.toModelCoord(t);this._lassoPoints.push([i,s]),this._updateSelection(e)}onContainerDragStart(e){if(this.tool.mode!==e$.yN.FreeHand)return;let{alt:t,shift:i}=e.keys;i||t||(this._currentSelectionState.clear(),this.selection.clear()),this._currentSelectionState=new Set(this.selection.selectedElements.map(e=>e.id)),this._isSelecting=!0;let{point:s}=e,[o,r]=this.toModelCoord(s);this._lassoPoints=[[o,r]],this._raf=requestAnimationFrame(this._loop),this._overlay.startPoint=this._lassoPoints[0],this._surface.renderer.addOverlay(this._overlay)}onContainerMouseMove(e){if(this.tool.mode!==e$.yN.Polygonal||!this._isSelecting)return;let t=this._lastPoint,[i,s]=this.toModelCoord(e.point);t&&(t[0]=i,t[1]=s),this._updateSelection(e)}onContainerMouseOut(){(0,td.lQ)()}onContainerPointerDown(e){let{mode:t}=this.tool;if(t!==e$.yN.Polygonal)return;let{alt:i,shift:s}=e.keys;s||i||(this._currentSelectionState.clear(),this.selection.clear()),this._isSelecting=!0;let{point:o}=e,[r,a]=this.toModelCoord(o);if(this._lassoPoints.length<2){this._currentSelectionState=new Set(this.selection.selectedElements.map(e=>e.id));let e=[r,a],t=[r,a];this._lassoPoints=[e,t],this._lastPoint=t,this._overlay.startPoint=e,this._raf=requestAnimationFrame(this._loop),this._surface.renderer.addOverlay(this._overlay)}else{let t=this._lassoPoints[0],i=this._lastPoint,s=i[0]-t[0],o=i[1]-t[1];if(400>tm.l.len2([s,o]))return this._updateSelection(e),this._reset();this._lastPoint=[r,a],this._lassoPoints.push(this._lastPoint)}}onContainerTripleClick(){(0,td.lQ)()}onPressShiftKey(){(0,td.lQ)()}onPressSpaceBar(){(0,td.lQ)()}get isSelecting(){return this._isSelecting}get selection(){return this._edgeless.service.selection}}class fD extends iy{constructor(){super(...arguments),this.tool={type:"mindmap"}}afterModeSwitch(){(0,td.lQ)()}beforeModeSwitch(){(0,td.lQ)()}onContainerClick(){(0,td.lQ)()}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(){(0,td.lQ)()}onContainerDragEnd(){(0,td.lQ)()}onContainerDragMove(){(0,td.lQ)()}onContainerDragStart(){(0,td.lQ)()}onContainerMouseMove(){(0,td.lQ)()}onContainerMouseOut(){(0,td.lQ)()}onContainerPointerDown(){(0,td.lQ)()}onContainerTripleClick(){(0,td.lQ)()}onPressShiftKey(){(0,td.lQ)()}onPressSpaceBar(e){(0,td.lQ)()}}function fZ(e,t,i,s=448,o=72){let r=e.addNoteWithPoint(t,{width:s,height:o}),a=e.doc,n=a.addBlock(i.childFlavour,{type:i.childType},r);if(i.collapse&&o>78){let e=a.getBlockById(r);a.updateBlock(e,()=>{e.edgeless.collapse=!0,e.edgeless.collapsedHeight=o})}e.tools.setEdgelessTool({type:"default"}),requestAnimationFrame(()=>{let i=(a.root?.children.filter(e=>"affine:note"===e.flavour)??[]).find(e=>e.id===r);i&&(e.service.selection.set({elements:[i.id],editing:!0}),e.updateComplete.then(()=>{n?O.Km(e.host,n)?.catch(console.error):(0,O.kW)(t.x,t.y)}).catch(console.error))})}class fj extends iy{constructor(){super(...arguments),this._draggingArea=null,this._draggingNoteOverlay=null,this._noteOverlay=null,this.tool={type:"affine:note",childFlavour:"affine:paragraph",childType:"text",tip:"Text"}}_clearOverlay(){this._noteOverlay=this._disposeOverlay(this._noteOverlay),this._draggingNoteOverlay=this._disposeOverlay(this._draggingNoteOverlay),this._edgeless.surface.refresh()}_disposeOverlay(e){return e&&(e.dispose(),this._edgeless.surface.renderer.removeOverlay(e)),null}_hideOverlay(){this._noteOverlay&&(this._noteOverlay.globalAlpha=0,this._edgeless.surface.refresh())}_resize(e=!1){let{_draggingArea:t,_draggingNoteOverlay:i,_edgeless:s}=this;if(!t||!i)return;let{viewport:o}=s.service,{zoom:r}=o,{start:{x:a,y:n},end:l}=t,{x:c,y:d}=l;if(e){let e=Math.max(Math.abs(c-a),Math.abs(d-n));c=a+(c>a?e:-e),d=n+(d>n?e:-e)}let[h,u]=o.toModelCoord(Math.min(a,c),Math.min(n,d)),p=Math.abs(a-c)/r,f=Math.abs(n-d)/r;i.slots.draggingNoteUpdated.emit({xywh:[h,u,p,f]})}_updateOverlayPosition(e,t){this._noteOverlay&&(this._noteOverlay.x=e,this._noteOverlay.y=t,this._edgeless.surface.refresh())}afterModeSwitch(e){if("affine:note"!==e.type)return;let t=this._edgeless.service.editPropsStore.getLastProps("affine:note").background;this._noteOverlay=new hR(this._edgeless,t),this._noteOverlay.text=e.tip,this._edgeless.surface.renderer.addOverlay(this._noteOverlay)}beforeModeSwitch(){this._clearOverlay()}onContainerClick(e){this._clearOverlay();let{childFlavour:t,childType:i}=this.tool,s=new u.b(e.point.x,e.point.y);fZ(this._edgeless,s,{childFlavour:t,childType:i,collapse:!1})}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(){(0,td.lQ)()}onContainerDragEnd(){if(!this._draggingNoteOverlay)return;this._draggingArea=null;let{x:e,y:t,width:i,height:s}=this._draggingNoteOverlay;this._disposeOverlay(this._draggingNoteOverlay);let{childFlavour:o,childType:r}=this.tool,[a,n]=this._edgeless.service.viewport.toViewCoord(e,t),l=new u.b(a,n);this._doc.captureSync(),fZ(this._edgeless,l,{childFlavour:o,childType:r,collapse:!0},Math.max(i,498),Math.max(s,91))}onContainerDragMove(e){this._draggingNoteOverlay&&this._draggingArea&&(this._draggingArea.end=new DOMPoint(e.x,e.y),this._resize(e.keys.shift||this._edgeless.tools.shiftKey))}onContainerDragStart(e){this._clearOverlay();let t=this._edgeless.service.editPropsStore.getLastProps("affine:note").background;this._draggingNoteOverlay=new hF(this._edgeless,t),this._edgeless.surface.renderer.addOverlay(this._draggingNoteOverlay),this._draggingArea={start:new DOMPoint(e.x,e.y),end:new DOMPoint(e.x,e.y)}}onContainerMouseMove(e){if(!this._noteOverlay)return;0===this._noteOverlay.globalAlpha&&(this._noteOverlay.globalAlpha=1);let[t,i]=this._service.viewport.toModelCoord(e.x,e.y);this._updateOverlayPosition(t,i)}onContainerMouseOut(e){e.raw.relatedTarget&&(0,O.Xn)(e.raw.relatedTarget,ia)||this._hideOverlay()}onContainerPointerDown(){(0,td.lQ)()}onContainerTripleClick(){(0,td.lQ)()}onPressShiftKey(e){this._draggingNoteOverlay&&this._resize(e)}onPressSpaceBar(e){(0,td.lQ)()}}class fV extends iy{constructor(){super(...arguments),this._lastPoint=null,this.tool={type:"pan"}}afterModeSwitch(){(0,td.lQ)()}beforeModeSwitch(){(0,td.lQ)()}onContainerClick(){(0,td.lQ)()}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(){(0,td.lQ)()}onContainerDragEnd(){this._lastPoint=null,this._edgeless.tools.setEdgelessTool({type:"pan",panning:!1})}onContainerDragMove(e){if(!this._lastPoint)return;let{viewport:t}=this._service,{zoom:i}=t,[s,o]=this._lastPoint,r=s-e.x,a=o-e.y;this._lastPoint=[e.x,e.y],t.applyDeltaCenter(r/i,a/i)}onContainerDragStart(e){this._lastPoint=[e.x,e.y],this._edgeless.tools.setEdgelessTool({type:"pan",panning:!0})}onContainerMouseMove(){(0,td.lQ)()}onContainerMouseOut(){(0,td.lQ)()}onContainerPointerDown(){(0,td.lQ)()}onContainerTripleClick(){(0,td.lQ)()}onPressShiftKey(e){(0,td.lQ)()}onPressSpaceBar(e){(0,td.lQ)()}}class fz extends iy{constructor(){super(...arguments),this.tool={type:"template"}}afterModeSwitch(){(0,td.lQ)()}beforeModeSwitch(){(0,td.lQ)()}onContainerClick(){(0,td.lQ)()}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(){(0,td.lQ)()}onContainerDragEnd(){(0,td.lQ)()}onContainerDragMove(){(0,td.lQ)()}onContainerDragStart(){(0,td.lQ)()}onContainerMouseMove(){(0,td.lQ)()}onContainerMouseOut(){(0,td.lQ)()}onContainerPointerDown(){(0,td.lQ)()}onContainerTripleClick(){(0,td.lQ)()}onPressShiftKey(e){(0,td.lQ)()}onPressSpaceBar(e){(0,td.lQ)()}}class fR extends iy{constructor(){super(...arguments),this.tool={type:"text"}}afterModeSwitch(){(0,td.lQ)()}beforeModeSwitch(){(0,td.lQ)()}onContainerClick(e){if(this._edgeless.doc.awarenessStore.getFlag("enable_edgeless_text")){let[t,i]=this._service.viewport.toModelCoord(e.x,e.y);this._edgeless.host.spec.getService("affine:edgeless-text").initEdgelessTextBlock({edgeless:this._edgeless,x:t,y:i}),this._service.tool.setEdgelessTool({type:"default"})}else im(this._edgeless,e);this._service.telemetryService?.track("CanvasElementAdded",{control:"canvas:draw",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"text"})}onContainerContextMenu(){(0,td.lQ)()}onContainerDblClick(){(0,td.lQ)()}onContainerDragEnd(){(0,td.lQ)()}onContainerDragMove(){(0,td.lQ)()}onContainerDragStart(){(0,td.lQ)()}onContainerMouseMove(){(0,td.lQ)()}onContainerMouseOut(){(0,td.lQ)()}onContainerPointerDown(){(0,td.lQ)()}onContainerTripleClick(){(0,td.lQ)()}onPressShiftKey(e){(0,td.lQ)()}onPressSpaceBar(e){(0,td.lQ)()}}let fF={[v.IO.Rect]:0,[v.IO.Ellipse]:1,[v.IO.Diamond]:2,[v.IO.Triangle]:3,roundedRect:4},fN=Object.keys(fF);class fq extends iz{constructor(e){super(e),this.rootComponent=e,this.rootComponent.bindHotKey({v:()=>{this._setEdgelessTool(e,{type:"default"})},t:()=>{this._setEdgelessTool(e,{type:"text"})},c:()=>{let t=v.B1.Curve;e.service.editPropsStore.recordLastProps("connector",{mode:t}),this._setEdgelessTool(e,{type:"connector",mode:t})},l:()=>{if(!e.doc.awarenessStore.getFlag("enable_lasso_tool"))return;let t=e.tools.controllers.lasso,i={type:"lasso",mode:e$.yN.Polygonal};t instanceof fL&&(i.mode=t.tool.mode),this._setEdgelessTool(e,i)},"Shift-l":()=>{if(!e.doc.awarenessStore.getFlag("enable_lasso_tool"))return;let t=e.edgelessTool,i={type:"lasso",mode:"lasso"===t.type&&t.mode===e$.yN.FreeHand?e$.yN.Polygonal:e$.yN.FreeHand};this._setEdgelessTool(e,i)},h:()=>{this._setEdgelessTool(e,{type:"pan",panning:!1})},n:()=>{this._setEdgelessTool(e,{type:"affine:note",childFlavour:is,childType:io,tip:ir})},p:()=>{this._setEdgelessTool(e,{type:"brush"})},e:()=>{this._setEdgelessTool(e,{type:"eraser"})},k:()=>{if(this.rootComponent.service.locked)return;let{selection:t}=e.service;1===t.selectedElements.length&&t.firstElement instanceof tc.y&&(0,tf.o)(t.firstElement,["affine:note"])&&e.slots.toggleNoteSlicer.emit()},f:()=>{if(!this.rootComponent.service.locked){if(0===this.rootComponent.service.selection.selectedElements.length||this.rootComponent.service.selection.editing)this.rootComponent.service.selection.editing||this._setEdgelessTool(e,{type:"frame"});else{let t=e.service.frame.createFrameOnSelected();if(!t)return;e.service.telemetryService?.track("CanvasElementAdded",{control:"shortcut",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"frame"}),e.surface.fitToViewport(p.z.deserialize(t.xywh))}}},"-":()=>{if(this.rootComponent.service.locked)return;let{selectedElements:t}=e.service.selection;!e.service.selection.editing&&1===t.length&&(0,tE._h)(t[0])&&e.slots.toggleNoteSlicer.emit()},"@":()=>{let t=this.rootComponent.std;if(t.selection.getGroup("note").length>0||t.selection.find("text")||t.selection.find("surface")?.editing)return;let{insertedLinkType:i}=t.command.exec("insertLinkByQuickSearch");i?.then(t=>{t&&(e.service.telemetryService?.track("CanvasElementAdded",{control:"shortcut",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:t.flavour.split(":")[1]}),t.isNewDoc&&e.service.telemetryService?.track("DocCreated",{control:"shortcut",page:"whiteboard editor",segment:"whiteboard",type:t.flavour.split(":")[1]}))}).catch(console.error)},"Shift-s":()=>{if(this.rootComponent.service.locked||this.rootComponent.service.selection.editing||!(e.tools.currentController instanceof pN))return;let t=e.service.editPropsStore.getLastProps("shape"),i=fN[(fF[t.radius>0&&t.shapeType===v.IO.Rect?"roundedRect":t.shapeType]+1)%fN.length];this._setEdgelessTool(e,{type:"shape",shapeType:"roundedRect"===i?v.IO.Rect:i}),function(e,t){let i="roundedRect"===e?{shapeType:v.IO.Rect,radius:.1}:{shapeType:e,radius:0};t.service.editPropsStore.recordLastProps("shape",i)}(i,e),e.tools.currentController.createOverlay()},"Mod-g":t=>{this.rootComponent.service.locked||!(this.rootComponent.service.selection.selectedElements.length>1)||this.rootComponent.service.selection.editing||(t.get("keyboardState").event.preventDefault(),e.service.createGroupFromSelected())},"Shift-Mod-g":t=>{if(this.rootComponent.service.locked)return;let{selection:i}=this.rootComponent.service;1===i.selectedElements.length&&i.firstElement instanceof v.$f&&(t.get("keyboardState").event.preventDefault(),e.service.ungroup(i.firstElement))},"Mod-a":e=>{if(this.rootComponent.service.locked||this.rootComponent.service.selection.editing)return;e.get("defaultState").event.preventDefault();let{service:t}=this.rootComponent;this.rootComponent.service.selection.set({elements:[...t.blocks.filter(e=>null===e.group).map(e=>e.id),...t.elements.filter(e=>null===e.group).map(e=>e.id)],editing:!1})},"Mod-1":e=>{e.get("defaultState").event.preventDefault(),this.rootComponent.service.setZoomByAction("fit")},"Mod--":e=>{e.get("defaultState").event.preventDefault(),this.rootComponent.service.setZoomByAction("out")},"Mod-0":e=>{e.get("defaultState").event.preventDefault(),this.rootComponent.service.setZoomByAction("reset")},"Mod-=":e=>{e.get("defaultState").event.preventDefault(),this.rootComponent.service.setZoomByAction("in")},Backspace:()=>{this._delete()},Delete:()=>{this._delete()},"Control-d":()=>{ij.vL&&this._delete()},Escape:()=>{let{currentController:t}=this.rootComponent.tools;t instanceof fL&&t.isSelecting&&t.abort(),t instanceof f$&&t.abort(),this.rootComponent.service.selection.empty||e.selection.clear()},ArrowUp:()=>{this._move("ArrowUp")},ArrowDown:()=>{this._move("ArrowDown")},ArrowLeft:()=>{this._move("ArrowLeft")},ArrowRight:()=>{this._move("ArrowRight")},"Shift-ArrowUp":()=>{this._move("ArrowUp",!0)},"Shift-ArrowDown":()=>{this._move("ArrowDown",!0)},"Shift-ArrowLeft":()=>{this._move("ArrowLeft",!0)},"Shift-ArrowRight":()=>{this._move("ArrowRight",!0)},Enter:()=>{let{service:t}=e,i=t.selection,s=i.selectedElements;if(1===s.length){let t=s[0],o=t.id;if(t instanceof v.lw){i.set({elements:[o],editing:!0}),requestAnimationFrame(()=>{iv(t,e)});return}if(t instanceof tu.Q){i.set({elements:[o],editing:!0});let t=e.host.view.getBlock(o);t instanceof ik&&t.tryFocusEnd();return}}if(!t0(s))return;let o=s[0].group,r=o.getNode(s[0].id),a=o.getParentNode(r.id)??r,n=o.addNode(a.id),l=t.getElementById(n);requestAnimationFrame(()=>{if(iu(l,e),t2(t.viewport,l,[20,20])){let{elementBound:e}=l;t.viewport.smoothTranslate(e.x+e.w/2,e.y+e.h/2)}})},Tab:()=>{let{service:t}=e,i=t.selection.selectedElements;if(!t0(i))return;let s=i[0].group,o=s.getNode(i[0].id),r=s.addNode(o.id),a=t.getElementById(r);requestAnimationFrame(()=>{if(iu(a,e),t2(t.viewport,a,[20,20])){let{elementBound:e}=a;t.viewport.smoothTranslate(e.x+e.w/2,e.y+e.h/2)}})}},{global:!0}),this._bindShiftKey(),this._bindToggleHand()}_bindShiftKey(){this.rootComponent.handleEvent("keyDown",e=>{let t=e.get("defaultState").event;t instanceof KeyboardEvent&&this._shift(t)},{global:!0}),this.rootComponent.handleEvent("keyUp",e=>{let t=e.get("defaultState").event;t instanceof KeyboardEvent&&this._shift(t)},{global:!0})}_bindToggleHand(){this.rootComponent.handleEvent("keyDown",e=>{let t=e.get("keyboardState").raw;"Space"!==t.code||t.repeat||this._space(t)},{global:!0}),this.rootComponent.handleEvent("keyUp",e=>{let t=e.get("keyboardState").raw;"Space"!==t.code||t.repeat||this._space(t)},{global:!0})}_delete(){let e=this.rootComponent;if(!e.service.locked){if(e.service.selection.editing)return;t8(e.surface,e.service.selection.selectedElements),e.service.selection.clear(),e.service.selection.set(e.service.selection.surfaceSelections)}}_move(e,t=!1){let i=this.rootComponent;if(i.service.locked||i.service.selection.editing)return;let{selectedElements:s}=i.service.selection,o=t?10:1,r=s.filter(e=>e.group instanceof ut.AR);if(r.length>0){let t=r[0],s=t.group,o=s.getLayoutDir(t.id),a=null;switch(e){case"ArrowUp":case"ArrowDown":a=s.getSiblingNode(t.id,"ArrowDown"===e?"next":"prev",o===tx.p5.RIGHT?"right":o===tx.p5.LEFT?"left":void 0)?.element??null;break;case"ArrowLeft":a=o===tx.p5.RIGHT?s.getParentNode(t.id)?.element??null:s.getChildNodes(t.id,"left")[0]?.element??null;break;case"ArrowRight":a=o===tx.p5.RIGHT||o===tx.p5.BALANCE?s.getChildNodes(t.id,"right")[0]?.element??null:s.getParentNode(t.id)?.element??null}if(a&&(i.service.selection.set({elements:[a.id],editing:!1}),t2(i.service.viewport,a,[90,20]))){let[e,t]=t5(i.service.viewport,a,[100,20]);i.service.viewport.smoothTranslate(i.service.viewport.centerX-e,i.service.viewport.centerY+t)}return}s.forEach(t=>{let i=p.z.deserialize(t.xywh).clone();switch(e){case"ArrowUp":i.y-=o;break;case"ArrowLeft":i.x-=o;break;case"ArrowRight":i.x+=o;break;case"ArrowDown":i.y+=o}(0,tE.r0)(t)&&t instanceof v.lw&&t.moveTo(i),t.xywh=i.serialize()})}_setEdgelessTool(e,t,i=!1){(i||!e.service.selection.editing)&&e.tools.setEdgelessTool(t)}_shift(e){let t=this.rootComponent;e.repeat||("shift"===e.key.toLowerCase()&&e.shiftKey?t.slots.pressShiftKeyUpdated.emit(!0):t.slots.pressShiftKeyUpdated.emit(!1))}_space(e){let t=this.rootComponent,i=t.service.selection,s=t.edgelessTool,o=s.type,r="keydown"===e.type;if(r?t.tools.spaceBar=!0:t.tools.spaceBar=!1,t.service.tool.dragging)return;let a=e=>{"Space"===e.code&&(this._setEdgelessTool(t,s),document.removeEventListener("keyup",a,!1))};if(r){if("pan"===o||"default"===o&&i.editing)return;this._setEdgelessTool(t,{type:"pan",panning:!1}),t.dispatcher.disposables.addFromEvent(document,"keyup",a)}}}var fU=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},fW=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c=[(0,D.EM)("affine-edgeless-root")],d=[],f=P.p_,g=[],m=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[];return class extends f{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.P)(".edgeless-background")],o=[(0,D.wk)()],r=[(0,D.P)("gfx-viewport")],a=[(0,D.P)(".edgeless-mount-point")],n=[(0,D.P)("edgeless-selected-rect")],l=[(0,D.P)("affine-surface")],fU(this,null,i,{kind:"accessor",name:"_isResizing",static:!1,private:!1,access:{has:e=>"_isResizing"in e,get:e=>e._isResizing,set:(e,t)=>{e._isResizing=t}},metadata:h},g,m),fU(this,null,s,{kind:"accessor",name:"backgroundElm",static:!1,private:!1,access:{has:e=>"backgroundElm"in e,get:e=>e.backgroundElm,set:(e,t)=>{e.backgroundElm=t}},metadata:h},y,b),fU(this,null,o,{kind:"accessor",name:"edgelessTool",static:!1,private:!1,access:{has:e=>"edgelessTool"in e,get:e=>e.edgelessTool,set:(e,t)=>{e.edgelessTool=t}},metadata:h},w,x),fU(this,null,r,{kind:"accessor",name:"gfxViewportElm",static:!1,private:!1,access:{has:e=>"gfxViewportElm"in e,get:e=>e.gfxViewportElm,set:(e,t)=>{e.gfxViewportElm=t}},metadata:h},_,C),fU(this,null,a,{kind:"accessor",name:"mountElm",static:!1,private:!1,access:{has:e=>"mountElm"in e,get:e=>e.mountElm,set:(e,t)=>{e.mountElm=t}},metadata:h},k,S),fU(this,null,n,{kind:"accessor",name:"selectedRect",static:!1,private:!1,access:{has:e=>"selectedRect"in e,get:e=>e.selectedRect,set:(e,t)=>{e.selectedRect=t}},metadata:h},M,E),fU(this,null,l,{kind:"accessor",name:"surface",static:!1,private:!1,access:{has:e=>"surface"in e,get:e=>e.surface,set:(e,t)=>{e.surface=t}},metadata:h},I,B),fU(null,e={value:t},c,{kind:"class",name:t.name,metadata:h},null,d),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` affine-edgeless-root { -webkit-user-select: none; user-select: none; display: block; height: 100%; touch-action: none; } .widgets-container { position: absolute; left: 0; top: 0; contain: size layout; z-index: 1; height: 100%; } .edgeless-background { height: 100%; background-color: var(--affine-background-primary-color); background-image: radial-gradient( var(--affine-edgeless-grid-color) 1px, var(--affine-background-primary-color) 1px ); } @media print { .selected { background-color: transparent !important; } } `}_handleToolbarFlag(){this.components.toolbar||(()=>{let e=new fy(this);this.append(e),this.components.toolbar=e})()}_initFontLoader(){let e=this.service?.fontLoader;(0,H.Z1)(e),e.ready.then(()=>{this.surface.refresh()}).catch(console.error)}_initLayerUpdateEffect(){let e=(0,O.GR)(()=>{Array.from(this.gfxViewportElm.children).forEach(e=>{e.updateZIndex?.()})});this._disposables.add(this.service.layer.slots.layerUpdated.on(()=>e()))}_initPanEvent(){this.disposables.add(this.dispatcher.add("pan",e=>{let{viewport:t}=this.service;if(t.locked)return;let[i,s]=e.get("multiPointerState").pointers,o=.5*(i.delta.x+s.delta.x)/t.zoom/t.scale,r=.5*(i.delta.y+s.delta.y)/t.zoom/t.scale;t.applyDeltaCenter(-o,-r)}))}_initPinchEvent(){this.disposables.add(this.dispatcher.add("pinch",e=>{let{viewport:t}=this.service;if(t.locked)return;let[i,s]=e.get("multiPointerState").pointers,o=new u.b(.5*(i.x+s.x),.5*(i.y+s.y)),r=tm.l.dist([i.x-i.delta.x,i.y-i.delta.y],[s.x-s.delta.x,s.y-s.delta.y]),a=tm.l.dist([i.x,i.y],[s.x,s.y])/r*t.zoom,[n,l]=t.toModelCoord(o.x,o.y);return t.setZoom(a,new u.b(n,l)),!1}))}_initPixelRatioChangeEffect(){let e;let t=()=>{e&&(this.service.viewport.onResize(),e.removeEventListener("change",t)),(e=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`)).addEventListener("change",t)};t(),this._disposables.add(()=>{e?.removeEventListener("change",t)})}_initRemoteCursor(){let e=null,t=t=>{e&&cancelAnimationFrame(e),e=(0,O.Ak)(()=>{if(!this.service?.viewport)return;let i=this.service.viewport.toModelCoord(t.x,t.y);this.service.selection.setCursor({x:i[0],y:i[1]}),e=null},this)};this.handleEvent("pointerMove",e=>{t(e.get("pointerState"))})}_initResizeEffect(){let e=new ResizeObserver(e=>{if(!this.service||!this.service.selection||!this.service.viewport){console.error("Service not ready");return}this.service.selection.set(this.service.selection.surfaceSelections),this.service.viewport.onResize()});e.observe(this.viewportElement),this._resizeObserver=e}_initSlotEffects(){let{disposables:e,slots:t}=this;this.disposables.add(this.service.themeObserver.mode$.subscribe(()=>this.surface.refresh())),e.add(this.service.selection),e.add(t.edgelessToolUpdated.on(e=>{this.edgelessTool=e})),e.add(t.cursorUpdated.on((0,td.nF)(e=>{this.style.cursor=e},144)));let i=!0;e.add(t.copyAsPng.on(({blocks:e,shapes:t})=>{i&&(i=!1,this.clipboardController.copyAsPng(e,t).then(()=>(0,e5.o)(this.host,"Copied to clipboard")).catch(()=>(0,e5.o)(this.host,"Failed to copy as PNG")).finally(()=>{i=!0}))}))}_initTools(){[ib,fI,fO,fR,pN,fB,fj,fH,fV,fP,f$,fL,fz,fD].forEach(e=>{this.service.registerTool(e)}),this.service.tool.mount(this)}_initViewport(){let{service:e}=this;e.viewport.setContainer(this),(()=>{let t=e.editPropsStore.getStorage("viewport")??e.getFitToScreenData();if("xywh"in t){let i=p.z.deserialize(t.xywh);e.viewport.setViewportByBound(i,t.padding)}else{let{zoom:i,centerX:s,centerY:o}=t;e.viewport.setViewport(i,[s,o])}})(),this._disposables.add(()=>{e.editPropsStore.setStorage("viewport",{centerX:e.viewport.centerX,centerY:e.viewport.centerY,zoom:e.viewport.zoom})})}_initWheelEvent(){this._disposables.add(this.dispatcher.add("wheel",e=>{let t=e.get("defaultState").event;t.preventDefault();let{viewport:i,locked:s}=this.service;if(!s){if((0,O.BQ)(t)){let e=this.getBoundingClientRect(),[s,o]=this.service.viewport.toModelCoord(t.clientX-e.x,t.clientY-e.y),r=(0,v._z)(t.deltaY,i.zoom);i.setZoom(r,new u.b(s,o)),t.stopPropagation()}else{let e=ij.H8&&t.shiftKey,s=e?t.deltaY/i.zoom:t.deltaX/i.zoom,o=e?0:t.deltaY/i.zoom;i.applyDeltaCenter(s,o),i.viewportMoved.emit([s,o]),t.stopPropagation()}}}))}async addAttachments(e,t){if(!e.length)return[];let i=this.host.spec.getService("affine:attachment").maxFileSize;if(e.some(e=>e.size>i))return(0,e5.o)(this.host,`You can only upload files less than ${(0,tv.bn)(i,!0,0)}`),[];let{x:s,y:o}=this.service.viewport.center;t&&([s,o]=this.service.viewport.toModelCoord(...t));let r=e.map((e,t)=>{let i=new u.b(s+32*t,o+32*t),r=tm.l.toVec(i),a=p.z.fromCenter(r,eh.Cd.cubeThick,eh.Hn.cubeThick);return{blockId:this.service.addBlock("affine:attachment",{name:e.name,size:e.size,type:e.type,style:"cubeThick",xywh:a.serialize()},this.surface.model),file:e}}).map(async({blockId:e,file:t})=>{let i;try{lC.add(e),i=await this.doc.blobSync.set(t)}catch(e){console.error(e),e instanceof Error&&(0,e5.o)(this.host,`Failed to upload attachment! ${e.message||e.toString()}`)}finally{lC.delete(e),this.doc.withoutTransact(()=>{this.service.updateElement(e,{sourceId:i})})}return e}),a=await Promise.all(r);return this.service.selection.set({elements:a,editing:!1}),a}async addImages(e,t,i){let s=[...e].filter(e=>e.type.startsWith("image/"));if(!s.length)return[];let o=this.host.spec.getService("affine:image").maxFileSize;if(s.some(e=>e.size>o))return(0,e5.o)(this.host,`You can only upload files less than ${(0,tv.bn)(o,!0,0)}`),[];let{x:r,y:a}=this.service.viewport.center;t&&([r,a]=this.service.viewport.toModelCoord(...t));let n=[];s.map((e,t)=>{let s=new u.b(r+32*t,a+32*t),o=c3(tm.l.toVec(s),i),l=this.service.addBlock("affine:image",{size:e.size,xywh:o.serialize()},this.surface.model);n.push({point:s,blockId:l})});let l=s.map(async(e,t)=>{let{point:s,blockId:o}=n[t],r=await this.doc.blobSync.set(e),a=await c5(e),l=c3(tm.l.toVec(s),i,a.width,a.height);this.doc.withoutTransact(()=>{this.service.updateElement(o,{sourceId:r,...a,xywh:l.serialize()})})});await Promise.all(l);let c=n.map(e=>e.blockId);return this.service.selection.set({elements:c,editing:!1}),c}addNewNote(e,t,i){this.doc.captureSync();let{left:s,top:o}=this.service.viewport;t.x-=s,t.y-=o;let r=this.addNoteWithPoint(t,i),a=this.doc.addBlocks(e.map(({flavour:e,...t})=>((0,H.Z1)(e),{flavour:e,blockProps:t})),r);return{noteId:r,ids:a}}addNoteWithPoint(e,t={}){let{width:i=448,height:s=72,offsetX:o=30,offsetY:r=40,parentId:a=this.doc.root?.id,noteIndex:n,scale:l=1}=t,[c,d]=this.service.viewport.toModelCoord(e.x,e.y),u=this.service.addBlock("affine:note",{xywh:(0,h.P)(c-o*l,d-r*l,i,s),displayMode:O.ko.EdgelessOnly},a,n);return this.service.telemetryService?.track("CanvasElementAdded",{control:"canvas:draw",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"note"}),u}connectedCallback(){super.connectedCallback(),this.clipboardController.hostConnected(),this.keyboardManager=new fq(this),this.handleEvent("selectionChange",()=>{let e=this.host.selection.value.find(e=>e.is("surface"));if(!e)return;let t=this.service.getElementById(e.elements[0]);if((0,tE.r0)(t))return!0}),this.mouseRoot=this.parentElement,this._initTools(),this._disposables.add(this.slots.elementResizeStart.on(()=>{this._isResizing=!0})),this._disposables.add(this.slots.elementResizeEnd.on(()=>{this._isResizing=!1}))}disconnectedCallback(){super.disconnectedCallback(),this.clipboardController.hostDisconnected(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),this.keyboardManager=null,this.components.toolbar?.remove(),this.components.toolbar=null}firstUpdated(){this._initSlotEffects(),this._initResizeEffect(),this._initPixelRatioChangeEffect(),this._initFontLoader(),this._initRemoteCursor(),this._initLayerUpdateEffect(),this._initViewport(),this._initWheelEvent(),this._initPanEvent(),this._initPinchEvent(),this.doc.readonly&&this.tools.setEdgelessTool({type:"pan",panning:!0}),this.disableComponents||((0,O.Ak)(()=>{this._handleToolbarFlag(),this.requestUpdate()},this),this._disposables.add(this.service.viewport.viewportUpdated.on(()=>{this._refreshLayerViewport()})),this._refreshLayerViewport())}getElementsBound(){let{service:e}=this;return tS([...e.elements,...e.blocks])}renderBlock(){let e=(0,t$.u)(Object.entries(this.widgets),([e])=>e,([e,t])=>t);return(0,L.qy)`
{let e=this.service.layer.blocksGrid.search(this.service.viewport.viewportBounds,void 0,!0);return this.service.layer.framesGrid.search(this.service.viewport.viewportBounds,void 0,!0).forEach(t=>e.add(t)),e}} .host=${this.host} > ${this.renderChildren(this.model)}${this.renderChildren(this.surfaceBlockModel)}
${this._isResizing?L.s6:(0,L.qy)``}
${e}
`}setSelection(e,t=!0,i,s){let o=this.service.blocks.filter(e=>"affine:note"===e.flavour).find(t=>t.id===e);(0,H.Z1)(o),requestAnimationFrame(()=>{this.service.selection.set({elements:[o.id],editing:!1}),this.updateComplete.then(()=>{i?O.Km(this.host,i)?.catch(console.error):s&&(0,O.kW)(s.x,s.y)}).catch(console.error)})}get dispatcher(){return this.service?.uiEventDispatcher}get slots(){return this.service.slots}get surfaceBlockModel(){return this.model.children.find(e=>"affine:surface"===e.flavour)}get tools(){return this.service.tool}get viewport(){let{scrollLeft:e,scrollTop:t,scrollWidth:i,scrollHeight:s,clientWidth:o,clientHeight:r}=this.viewportElement,{top:a,left:n}=this.viewportElement.getBoundingClientRect();return{top:a,left:n,scrollLeft:e,scrollTop:t,scrollWidth:i,scrollHeight:s,clientWidth:o,clientHeight:r}}get viewportElement(){return this._viewportElement||(this._viewportElement=this.host.closest(".affine-edgeless-viewport"),(0,H.Z1)(this._viewportElement)),this._viewportElement}#a$;get _isResizing(){return this.#a$}set _isResizing(e){this.#a$=e}#nD;get backgroundElm(){return this.#nD}set backgroundElm(e){this.#nD=e}#aY;get edgelessTool(){return this.#aY}set edgelessTool(e){this.#aY=e}#nZ;get gfxViewportElm(){return this.#nZ}set gfxViewportElm(e){this.#nZ=e}#nj;get mountElm(){return this.#nj}set mountElm(e){this.#nj=e}#am;get selectedRect(){return this.#am}set selectedRect(e){this.#am=e}#nV;get surface(){return this.#nV}set surface(e){this.#nV=e}constructor(){super(...arguments),this._refreshLayerViewport=(0,O.GR)(()=>{let{zoom:e,translateX:t,translateY:i}=this.service.viewport,{gap:s}=(0,tE.p1)(e,!0);this.backgroundElm&&(this.backgroundElm.style.setProperty("background-position",`${t}px ${i}px`),this.backgroundElm.style.setProperty("background-size",`${s}px ${s}px`))},this),this._resizeObserver=null,this._viewportElement=null,this.clipboardController=new fM(this),this.components={toolbar:null},this.disableComponents=!1,this.keyboardManager=null,this.#a$=fW(this,g,!1),this.#nD=(fW(this,m),fW(this,y,null)),this.#aY=(fW(this,b),fW(this,w,{type:localStorage.defaultTool??"default"})),this.#nZ=(fW(this,x),fW(this,_,void 0)),this.#nj=(fW(this,C),fW(this,k,null)),this.#am=(fW(this,S),fW(this,M,void 0)),this.#nV=(fW(this,E),fW(this,I,void 0)),fW(this,B)}static{fW(t,d)}},t})(),fY=(0,L.AH)` .menu-container { user-select: none; z-index: var(--affine-z-index-popover); isolation: isolate; } .pie-menu-container > .overlay { top: 0; left: 0; height: 100vh; width: 100vw; position: fixed; z-index: var(--affine-z-index-popover); } .pie-menu { position: fixed; top: 0; left: 0; box-sizing: border-box; z-index: calc( var(--affine-z-index-popover) + 10 ); /* This is important or else will hover will not work */ } `,fK=(0,L.AH)` .pie-node { position: absolute; background: var(--affine-background-overlay-panel-color); user-select: none; box-shadow: var(--affine-shadow-2); border: 2px solid var(--affine-border-color); border-radius: 50%; display: flex; font-size: 0.8rem; align-items: center; justify-content: center; text-align: center; transition: all 250ms cubic-bezier(0.775, 1.325, 0.535, 1); } @keyframes my-anim { 0% { transform: translate(0, 0); opacity: 0; } 40% { opacity: 0; } 100% { opacity: 100; } } `;function fX(e){let t=e.tools.currentController;t instanceof pN&&t.createOverlay()}function fQ(e){return({rootComponent:t})=>{if(t instanceof fG){let i=t.service.editPropsStore.getLastProps("shape"),s="fill"==e?i.fillColor:i.strokeColor;return j.Q.getColorValue(s)}return""}}function fJ({rootComponent:e}){if(e instanceof fG){let t=e.service.editPropsStore.getLastProps("connector").stroke;return j.Q.getColorValue(t)}return""}function f1(e){return({rootComponent:t})=>{t.service.tool.setEdgelessTool(e)}}function f0(e,t){return[Math.cos(e)*t[0],Math.sin(e)*t[1]]}function f2(e){return"children"in e}function f5(e){return"root"===e.type}function f7(e){return"submenu"===e.type}function f3(e){return"command"===e.type}function f4(e){return"color"===e.type}function f6(e){return"action"in e&&"function"==typeof e.action}function f8(e,t,i){return e>t&&e<=i||e-360>t&&e-360<=i||e+360>t&&e+360<=i}function f9(e,t,i){for(;t=360;)e-=360,t-=360,i-=360;return[e,t,i]}function ge(e,t,i,s){return[e=t-(t-e)*s,i=t+(i-t)*s]}var gt=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},gi=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d,h=[(0,D.EM)("affine-pie-node")],u=[],p=(0,P.Tm)(L.WF),f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[];return class extends p{static{t=this}static{let O="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],c=[(0,D.MZ)({attribute:!1})],d=[(0,D.MZ)({attribute:!1})],gt(this,null,i,{kind:"accessor",name:"_isHovering",static:!1,private:!1,access:{has:e=>"_isHovering"in e,get:e=>e._isHovering,set:(e,t)=>{e._isHovering=t}},metadata:O},f,g),gt(this,null,s,{kind:"accessor",name:"angle",static:!1,private:!1,access:{has:e=>"angle"in e,get:e=>e.angle,set:(e,t)=>{e.angle=t}},metadata:O},m,v),gt(this,null,o,{kind:"accessor",name:"containerNode",static:!1,private:!1,access:{has:e=>"containerNode"in e,get:e=>e.containerNode,set:(e,t)=>{e.containerNode=t}},metadata:O},y,b),gt(this,null,r,{kind:"accessor",name:"endAngle",static:!1,private:!1,access:{has:e=>"endAngle"in e,get:e=>e.endAngle,set:(e,t)=>{e.endAngle=t}},metadata:O},w,x),gt(this,null,a,{kind:"accessor",name:"index",static:!1,private:!1,access:{has:e=>"index"in e,get:e=>e.index,set:(e,t)=>{e.index=t}},metadata:O},_,C),gt(this,null,n,{kind:"accessor",name:"menu",static:!1,private:!1,access:{has:e=>"menu"in e,get:e=>e.menu,set:(e,t)=>{e.menu=t}},metadata:O},k,S),gt(this,null,l,{kind:"accessor",name:"model",static:!1,private:!1,access:{has:e=>"model"in e,get:e=>e.model,set:(e,t)=>{e.model=t}},metadata:O},M,E),gt(this,null,c,{kind:"accessor",name:"position",static:!1,private:!1,access:{has:e=>"position"in e,get:e=>e.position,set:(e,t)=>{e.position=t}},metadata:O},I,B),gt(this,null,d,{kind:"accessor",name:"startAngle",static:!1,private:!1,access:{has:e=>"startAngle"in e,get:e=>e.startAngle,set:(e,t)=>{e.startAngle=t}},metadata:O},$,T),gt(null,e={value:t},h,{kind:"class",name:t.name,metadata:O},null,u),t=e.value,O&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:O})}static{this.styles=fK}_renderCenterNode(){let e=this.isActive();return(0,L.qy)` `}_renderChildNode(){let e=this.menu.isChildOfActiveNode(this);return(0,L.qy)` `}_setupEvents(){this._disposables.add(this.menu.slots.pointerAngleUpdated.on(this._onPointerAngleUpdated)),this._disposables.add(this.menu.slots.requestNodeUpdate.on(()=>this.requestUpdate()))}connectedCallback(){super.connectedCallback(),this._setupEvents()}isActive(){return this.menu.isActiveNode(this)}isCenterNode(){return f2(this.model)&&this.menu.selectionChain.includes(this)}render(){return this.isCenterNode()?this._renderCenterNode():this._renderChildNode()}select(){let e=this.model;if(f5(e))return;let t={rootComponent:this.menu.rootComponent,menu:this.menu,widgetComponent:this.menu.widgetComponent,node:this};f6(e)?e.action(t):f4(e)&&e.onChange(e.color,t),this.requestUpdate()}get icon(){let e=this.model.icon;if("function"==typeof e){let{menu:t}=this,{rootComponent:i,widgetComponent:s}=t;return e({rootComponent:i,menu:t,widgetComponent:s,node:this})}return e}#nz;get _isHovering(){return this.#nz}set _isHovering(e){this.#nz=e}#nR;get angle(){return this.#nR}set angle(e){this.#nR=e}#nF;get containerNode(){return this.#nF}set containerNode(e){this.#nF=e}#nN;get endAngle(){return this.#nN}set endAngle(e){this.#nN=e}#i;get index(){return this.#i}set index(e){this.#i=e}#nq;get menu(){return this.#nq}set menu(e){this.#nq=e}#iJ;get model(){return this.#iJ}set model(e){this.#iJ=e}#au;get position(){return this.#au}set position(e){this.#au=e}#nU;get startAngle(){return this.#nU}set startAngle(e){this.#nU=e}constructor(){super(...arguments),this._handleChildNodeClick=()=>{this.select(),f3(this.model)&&this.menu.close()},this._handleGoBack=()=>{this.menu.activeNode!==this&&this.menu.popSelectionChainTo(this)},this._onPointerAngleUpdated=e=>{if(this._rotatorAngle=e,this.menu.activeNode.requestUpdate(),!f5(this.model)&&this.menu.isChildOfActiveNode(this)){if(null===e){this._isHovering=!1,this.menu.setHovered(null);return}f8(e,this.startAngle,this.endAngle)?this.menu.hoveredNode!==this&&(this._isHovering=!0,this.menu.setHovered(this)):this._isHovering=!1}},this._rotatorAngle=null,this.#nz=gi(this,f,!1),this.#nR=(gi(this,g),gi(this,m,void 0)),this.#nF=(gi(this,v),gi(this,y,null)),this.#nN=(gi(this,b),gi(this,w,void 0)),this.#i=(gi(this,x),gi(this,_,void 0)),this.#nq=(gi(this,C),gi(this,k,void 0)),this.#iJ=(gi(this,S),gi(this,M,void 0)),this.#au=(gi(this,E),gi(this,I,void 0)),this.#nU=(gi(this,B),gi(this,$,void 0)),gi(this,T)}static{gi(t,u)}},t})();var go=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},gr=function(e,t,i){for(var s=arguments.length>2,o=0;o svg, .pie-node.center[active='true'] .node-content > .color-unit, .pie-node.center[active='true'] .node-content > .color-unit > svg { width: 2rem !important; height: 2rem !important; } .pie-node.center[active='false'] { width: 3rem; height: 3rem; opacity: 0.6; } `,gn=(()=>{let e,t,i,s,o,r,a,n=[(0,D.EM)("pie-node-center")],l=[],c=L.WF,d=[],h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[];return class extends c{static{t=this}static{let w="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],go(this,null,i,{kind:"accessor",name:"hoveredNode",static:!1,private:!1,access:{has:e=>"hoveredNode"in e,get:e=>e.hoveredNode,set:(e,t)=>{e.hoveredNode=t}},metadata:w},d,h),go(this,null,s,{kind:"accessor",name:"isActive",static:!1,private:!1,access:{has:e=>"isActive"in e,get:e=>e.isActive,set:(e,t)=>{e.isActive=t}},metadata:w},u,p),go(this,null,o,{kind:"accessor",name:"node",static:!1,private:!1,access:{has:e=>"node"in e,get:e=>e.node,set:(e,t)=>{e.node=t}},metadata:w},f,g),go(this,null,r,{kind:"accessor",name:"onMouseEnter",static:!1,private:!1,access:{has:e=>"onMouseEnter"in e,get:e=>e.onMouseEnter,set:(e,t)=>{e.onMouseEnter=t}},metadata:w},m,v),go(this,null,a,{kind:"accessor",name:"rotatorAngle",static:!1,private:!1,access:{has:e=>"rotatorAngle"in e,get:e=>e.rotatorAngle,set:(e,t)=>{e.rotatorAngle=t}},metadata:w},y,b),go(null,e={value:t},n,{kind:"class",name:t.name,metadata:w},null,l),t=e.value,w&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:w})}static{this.styles=[gs.styles,ga]}render(){let[e,t]=this.node.position,i={transform:`translate(${e}px, ${t}px) translate(-50%, -50%)`};return(0,L.qy)`
`}#nW=gr(this,d,void 0);get hoveredNode(){return this.#nW}set hoveredNode(e){this.#nW=e}#nG=(gr(this,h),gr(this,u,void 0));get isActive(){return this.#nG}set isActive(e){this.#nG=e}#nY=(gr(this,p),gr(this,f,void 0));get node(){return this.#nY}set node(e){this.#nY=e}#nK=(gr(this,g),gr(this,m,void 0));get onMouseEnter(){return this.#nK}set onMouseEnter(e){this.#nK=e}#nX=(gr(this,v),gr(this,y,null));get rotatorAngle(){return this.#nX}set rotatorAngle(e){this.#nX=e}constructor(){super(...arguments),gr(this,b)}static{gr(t,l)}},t})();var gl=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},gc=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("pie-node-child")],n=[],l=L.WF,c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];return class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],gl(this,null,i,{kind:"accessor",name:"hovering",static:!1,private:!1,access:{has:e=>"hovering"in e,get:e=>e.hovering,set:(e,t)=>{e.hovering=t}},metadata:v},c,d),gl(this,null,s,{kind:"accessor",name:"node",static:!1,private:!1,access:{has:e=>"node"in e,get:e=>e.node,set:(e,t)=>{e.node=t}},metadata:v},h,u),gl(this,null,o,{kind:"accessor",name:"onClick",static:!1,private:!1,access:{has:e=>"onClick"in e,get:e=>e.onClick,set:(e,t)=>{e.onClick=t}},metadata:v},p,f),gl(this,null,r,{kind:"accessor",name:"visible",static:!1,private:!1,access:{has:e=>"visible"in e,get:e=>e.visible,set:(e,t)=>{e.visible=t}},metadata:v},g,m),gl(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=[gs.styles,gd]}render(){let{model:e,position:t}=this.node,[i,s]=t,o={top:"50%",left:"50%",transform:`translate(${i}px, ${s}px) translate(-50%, -50%)`,visibility:this.visible?"visible":"hidden"};return(0,L.qy)`
  • `}#nQ=gc(this,c,void 0);get hovering(){return this.#nQ}set hovering(e){this.#nQ=e}#nY=(gc(this,d),gc(this,h,void 0));get node(){return this.#nY}set node(e){this.#nY=e}#k=(gc(this,u),gc(this,p,void 0));get onClick(){return this.#k}set onClick(e){this.#k=e}#nr=(gc(this,f),gc(this,g,void 0));get visible(){return this.#nr}set visible(e){this.#nr=e}constructor(){super(...arguments),gc(this,m)}static{gc(t,n)}},t})();var gu=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},gp=function(e,t,i){for(var s=arguments.length>2,o=0;o svg { width: 24px; height: 24px; } .node-content.center[active='true'] > svg, .node-content.center[active='true'] > .color-unit, .node-content.center[active='true'] > .color-unit > svg { width: 2rem !important; height: 2rem !important; } `,gg=(()=>{let e,t,i,s,o,r,a=[(0,D.EM)("pie-node-content")],n=[],l=L.WF,c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];return class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.P)(".node-content")],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],gu(this,null,i,{kind:"accessor",name:"_nodeContentElement",static:!1,private:!1,access:{has:e=>"_nodeContentElement"in e,get:e=>e._nodeContentElement,set:(e,t)=>{e._nodeContentElement=t}},metadata:v},c,d),gu(this,null,s,{kind:"accessor",name:"hoveredNode",static:!1,private:!1,access:{has:e=>"hoveredNode"in e,get:e=>e.hoveredNode,set:(e,t)=>{e.hoveredNode=t}},metadata:v},h,u),gu(this,null,o,{kind:"accessor",name:"isActive",static:!1,private:!1,access:{has:e=>"isActive"in e,get:e=>e.isActive,set:(e,t)=>{e.isActive=t}},metadata:v},p,f),gu(this,null,r,{kind:"accessor",name:"node",static:!1,private:!1,access:{has:e=>"node"in e,get:e=>e.node,set:(e,t)=>{e.node=t}},metadata:v},g,m),gu(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=gf}_renderCenterNodeContent(){if(f7(this.node.model)&&!this.isActive)return this._renderChildNodeContent();let{menu:e,model:t}=this.node,i=e.isActiveNode(this.node),s=this.hoveredNode;if(this.isActive&&f7(t)&&"color-picker"===t.role){if(!s)return this.node.icon;(0,H.U2)(s.model.type,"color","IPieSubMenuNode.role with color-picker should have children of type color");let{color:e,hollowCircle:t}=s.model;return tF(e,{hollowCircle:t})}let{label:o}=t,r=this.node.icon??o;return i&&s?s.model.label:r}_renderChildNodeContent(){return this.node.icon}render(){let e=this.node.isCenterNode()?this._renderCenterNodeContent():this._renderChildNodeContent();return(0,L.qy)`
    ${e}
    `}updated(e){super.updated(e),e.has("hoveredNode")&&this._nodeContentElement&&this.isActive&&this._nodeContentElement.animate([{opacity:0},{opacity:1}],{duration:250,easing:"cubic-bezier(0.775, 1.325, 0.535, 1)",fill:"forwards"})}#nJ=gp(this,c,void 0);get _nodeContentElement(){return this.#nJ}set _nodeContentElement(e){this.#nJ=e}#nW=(gp(this,d),gp(this,h,void 0));get hoveredNode(){return this.#nW}set hoveredNode(e){this.#nW=e}#nG=(gp(this,u),gp(this,p,void 0));get isActive(){return this.#nG}set isActive(e){this.#nG=e}#nY=(gp(this,f),gp(this,g,void 0));get node(){return this.#nY}set node(e){this.#nY=e}constructor(){super(...arguments),gp(this,m)}static{gp(t,n)}},t})();var gm=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},gv=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("pie-center-rotator")],r=[],a=L.WF,n=[],l=[],c=[],d=[];return class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],gm(this,null,i,{kind:"accessor",name:"angle",static:!1,private:!1,access:{has:e=>"angle"in e,get:e=>e.angle,set:(e,t)=>{e.angle=t}},metadata:h},n,l),gm(this,null,s,{kind:"accessor",name:"isActive",static:!1,private:!1,access:{has:e=>"isActive"in e,get:e=>e.isActive,set:(e,t)=>{e.isActive=t}},metadata:h},c,d),gm(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=gy}render(){if(!this.isActive||null===this.angle)return L.s6;let[e,t]=f0((0,v.DF)(this.angle),[45,45]),i={transform:`translate(${e}px, ${t}px) translate(-50%, -50%)`};return(0,L.qy)``}#nR=gv(this,n,null);get angle(){return this.#nR}set angle(e){this.#nR=e}#nG=(gv(this,l),gv(this,c,void 0));get isActive(){return this.#nG}set isActive(e){this.#nG=e}constructor(){super(...arguments),gv(this,d)}static{gv(t,r)}},t})();class gw{static{this.registeredSchemas={}}static{this.schemas=new Set}static{this.settings={PIE_RADIUS:150,SELECT_ON_RELEASE_TIMEOUT:150,ACTIVATE_THRESHOLD_MIN:60,SUBMENU_OPEN_TIMEOUT:200,EXPANDABLE_ACTION_NODE_TIMEOUT:300}}static{this.slots={open:new f.DX}}static _getSchema(e){let t=this.registeredSchemas[e];return(0,H.Z1)(t),t}static _register(e){let{id:t}=e;(0,H.QV)(this.registeredSchemas[t],`Menu with id '${t}' already exists. Please provide a unique id`),this.registeredSchemas[t]=e}static _setupTriggers(e){Object.values(this.registeredSchemas).forEach(t=>{let{trigger:i}=t;e.handleEvent("keyDown",s=>{let o=s.get("keyboardState");i({keyEvent:o.raw,rootComponent:e})&&!o.raw.repeat&&this.open(t.id)},{global:!0})})}static add(e){return this.schemas.add(e)}static dispose(){this.registeredSchemas={}}static open(e){this.slots.open.emit(this._getSchema(e))}static remove(e){return this.schemas.delete(e)}static setup({rootComponent:e}){this.schemas.forEach(e=>this._register(e)),this._setupTriggers(e)}}let gx=new class{constructor(e){this._schema=null,this._stack=[],this._schema={...e,root:{type:"root",children:[],label:e.label,icon:e.icon,disabled:!1}},this._stack.push(this._schema.root)}_computeAngles(e){if(!f2(e)||!e.children||0===e.children.length)return;let t=void 0==e.angle?void 0:(e.angle+180)%360,i=function(e,t){let i=[];if(0==e.length)return i;let s=[];if(e.forEach((e,t)=>{e.angle&&e.angle>=0&&s.push({angle:e.angle,index:t})}),void 0!=t)for(let e=0;eMath.abs(s[e].angle-t)&&(s[e].angle+=.1);for(let e=0;es[e+1].angle?s.splice(e+1,1):++e;if(0==s.length){let o=0;if(void 0!=t){let i=360/(e.length+1),s=360;for(let o=0;oa&&t0&&(p+=1,s=a+h*p,f=!1),i[u]=s%360,u=(u+1)%e.length,p+=1}}return i}(e.children,t),s=function(e,t){if(0===e.length&&void 0===t)return[];if(1===e.length&&void 0===t)return[{start:0,end:360}];if(1===e.length&&void 0!==t){let i=t,s=e[0],o=t+360;return[i,s,o]=f9(i,s,o),[i,o]=ge(i,s,o,.5),[{start:i,end:o}]}let i=[];for(let a=0;atF(e.active(i),{hollowCircle:t}),label:e.label,role:"color-picker",openOnHover:e.openOnHover??!0,children:e.colors.map(({color:i})=>({icon:()=>tF(i,{hollowCircle:t}),type:"color",hollowCircle:t,label:i,color:i,onChange:e.onChange}))},s=this._currentNode();f2(s)&&s.children.push(i)}command(e){let t=this._currentNode(),i={...e,type:"command"};return f2(t)&&t.children.push(i),this}endSubmenu(){if(1===this._stack.length)throw Error("Cant end submenu already on the root node");return this._stack.pop(),this}expandableCommand(e){let{icon:t,label:i}=e;this.beginSubmenu({icon:t,label:i},e.action),e.submenus(this),this.endSubmenu()}reset(e){this._stack=[],this._schema={...e,root:{type:"root",children:[],label:e.label}},this._stack.push(this._schema.root)}}({id:"affine:pie:edgeless:tools",label:"Tools",icon:sm.dw,trigger:({keyEvent:e,rootComponent:t})=>{if((0,sy.QI)(e))return!1;let i=t.service.selection.editing;return"q"===e.key&&!i}});gx.expandableCommand({label:"Pen",icon:sm.vN,action:f1({type:"brush"}),submenus:e=>{e.colorPicker({label:"Pen Color",active:fJ,onChange:(e,{rootComponent:t})=>{t.service.editPropsStore.recordLastProps("brush",{color:e})},colors:tH.map(e=>({color:e}))})}}),gx.command({label:"Eraser",icon:sm.Ec,action:f1({type:"eraser"})}),gx.command({label:"Frame",icon:sm.H0,action:f1({type:"frame"})}),gx.command({label:"Select",icon:sm.wB,action:f1({type:"default"})}),gx.command({label:"Note",icon:sm.Qv,action:f1({type:"affine:note",childFlavour:is,childType:io,tip:ir})}),gx.command({label:"Reset Zoom",icon:sm.u2,action:({rootComponent:e})=>{e.service.zoomToFit()}}),gx.command({label:"Present",icon:({rootComponent:e})=>{let{type:t}=e.edgelessTool;return"frameNavigator"===t?(0,L.qy)` Stop `:sm.Yu},action:({rootComponent:e})=>{let{type:t}=e.edgelessTool;if("frameNavigator"===t){e.tools.setEdgelessTool({type:"default"}),document.fullscreenElement&&document.exitFullscreen().catch(console.error);return}e.tools.setEdgelessTool({type:"frameNavigator",mode:"fit"})}}),gx.beginSubmenu({label:"Connector",icon:({rootComponent:e})=>{let t=e.edgelessTool;if("connector"===t.type)switch(t.mode){case tb.B1.Orthogonal:return sm._U;case tb.B1.Curve:return sm.Rj;case tb.B1.Straight:return sm.CW}return sm.zN}}),gx.command({label:"Curved",icon:sm.Rj,action:f1({type:"connector",mode:tb.B1.Curve})}),gx.command({label:"Elbowed",icon:sm.CW,action:f1({type:"connector",mode:tb.B1.Orthogonal})}),gx.command({label:"Straight",icon:sm._U,action:f1({type:"connector",mode:tb.B1.Straight})}),gx.colorPicker({label:"Line Color",active:fJ,onChange:(e,{rootComponent:t})=>{t.service.editPropsStore.recordLastProps("connector",{stroke:e})},colors:tH.map(e=>({color:e}))}),gx.endSubmenu(),gx.beginSubmenu({label:"Shapes",icon:sm.Xf}),[{type:v.IO.Rect,label:"Rect",icon:e=>e===v.lH.General?sm.dH:sm.B2},{type:v.IO.Ellipse,label:"Ellipse",icon:e=>e===v.lH.General?sm.Yl:sm.ad},{type:v.IO.Triangle,label:"Triangle",icon:e=>e===v.lH.General?sm.o7:sm.OV},{type:v.IO.Diamond,label:"Diamond",icon:e=>e===v.lH.General?sm.e9:sm.o1}].forEach(e=>{gx.command({label:e.label,icon:({rootComponent:t})=>{let i=t.service.editPropsStore.getLastProps("shape");return e.icon(i.shapeStyle)},action:({rootComponent:t})=>{t.service.tool.setEdgelessTool({type:"shape",shapeType:e.type}),t.service.editPropsStore.recordLastProps("shape",{shapeType:e.type}),fX(t)}})}),gx.command({label:"Toggle Style",icon:({rootComponent:e})=>{let{shapeStyle:t}=e.service.editPropsStore.getLastProps("shape");return t===v.lH.General?sm.tg:sm.$J},action:({rootComponent:e})=>{let{shapeStyle:t}=e.service.editPropsStore.getLastProps("shape"),i=t===v.lH.General?v.lH.Scribbled:v.lH.General;e.service.editPropsStore.recordLastProps("shape",{shapeStyle:i}),fX(e)}}),gx.colorPicker({label:"Fill",active:fQ("fill"),onChange:(e,{rootComponent:t})=>{t.service.editPropsStore.recordLastProps("shape",{fillColor:e}),fX(t)},colors:a3.d.map(e=>({color:e}))}),gx.colorPicker({label:"Stroke",hollow:!0,active:fQ("stroke"),onChange:(e,{rootComponent:t})=>{t.service.editPropsStore.recordLastProps("shape",{strokeColor:e}),fX(t)},colors:a3.S5.map(e=>({color:e,name:"Color"}))}),gx.endSubmenu();let g_=gx.build();var gC=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},gk=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("affine-pie-menu")],n=[],l=(0,P.Tm)(L.WF),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];return class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],gC(this,null,i,{kind:"accessor",name:"position",static:!1,private:!1,access:{has:e=>"position"in e,get:e=>e.position,set:(e,t)=>{e.position=t}},metadata:v},c,d),gC(this,null,s,{kind:"accessor",name:"rootComponent",static:!1,private:!1,access:{has:e=>"rootComponent"in e,get:e=>e.rootComponent,set:(e,t)=>{e.rootComponent=t}},metadata:v},h,u),gC(this,null,o,{kind:"accessor",name:"schema",static:!1,private:!1,access:{has:e=>"schema"in e,get:e=>e.schema,set:(e,t)=>{e.schema=t}},metadata:v},p,f),gC(this,null,r,{kind:"accessor",name:"widgetComponent",static:!1,private:!1,access:{has:e=>"widgetComponent"in e,get:e=>e.widgetComponent,set:(e,t)=>{e.widgetComponent=t}},metadata:v},g,m),gC(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=fY}_createNodeTree(e){let t=new gs,{angle:i,startAngle:s,endAngle:o,label:r}=e;if(t.id=r,t.model=e,t.angle=i??0,t.startAngle=s??0,t.endAngle=o??0,t.menu=this,f5(e))t.position=[0,0];else{t.slot="children-slot";let{PIE_RADIUS:i}=gw.settings,s="color"===e.type?.6*i:i;t.position=f0((0,v.DF)(t.angle),[s,s])}return f2(e)&&e.children.forEach((e,i)=>{let s=this._createNodeTree(e);s.containerNode=t,s.index=i+1,s.setAttribute("index",s.index.toString()),t.append(s)}),t}_setupEvents(){this._disposables.addFromEvent(this.widgetComponent,"pointermove",this._handlePointerMove),this._disposables.addFromEvent(document,"keydown",this._handleKeyDown)}close(){this.abortController.abort()}connectedCallback(){super.connectedCallback(),this._setupEvents();let e=this._createNodeTree(this.schema.root);this.selectionChain.push(e)}getActiveNodeRelPos(){let e=[...this.position];for(let t of this.selectionChain)e[0]+=t.position[0],e[1]+=t.position[1];return e}getActiveNodeToMouseLenSq(e){let[t,i]=e,[s,o]=this.getActiveNodeRelPos();return tm.l.len2([t-s,i-o])}getNodeRelPos(e){let t=[...this.position],i=e;for(;null!==i;)t[0]+=i.position[0],t[1]+=i.position[1],i=i.containerNode;return t}isActiveNode(e){return this.activeNode===e}isChildOfActiveNode(e){return e.containerNode===this.activeNode}openSubmenu(e){(0,H.U2)(e.model.type,"submenu","Need node of type submenu"),f6(e.model)&&e.select(),this.selectionChain.push(e),this.setHovered(null),this.slots.requestNodeUpdate.emit()}popSelectionChainTo(e){for((0,H.U2)(f2(e.model),!0,"Required a root node or a submenu node");this.selectionChain.length>1&&this.activeNode!==e;)this.selectionChain.pop();this.requestUpdate(),this.slots.requestNodeUpdate.emit()}render(){let[e,t]=this.position,i={transform:`translate(${e}px, ${t}px) translate(-50%, -50%)`};return(0,L.qy)`
    ${this.rootNode??L.s6}
    `}selectHovered(){let{hoveredNode:e}=this;e&&e.select()}setHovered(e){if(clearTimeout(this._openSubmenuTimeout),this._hoveredNode=e,e&&f7(e.model)){let{openOnHover:t,timeoutOverride:i}=e.model,{SUBMENU_OPEN_TIMEOUT:s}=gw.settings;(void 0===t||t)&&(this._openSubmenuTimeout=setTimeout(()=>{this.openSubmenu(e)},i??s))}}get activeNode(){let e=this.selectionChain[this.selectionChain.length-1];return(0,H.Z1)(e,"Required atLeast 1 node active"),e}get hoveredNode(){return this._hoveredNode}get rootNode(){let e=this.selectionChain[0];return(0,H.Z1)(e,"No root node"),e}#au;get position(){return this.#au}set position(e){this.#au=e}#n1;get rootComponent(){return this.#n1}set rootComponent(e){this.#n1=e}#n0;get schema(){return this.#n0}set schema(e){this.#n0=e}#n2;get widgetComponent(){return this.#n2}set widgetComponent(e){this.#n2=e}constructor(){super(...arguments),this._handleKeyDown=e=>{let{key:t}=e;if("Escape"===t)return this.abortController.abort();if("Backspace"===e.code){if(this.selectionChain.length<=1)return;let{containerNode:e}=this.activeNode;e&&this.popSelectionChainTo(e)}t.match(/\d+/)&&this.selectChildWithIndex(parseInt(t))},this._handlePointerMove=e=>{let{clientX:t,clientY:i}=e,{ACTIVATE_THRESHOLD_MIN:s}=gw.settings;if(this.getActiveNodeToMouseLenSq([t,i])>s**2){let[e,s]=this.getActiveNodeRelPos(),o=2*Math.PI,r=(0,v.ct)((Math.atan2(i-s,t-e)+o)%o);this.slots.pointerAngleUpdated.emit(r)}else this.slots.pointerAngleUpdated.emit(null)},this._hoveredNode=null,this.selectChildWithIndex=e=>{let t=this.activeNode;if(!t||isNaN(e))return;let i=t.querySelector(`& > affine-pie-node[index='${e}']`);i instanceof gs&&!f4(i.model)&&(f7(i.model)?this.openSubmenu(i):i.select(),f3(i.model)&&this.close())},this.abortController=new AbortController,this.selectionChain=[],this.slots={pointerAngleUpdated:new a2.D,requestNodeUpdate:new a2.D},this.#au=gk(this,c,void 0),this.#n1=(gk(this,d),gk(this,h,void 0)),this.#n0=(gk(this,u),gk(this,p,void 0)),this.#n2=(gk(this,f),gk(this,g,void 0)),gk(this,m)}static{gk(t,n)}},t})();var gM=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},gE=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)(gI)],s=[],o=P.W,r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;gM(this,null,[(0,D.wk)()],{kind:"accessor",name:"currentMenu",static:!1,private:!1,access:{has:e=>"currentMenu"in e,get:e=>e.currentMenu,set:(e,t)=>{e.currentMenu=t}},metadata:n},r,a),gM(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),gE(t,s)}_attachMenu(e){if(this.currentMenu&&this.currentMenu.id===e.id)return this.currentMenu.close();let[t,i]=this.mouse,s=this._createMenu(e,{x:t,y:i,widgetComponent:this});this.currentMenu=s,this.selectOnTrigRelease.timeout=setTimeout(()=>{this.selectOnTrigRelease.allow=!0},gw.settings.SELECT_ON_RELEASE_TIMEOUT)}_createMenu(e,{x:t,y:i,widgetComponent:s}){let o=new gS;return o.id=e.id,o.schema=e,o.position=[t,i],o.rootComponent=s.rootComponent,o.widgetComponent=s,o.abortController.signal.addEventListener("abort",this._onMenuClose.bind(this)),o}_initPie(){gw.setup({rootComponent:this.rootComponent}),this._disposables.add(gw.slots.open.on(this._attachMenu.bind(this)))}_onMenuClose(){this.currentMenu=null,this.selectOnTrigRelease.allow=!1}connectedCallback(){super.connectedCallback(),this.isEnabled&&(this.handleEvent("keyUp",this._handleKeyUp,{global:!0}),this.handleEvent("pointerMove",this._handleCursorPos,{global:!0}),this.handleEvent("wheel",e=>{let t=e.get("defaultState");t.event instanceof WheelEvent&&t.event.stopPropagation()},{global:!0}),this._initPie())}disconnectedCallback(){super.disconnectedCallback(),gw.dispose()}render(){return this.currentMenu??L.s6}get isEnabled(){return this.doc.awarenessStore.getFlag("enable_pie_menu")}get isOpen(){return!!this.currentMenu}get rootComponent(){let e=this.block;if(e instanceof fG)return e;throw Error("AffinePieMenuWidget is only supported in edgeless")}#n5;get currentMenu(){return this.#n5}set currentMenu(e){this.#n5=e}constructor(){super(...arguments),this._handleCursorPos=e=>{let{x:t,y:i}=e.get("pointerState").point;this.mouse=[t,i]},this._handleKeyUp=e=>{if(!this.currentMenu)return;let t=e.get("keyboardState"),{trigger:i}=this.currentMenu.schema;i({keyEvent:t.raw,rootComponent:this.rootComponent})&&(clearTimeout(this.selectOnTrigRelease.timeout),this.selectOnTrigRelease.allow&&(this.currentMenu.selectHovered(),this.currentMenu.close()))},this.mouse=[innerWidth/2,innerHeight/2],this.selectOnTrigRelease={allow:!1},this.#n5=gE(this,r,null),gE(this,a)}})})(),gw.add(g_);var gB=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},g$=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c=[(0,D.EM)("embed-card-create-modal")],d=[],h=(0,P.Tm)(P.ao),u=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[];return class extends h{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.P)("input")],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],gB(this,null,i,{kind:"accessor",name:"_linkInputValue",static:!1,private:!1,access:{has:e=>"_linkInputValue"in e,get:e=>e._linkInputValue,set:(e,t)=>{e._linkInputValue=t}},metadata:p},u,f),gB(this,null,s,{kind:"accessor",name:"createOptions",static:!1,private:!1,access:{has:e=>"createOptions"in e,get:e=>e.createOptions,set:(e,t)=>{e.createOptions=t}},metadata:p},g,m),gB(this,null,o,{kind:"accessor",name:"descriptionText",static:!1,private:!1,access:{has:e=>"descriptionText"in e,get:e=>e.descriptionText,set:(e,t)=>{e.descriptionText=t}},metadata:p},v,y),gB(this,null,r,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:p},b,w),gB(this,null,a,{kind:"accessor",name:"input",static:!1,private:!1,access:{has:e=>"input"in e,get:e=>e.input,set:(e,t)=>{e.input=t}},metadata:p},x,_),gB(this,null,n,{kind:"accessor",name:"onConfirm",static:!1,private:!1,access:{has:e=>"onConfirm"in e,get:e=>e.onConfirm,set:(e,t)=>{e.onConfirm=t}},metadata:p},C,k),gB(this,null,l,{kind:"accessor",name:"titleText",static:!1,private:!1,access:{has:e=>"titleText"in e,get:e=>e.titleText,set:(e,t)=>{e.titleText=t}},metadata:p},S,M),gB(null,e={value:t},c,{kind:"class",name:t.name,metadata:p},null,d),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=sW}_handleInput(e){let t=e.target;this._linkInputValue=t.value}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{requestAnimationFrame(()=>{this.input.focus()})}).catch(console.error),this.disposables.addFromEvent(this,"keydown",this._onDocumentKeydown)}render(){return(0,L.qy)`
    ${this.titleText}
    ${this.descriptionText}
    `}#n7;get _linkInputValue(){return this.#n7}set _linkInputValue(e){this.#n7=e}#n3;get createOptions(){return this.#n3}set createOptions(e){this.#n3=e}#n4;get descriptionText(){return this.#n4}set descriptionText(e){this.#n4=e}#n;get host(){return this.#n}set host(e){this.#n=e}#P;get input(){return this.#P}set input(e){this.#P=e}#n6;get onConfirm(){return this.#n6}set onConfirm(e){this.#n6=e}#n8;get titleText(){return this.#n8}set titleText(e){this.#n8=e}constructor(){super(...arguments),this._onCancel=()=>{this.remove()},this._onConfirm=()=>{let e=this.input.value;if(!(0,oT.AY)(e)){(0,e5.o)(this.host,"Invalid link");return}let t=this.host.spec.getService("affine:page").getEmbedBlockOptions(e),{mode:i}=this.createOptions;if("page"===i){let{parentModel:i,index:s}=this.createOptions,o="affine:bookmark";t&&(o=t.flavour),this.host.doc.addBlock(o,{url:e},i,s)}else if("edgeless"===i){let i="affine:bookmark",s="vertical";t&&(i=t.flavour,s=t.styles[0]);let o=(0,of.$n)(this.host);(0,H.Z1)(o);let r=o.surface,a=tm.l.toVec(r.renderer.viewport.center);o.service.addBlock(i,{url:e,xywh:p.z.fromCenter(a,eh.Cd[s],eh.Hn[s]).serialize(),style:s},r.model),o.tools.setEdgelessTool({type:"default"})}this.onConfirm(),this.remove()},this._onDocumentKeydown=e=>{e.stopPropagation(),"Enter"!==e.key||e.isComposing||this._onConfirm(),"Escape"===e.key&&this.remove()},this.#n7=g$(this,u,""),this.#n3=(g$(this,f),g$(this,g,void 0)),this.#n4=(g$(this,m),g$(this,v,void 0)),this.#n=(g$(this,y),g$(this,b,void 0)),this.#P=(g$(this,w),g$(this,x,void 0)),this.#n6=(g$(this,_),g$(this,C,void 0)),this.#n8=(g$(this,k),g$(this,S,void 0)),g$(this,M)}static{g$(t,d)}},t})();async function gO(e,t,i,s){e.selection.clear();let o=new gT;return o.host=e,o.titleText=t,o.descriptionText=i,o.createOptions=s,document.body.append(o),new Promise(e=>{o.onConfirm=()=>e()})}var gP=i(1497);async function gH(e,t,i){let s=await (0,of.KW)(e,t.id);(0,H.Z1)(s,"RichText is not ready yet."),await s.updateComplete;let o=s.inlineEditor;(0,H.Z1)(o,"Inline editor is not ready yet."),o.slots.renderComplete.once(()=>{i&&i(s)})}async function gA(e,t,i){let s=t.doc;(0,H.Z1)(s.root);let o=e.view.viewFromPath("block",[s.root.id]);if(!o)return;await o.updateComplete;let r=e.view.viewFromPath("block",(0,of.UL)(t));r&&i(r)}var gL=i(28290);let gD=(0,L.qy)` Rickroll.mp3 Attach a file. `,gZ=(0,L.qy)` Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. In a decentralized system, we can have a kaleidoscopic complexity to our data. `,gj=(0,L.qy)` Here's an example of a bulleted list. You can list your plans such as this `,gV=(0,L.qy)` : { helloTo "World" body: { () } } struct var=varsome\( ContentView View@StateView Text "Hello helloTo)!" `,gz=(0,L.qy)` In a decentralized system, we can have a kaleidoscopic complexity to our data. Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. `,gR=(0,L.qy)` Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. In a decentralized system, we can have a kaleidoscopic complexity to our data. `,gF=(0,L.qy)` In a decentralized system, we can have a kaleidoscopic complexity to our data. Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. `,gN=(0,L.qy)` Group `,gq=(0,L.qy)` Embed a Figma document. AFFiNE Design System - Jul 2077 Edited just now `,gU=(0,L.qy)` toeverything/ AFFiNE Write, Draw and Plan All at Once. Link to a GitHub repository. `,gW=(0,L.qy)` Heading 1 In a decentralized system, we can have a kaleidoscopic complexity to our data. Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. `,gG=(0,L.qy)` Heading 2 In a decentralized system, we can have a kaleidoscopic complexity to our data. Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. `,gY=(0,L.qy)` Heading 3 In a decentralized system, we can have a kaleidoscopic complexity to our data. Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. `,gK=(0,L.qy)` Heading 4 In a decentralized system, we can have a kaleidoscopic complexity to our data. Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. `,gX=(0,L.qy)` Heading 5 In a decentralized system, we can have a kaleidoscopic complexity to our data. Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. `,gQ=(0,L.qy)` Heading 6 In a decentralized system, we can have a kaleidoscopic complexity to our data. Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. `,gJ=(0,L.qy)` Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. In a decentralized system, we can have a kaleidoscopic complexity to our data. `,g1=(0,L.qy)` Untitled Kanban Ungroups In Progress Done Task 5 Task 1 Task 4 1 1 In Progress Done Visualize data in a dashboard. `,g0=(0,L.qy)` Insert a Linear issue. Change theme following phone case color Work in Progress · High qpomelo re-assigned to tsiheng tsiheng re-assigned to qpomelo `,g2=(0,L.qy)` In a decentralized system, we can have a kaleidoscopic complexity to our data. Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. Learn about AFFiNE `,g5=(0,L.qy)` In a decentralized system, we can have a kaleidoscopic complexity to our data. Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. What’s AFFiNE? `,g7=(0,L.qy)` In a decentralized system, we can have a kaleidoscopic complexity to our data. Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. `,g3=(0,L.qy)` Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. In a decentralized system, we can have a kaleidoscopic complexity to our data. `,g4=(0,L.qy)` Title Type '/' for commands `,g6=(0,L.qy)` now and time. Insert date 11:45:14 Wed 3 Aug, 2022 `,g8=(0,L.qy)` 1. Here's an example of a numbered list. 2. You can list your plans such as this `,g9=(0,L.qy)` Insert a photo. `,me=(0,L.qy)` In a decentralized system, we can have a kaleidoscopic complexity to our data. … `,mt=(0,L.qy)` Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. In a decentralized system, we can have a kaleidoscopic complexity to our data. `,mi=(0,L.qy)` Untitled Table Title Task 1 Status Todo In Progress Done Task 2 Task 3 Display items in a table format. `,ms=(0,L.qy)` In a decentralized system, we can have a kaleidoscopic complexity to our data. Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. `,mo=(0,L.qy)` Here is an example of todo list. Make a list for building preview. `,mr=(0,L.qy)` . Wed 3 Aug, 2022 Insert today’s date `,ma=(0,L.qy)` tomorrow’s. Wed 3 Aug, 2022 Insert date `,mn=(0,L.qy)` Embed a X post (tweet). To Shape, Not to Adapt. AFFiNE @AFFiNEOfficial `,ml=(0,L.qy)` Any user may have a different perspective on what data they either have, choose to share, or accept. For example, one user’s edits to a document might be on their laptop on an airplane; when the plane lands and the computer reconnects, those changes are distributed to other users. Other users might choose to accept all, some, or none of those changes to their version of the document. In a decentralized system, we can have a kaleidoscopic complexity to our data. `,mc=(0,L.qy)` yesterday’s. Wed 3 Aug, 2022 Insert date `,md={Text:{figure:ms,caption:"Text"},"Heading 1":{figure:gW,caption:"Heading #1"},"Heading 2":{figure:gG,caption:"Heading #2"},"Heading 3":{figure:gY,caption:"Heading #3"},"Heading 4":{figure:gK,caption:"Heading #4"},"Heading 5":{figure:gX,caption:"Heading #5"},"Heading 6":{figure:gQ,caption:"Heading #6"},"Code Block":{figure:gV,caption:"Code Block"},Quote:{figure:me,caption:"Quote"},Divider:{figure:gF,caption:"Divider"},"Bulleted List":{figure:gj,caption:"Bulleted List"},"Numbered List":{figure:g8,caption:"Numbered List"},"To-do List":{figure:mo,caption:"To-do List"},Bold:{figure:gZ,caption:"Bold Text"},Italic:{figure:gJ,caption:"Italic"},Underline:{figure:ml,caption:"Underline"},Strikethrough:{figure:mt,caption:"Strikethrough"},"New Doc":{figure:g4,caption:"New Doc"},"Linked Doc":{figure:g5,caption:"Link Doc"},Link:{figure:g2,caption:"Link"},Attachment:{figure:gD,caption:"Attachment"},Github:{figure:gU,caption:"GitHub Repo"},YouTube:{figure:(0,L.qy)` Embed a YouTube video. `,caption:"YouTube Video"},Image:{figure:g9,caption:"Photo"},"X (Twitter)":{figure:mn,caption:"Tweet"},Figma:{figure:gq,caption:"Figma"},Linear:{figure:g0,caption:"Linear"},Today:{figure:mr,caption:"Today"},Tomorrow:{figure:ma,caption:"Tomorrow"},Yesterday:{figure:mc,caption:"Yesterday"},Now:{figure:g6,caption:"Now"},"Table View":{figure:mi,caption:"Table View"},"Kanban View":{figure:g1,caption:"Kanban View"},"Move Up":{figure:g3,caption:"Move Up"},"Move Down":{figure:g7,caption:"Move Down"},Copy:{figure:gz,caption:"Copy / Duplicate"},Delete:{figure:gR,caption:"Delete"},"Group & Frame":{figure:gN,caption:"Edgeless"}};function mh(e){return"groupName"in e}function mu(e){return!mh(e)}function mp(e){return"action"in e}function mf(e){return"subMenu"in e}function mg(e){return(mh(e)?e.groupName:e.name).split(" ").join("-").toLocaleLowerCase()}function mm(e,t,i,s){if(!t.text){console.error("Can't insert text! Text not found");return}let o=(0,of.h9)(e,t);if(!o){console.error("Can't insert text! Inline editor not found");return}let r=o.getInlineRange(),a=r?r.index:t.text.length;t.text.insert(i,a,s),o.setInlineRange({index:a+i.length,length:0})}function mv(e){let t=e.getFullYear(),i=(e.getMonth()+1).toString().padStart(2,"0"),s=e.getDate().toString().padStart(2,"0");return`${t}-${i}-${s}`}function my(e){let t=(e.getMonth()+1).toString().padStart(2,"0"),i=e.getDate().toString().padStart(2,"0"),s=e.getHours().toString().padStart(2,"0"),o=e.getMinutes().toString().padStart(2,"0");return`${t}-${i} ${s}:${o}`}function mb(e){return(0,O.a6)(e.doc,e,"affine:database")}function mw(e){return(0,O.a6)(e.doc,e,"affine:edgeless-text")}function mx(e){let t=e.doc.getParent(e);for(;t&&"affine:note"!==t.flavour;)t=(e=t).doc.getParent(t);if(!t)return;let i=t.children.indexOf(e);return e.doc.addBlock("affine:database",{},t,i+1)}function m_(e){e.text?.length||e.doc.deleteBlock(e)}function mC(e){let{name:t,description:i,icon:s,flavour:o,type:r}=e;return{name:t,description:i,icon:s,tooltip:md[t],showWhen:({model:e})=>e.doc.schema.flavourSchemaMap.has(o),action:({rootComponent:e})=>{e.host.std.command.chain().updateBlockType({flavour:o,props:{type:r}}).inline((e,t)=>!!e.updatedBlocks&&t()).run()}}}let mk={triggerKeys:["/","、"],ignoreBlockTypes:["affine:code"],maxHeight:344,tooltipTimeout:800,items:[{groupName:"Basic"},...aO.filter(e=>e.type&&["h1","h2","h3","text"].includes(e.type)).map(mC),{name:"Other Headings",icon:G.KcF,subMenu:[{groupName:"Headings"},...aO.filter(e=>e.type&&["h4","h5","h6"].includes(e.type)).map(mC)]},...aO.filter(e=>"affine:code"===e.flavour).map(e=>({...mC(e),showWhen:({model:t})=>t.doc.schema.flavourSchemaMap.has(e.flavour)&&!mb(t),action:({rootComponent:t})=>{let{flavour:i,type:s}=e;t.host.std.command.chain().updateBlockType({flavour:i,props:{type:s}}).inline((e,s)=>{let o=e.updatedBlocks;if(!o)return!1;if("affine:code"===i){if(1!==o.length)return console.error("Failed to reset selection! New model length isn't 1"),!1;let e=o[0];gH(t.host,e,e=>{let t=e.inlineEditor;t&&t.focusEnd()}).catch(console.error)}return s()}).run()}})),...aO.filter(e=>e.type&&["divider","quote"].includes(e.type)).map(e=>({...mC(e),showWhen:({model:t})=>t.doc.schema.flavourSchemaMap.has(e.flavour)&&!mb(t)&&!mw(t)})),{groupName:"List"},...aO.filter(e=>"affine:list"===e.flavour).map(mC),{groupName:"Style"},...op.filter(e=>!["Code","Link"].includes(e.name)).map(({name:e,icon:t,id:i})=>({name:e,icon:t,tooltip:md[e],action:({rootComponent:e,model:t})=>{if(!t.text)return;let s=t.text.length;if(!s){let s=(0,O.h9)(e.host,t);if(!s)return;s.setMarks({[i]:!0}),ep(s);return}t.text.format(0,s,{[i]:!0})}})),{groupName:"Page"},{name:"New Doc",description:"Start a new document.",icon:G.y_r,tooltip:md["New Doc"],action:({rootComponent:e,model:t})=>{let i=(0,O.Ux)(e.doc.collection);mm(e.host,t," ",{reference:{type:"LinkedPage",pageId:i.id}})}},{name:"Linked Doc",description:"Link to another document.",icon:G.hhn,tooltip:md["Linked Doc"],alias:["dual link"],showWhen:({rootComponent:e})=>{let t=e.widgetComponents["affine-linked-doc-widget"];return!!t&&("showLinkedDocPopover"in t||(console.warn('You may not have correctly implemented the linkedDoc widget! "showLinkedDoc(model)" method not found on widget'),!1))},action:({model:e,rootComponent:t})=>{if(mm(t.host,e,"@"),!e.doc.root)return;let i=t.widgetComponents["affine-linked-doc-widget"];i&&setTimeout(()=>{let s=(0,O.h9)(t.host,e);s&&i.showLinkedDocPopover(s,"@")})}},{groupName:"Content & Media"},{name:"Image",description:"Insert an image.",icon:G.BA1,tooltip:md.Image,showWhen:({model:e})=>e.doc.schema.flavourSchemaMap.has("affine:image")&&!mb(e),action:async({rootComponent:e,model:t})=>{if(!e.doc.getParent(t))return;let i=await (0,O.UE)();if(!i.length)return;let s=e.host.spec.getService("affine:image").maxFileSize;ds(e.host,i,s,t),m_(t)}},{name:"Link",description:"Add a bookmark for reference.",icon:G.qYV,tooltip:md.Link,showWhen:({model:e})=>e.doc.schema.flavourSchemaMap.has("affine:bookmark")&&!mb(e),action:async({rootComponent:e,model:t})=>{let i=e.doc.getParent(t);if(!i)return;let s=i.children.indexOf(t)+1;await gO(e.host,"Links","The added link will be displayed as a card view.",{mode:"page",parentModel:i,index:s}),m_(t)}},{name:"Attachment",description:"Attach a file to document.",icon:G.oSV,tooltip:md.Attachment,alias:["file"],showWhen:({model:e})=>e.doc.schema.flavourSchemaMap.has("affine:attachment")&&!mb(e),action:async({rootComponent:e,model:t})=>{let i=await (0,O.p6)();if(!i)return;let s=e.host.spec.getService("affine:attachment");if(!s)return;let o=s.maxFileSize;await lB(e.host,[i],o,t),m_(t)}},{name:"YouTube",description:"Embed a YouTube video.",icon:r2,tooltip:md.YouTube,showWhen:({model:e})=>e.doc.schema.flavourSchemaMap.has("affine:embed-youtube")&&!mb(e),action:async({rootComponent:e,model:t})=>{let i=e.doc.getParent(t);if(!i)return;let s=i.children.indexOf(t)+1;await gO(e.host,"YouTube","The added YouTube video link will be displayed as an embed view.",{mode:"page",parentModel:i,index:s}),m_(t)}},{name:"GitHub",description:"Link to a GitHub repository.",icon:oX,tooltip:md.Github,showWhen:({model:e})=>e.doc.schema.flavourSchemaMap.has("affine:embed-github")&&!mb(e),action:async({rootComponent:e,model:t})=>{let i=e.doc.getParent(t);if(!i)return;let s=i.children.indexOf(t)+1;await gO(e.host,"GitHub","The added GitHub issue or pull request link will be displayed as a card view.",{mode:"page",parentModel:i,index:s}),m_(t)}},{name:"Figma",description:"Embed a Figma document.",icon:oq,tooltip:md.Figma,showWhen:({model:e})=>e.doc.schema.flavourSchemaMap.has("affine:embed-figma")&&!mb(e),action:async({rootComponent:e,model:t})=>{let i=e.doc.getParent(t);if(!i)return;let s=i.children.indexOf(t)+1;await gO(e.host,"Figma","The added Figma link will be displayed as an embed view.",{mode:"page",parentModel:i,index:s}),m_(t)}},{name:"Loom",icon:rV,showWhen:({model:e})=>e.doc.schema.flavourSchemaMap.has("affine:embed-loom")&&!mb(e),action:async({rootComponent:e,model:t})=>{let i=e.doc.getParent(t);if(!i)return;let s=i.children.indexOf(t)+1;await gO(e.host,"Loom","The added Loom video link will be displayed as an embed view.",{mode:"page",parentModel:i,index:s}),m_(t)}},({model:e,rootComponent:t})=>{let{doc:i}=t,s=(0,gL.J)(i),o=i.getParent(e);if(!(o instanceof ue.N)||!s)return[];let r=[...i.getBlocksByFlavour("affine:frame").map(e=>e.model).map(t=>({name:"Frame: "+t.title,icon:G.H0W,showWhen:()=>!mb(e),action:()=>{let s=o.children.indexOf(e),r={flavour:"affine:surface-ref",reference:t.id,refFlavour:"affine:frame"};i.addSiblingBlocks(e,[r],0===s?"before":"after"),(0,O.op)(e,["affine:paragraph"])&&0===e.text.length&&i.deleteBlock(e)}})),...Array.from(s.elements.getValue()?.values()??[]).filter(e=>e.get("type")===v.J9.GROUP).map(i=>({name:"Group: "+i.get("title"),icon:gP.GroupingIcon,action:()=>{let{doc:s}=t,o=s.getParent(e).children.indexOf(e),r={flavour:"affine:surface-ref",reference:i.get("id"),refFlavour:"group"};s.addSiblingBlocks(e,[r],0===o?"before":"after"),(0,O.op)(e,["affine:paragraph"])&&0===e.text.length&&s.deleteBlock(e)}}))];return 0!==r.length?[{groupName:"Document Group & Frame"},...r]:[]},{groupName:"Date"},()=>{let e=new Date,t=new Date,i=new Date;return i.setDate(i.getDate()-1),t.setDate(t.getDate()+1),[{name:"Today",icon:G.FlE,tooltip:md.Today,description:mv(e),action:({rootComponent:t,model:i})=>{mm(t.host,i,mv(e))}},{name:"Tomorrow",icon:G.t5i,tooltip:md.Tomorrow,description:mv(t),action:({rootComponent:e,model:t})=>{let i=new Date;i.setDate(i.getDate()+1),mm(e.host,t,mv(i))}},{name:"Yesterday",icon:G.cqr,tooltip:md.Yesterday,description:mv(i),action:({rootComponent:e,model:t})=>{let i=new Date;i.setDate(i.getDate()-1),mm(e.host,t,mv(i))}},{name:"Now",icon:G.mjz,tooltip:md.Now,description:my(e),action:({rootComponent:t,model:i})=>{mm(t.host,i,my(e))}}]},{groupName:"Database"},{name:"Table View",description:"Display items in a table format.",alias:["database"],icon:G.yni,tooltip:md["Table View"],showWhen:({model:e})=>e.doc.schema.flavourSchemaMap.has("affine:database")&&!mb(e)&&!mw(e),action:({rootComponent:e,model:t})=>{let i=mx(t);i&&(e.std.spec.getService("affine:database").initDatabaseBlock(e.doc,t,i,N.q_.tableViewConfig,!1),m_(t))}},{name:"Todo",alias:["todo view"],icon:G.yni,tooltip:md.Todo,showWhen:({model:e})=>e.doc.schema.flavourSchemaMap.has("affine:database")&&!mb(e)&&!mw(e)&&!!e.doc.awarenessStore.getFlag("enable_block_query"),action:({model:e,rootComponent:t})=>{let i=t.doc.getParent(e);if(!i)return;let s=i.children.indexOf(e),o=t.doc.addBlock("affine:data-view",{},t.doc.getParent(e),s+1),r=t.doc.getBlock(o);Promise.resolve().then(()=>{(0,O.X7)(t.host,r.model.id).dataSource.viewDataAdd("table")}),m_(e)}},{name:"Kanban View",description:"Visualize data in a dashboard.",alias:["database"],icon:G.fNc,tooltip:md["Kanban View"],showWhen:({model:e})=>e.doc.schema.flavourSchemaMap.has("affine:database")&&!mb(e)&&!mw(e),action:({model:e,rootComponent:t})=>{let i=mx(e);i&&(t.std.spec.getService("affine:database").initDatabaseBlock(t.doc,e,i,N.q_.kanbanViewConfig,!1),m_(e))}},{groupName:"Actions"},{name:"Move Up",description:"Shift this line up.",icon:G.cEz,tooltip:md["Move Up"],action:({rootComponent:e,model:t})=>{let i=e.doc,s=i.getPrev(t);if(!s)return;let o=i.getParent(s);o&&i.moveBlocks([t],o,s,!0)}},{name:"Move Down",description:"Shift this line down.",icon:G.Tje,tooltip:md["Move Down"],action:({rootComponent:e,model:t})=>{let i=e.doc,s=i.getNext(t);if(!s)return;let o=i.getParent(s);o&&i.moveBlocks([t],o,s,!1)}},{name:"Copy",description:"Copy this line to clipboard.",icon:G.vrT,tooltip:md.Copy,action:({rootComponent:e,model:t})=>{let i=f.Ji.fromModels(e.std.doc,[t]);e.std.clipboard.copy(i).then(()=>{(0,e5.o)(e.host,"Copied to clipboard")}).catch(e=>{console.error(e)})}},{name:"Duplicate",description:"Create a duplicate of this line.",icon:G.TdU,tooltip:md.Copy,action:({rootComponent:e,model:t})=>{if(!t.text||!(t.text instanceof f.EY)){console.error("Can't duplicate a block without text");return}let i=e.doc.getParent(t);if(!i){console.error("Failed to duplicate block! Parent not found: "+t.id+"|"+t.flavour);return}let s=i.children.indexOf(t);e.doc.addBlock(t.flavour,{type:t.type,text:e.doc.Text.fromDelta(t.text.toDelta()),checked:t.checked},e.doc.getParent(t),s)}},{name:"Delete",description:"Remove this line permanently.",alias:["remove"],icon:G.d7y,tooltip:md.Delete,action:({rootComponent:e,model:t})=>{e.doc.deleteBlock(t)}}]},mS=(0,L.AH)` .overlay-mask { pointer-events: auto; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: var(--affine-z-index-popover); } .slash-menu { position: fixed; left: 0; top: 0; box-sizing: border-box; padding: 8px 4px 8px 8px; width: 258px; overflow-y: auto; font-family: ${(0,L.iz)(iW.$7.fontSansFamily)}; background: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-shadow-2); border-radius: 8px; z-index: var(--affine-z-index-popover); user-select: none; /* transition: max-height 0.2s ease-in-out; */ } ${(0,aL.kM)(".slash-menu")} .slash-menu-group-name { box-sizing: border-box; padding: 2px 8px; font-size: var(--affine-font-xs); font-weight: 500; line-height: var(--affine-line-height); text-align: left; color: var( --light-textColor-textSecondaryColor, var(--textColor-textSecondaryColor, #8e8d91) ); } .slash-menu-item { padding: 2px 8px 2px 8px; justify-content: flex-start; gap: 10px; } .slash-menu-item-icon { box-sizing: border-box; width: 28px; height: 28px; padding: 4px; border: 1px solid var(--affine-border-color, #e3e2e4); border-radius: 4px; color: var(--affine-icon-color); background: var(--affine-background-overlay-panel-color); display: flex; justify-content: center; align-items: center; } .slash-menu-item-icon svg { display: block; } .slash-menu-item.ask-ai { color: var(--affine-brand-color); } .slash-menu-item.github .github-icon { color: var(--affine-black); } `,mM=(0,L.AH)` .affine-tooltip { display: flex; padding: 4px 4px 2px 4px; flex-direction: column; align-items: flex-start; gap: 3px; } .tooltip-figure svg { display: block; } .tooltip-caption { padding-left: 4px; color: var( --light-textColor-textSecondaryColor, var(--textColor-textSecondaryColor, #8e8d91) ); font-family: var(--affine-font-family); font-size: var(--affine-font-xs); line-height: var(--affine-line-height); } `;var mE=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},mI=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("affine-slash-menu")],c=[],d=(0,P.Tm)(L.WF),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];return class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.P)("inner-slash-menu")],n=[(0,D.MZ)({attribute:!1})],mE(this,null,i,{kind:"accessor",name:"_filteredItems",static:!1,private:!1,access:{has:e=>"_filteredItems"in e,get:e=>e._filteredItems,set:(e,t)=>{e._filteredItems=t}},metadata:C},h,u),mE(this,null,s,{kind:"accessor",name:"_position",static:!1,private:!1,access:{has:e=>"_position"in e,get:e=>e._position,set:(e,t)=>{e._position=t}},metadata:C},p,f),mE(this,null,o,{kind:"accessor",name:"config",static:!1,private:!1,access:{has:e=>"config"in e,get:e=>e.config,set:(e,t)=>{e.config=t}},metadata:C},g,m),mE(this,null,r,{kind:"accessor",name:"context",static:!1,private:!1,access:{has:e=>"context"in e,get:e=>e.context,set:(e,t)=>{e.context=t}},metadata:C},v,y),mE(this,null,a,{kind:"accessor",name:"slashMenuElement",static:!1,private:!1,access:{has:e=>"slashMenuElement"in e,get:e=>e.slashMenuElement,set:(e,t)=>{e.slashMenuElement=t}},metadata:C},b,w),mE(this,null,n,{kind:"accessor",name:"triggerKey",static:!1,private:!1,access:{has:e=>"triggerKey"in e,get:e=>e.triggerKey,set:(e,t)=>{e.triggerKey=t}},metadata:C},x,_),mE(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}static{this.styles=mS}constructor(e,t=new AbortController){super(),this.inlineEditor=e,this.abortController=t,this._handleClickItem=e=>{(0,aL.m7)(this.host,this.context.model,this.triggerKey+(this._query||"")),e.action(this.context)?.catch(console.error),this.abortController.abort()},this._initItemPathMap=()=>{let e=(t,i)=>{this._itemPathMap.set(t,[...i]),mf(t)&&t.subMenu.forEach((t,s)=>e(t,[...i,s]))};this.config.items.forEach((t,i)=>e(t,[i]))},this._itemPathMap=new Map,this._queryState="off",this._startRange=this.inlineEditor.getInlineRange(),this._updateFilteredItems=()=>{let e=this._query;if(null===e){this.abortController.abort();return}this._filteredItems=[];let t=e.toLowerCase();if(""===t||t.endsWith(" ")){this._queryState=""===t?"off":"no_result";return}let i=0,s=this.config.items.filter(mu);for(;0!==s.length&&(this._filteredItems=this._filteredItems.filter(e=>!mf(e)),this._filteredItems=this._filteredItems.concat(s.filter(({name:e,alias:i=[]})=>[e,...i].some(e=>s7(e,t)))),0===this._filteredItems.length||!(i>=1));)s=s.map(e=>mf(e)?e.subMenu.filter(mu):[]).flat(),i++;this._filteredItems=this._filteredItems.sort((e,i)=>-(s3(e.name,t)-s3(i.name,t))),this._queryState=0===this._filteredItems.length?"no_result":"on"},this.updatePosition=e=>{this._position=e},this.#n9=mI(this,h,[]),this.#at=(mI(this,u),mI(this,p,null)),this.#th=(mI(this,f),mI(this,g,void 0)),this.#le=(mI(this,m),mI(this,v,void 0)),this.#lt=(mI(this,y),mI(this,b,void 0)),this.#li=(mI(this,w),mI(this,x,void 0)),mI(this,_),this.inlineEditor=e,this.abortController=t}get _query(){return(0,aL.$Z)(this.inlineEditor,this._startRange)}connectedCallback(){super.connectedCallback(),this._innerSlashMenuContext={...this.context,onClickItem:this._handleClickItem,tooltipTimeout:this.config.tooltipTimeout},this._initItemPathMap(),this._disposables.addFromEvent(this,"mousedown",e=>{e.preventDefault()});let e=this.inlineEditor;if(!e||!e.eventSource){console.error("inlineEditor or eventSource is not found");return}(0,aL._p)({target:e.eventSource,signal:this.abortController.signal,inlineEditor:this.inlineEditor,interceptor:(e,t)=>{let{key:i,isComposing:s,code:o}=e;if(i!==this.triggerKey&&("Process"!==i||s||"Slash"!==o)){if("Backspace"!==i&&"no_result"===this._queryState){this.abortController.abort();return}"ArrowRight"!==i&&"ArrowLeft"!==i&&"Escape"!==i&&t()}},onInput:()=>this._updateFilteredItems(),onPaste:()=>{setTimeout(()=>this._updateFilteredItems(),20)},onDelete:()=>{let e=this.inlineEditor.getInlineRange();this._startRange&&e&&(e.indexthis.abortController.abort()})}render(){let e=this._position?{transform:`translate(${this._position.x}, ${this._position.y})`,maxHeight:`${Math.min(this._position.height,this.config.maxHeight)}px`}:{visibility:"hidden"};return(0,L.qy)`${"no_result"!==this._queryState?(0,L.qy)`
    `:L.s6} `}get host(){return this.context.rootComponent.host}#n9;get _filteredItems(){return this.#n9}set _filteredItems(e){this.#n9=e}#at;get _position(){return this.#at}set _position(e){this.#at=e}#th;get config(){return this.#th}set config(e){this.#th=e}#le;get context(){return this.#le}set context(e){this.#le=e}#lt;get slashMenuElement(){return this.#lt}set slashMenuElement(e){this.#lt=e}#li;get triggerKey(){return this.#li}set triggerKey(e){this.#li=e}static{mI(t,c)}},t})();(()=>{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("inner-slash-menu")],c=[],d=(0,P.Tm)(L.WF),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];(class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],mE(this,null,i,{kind:"accessor",name:"_activeItem",static:!1,private:!1,access:{has:e=>"_activeItem"in e,get:e=>e._activeItem,set:(e,t)=>{e._activeItem=t}},metadata:C},h,u),mE(this,null,s,{kind:"accessor",name:"abortController",static:!1,private:!1,access:{has:e=>"abortController"in e,get:e=>e.abortController,set:(e,t)=>{e.abortController=t}},metadata:C},p,f),mE(this,null,o,{kind:"accessor",name:"context",static:!1,private:!1,access:{has:e=>"context"in e,get:e=>e.context,set:(e,t)=>{e.context=t}},metadata:C},g,m),mE(this,null,r,{kind:"accessor",name:"depth",static:!1,private:!1,access:{has:e=>"depth"in e,get:e=>e.depth,set:(e,t)=>{e.depth=t}},metadata:C},v,y),mE(this,null,a,{kind:"accessor",name:"mainMenuStyle",static:!1,private:!1,access:{has:e=>"mainMenuStyle"in e,get:e=>e.mainMenuStyle,set:(e,t)=>{e.mainMenuStyle=t}},metadata:C},b,w),mE(this,null,n,{kind:"accessor",name:"menu",static:!1,private:!1,access:{has:e=>"menu"in e,get:e=>e.menu,set:(e,t)=>{e.menu=t}},metadata:C},x,_),mE(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}static{this.styles=mS}_scrollToItem(e){let t=this.shadowRoot;if(!t)return;let i=mh(e)?e.groupName:e.name,s=t.querySelector(`icon-button[text="${i}"]`);s&&s.scrollIntoView({block:"nearest"})}connectedCallback(){super.connectedCallback(),this.abortController?.signal?.addEventListener("abort",()=>{this._subMenuAbortController?.abort()}),this.addEventListener("wheel",e=>{this._currentSubMenu&&e.preventDefault()});let e=(0,O.h9)(this.context.rootComponent.host,this.context.model);if(!e||!e.eventSource){console.error("inlineEditor or eventSource is not found");return}e.eventSource.addEventListener("keydown",e=>{if(this._currentSubMenu||e.isComposing)return;let{key:t,ctrlKey:i,metaKey:s,altKey:o,shiftKey:r}=e,a=(i||s)&&!o&&!r,n=r&&!(0,O.QI)(e),l=!(i||s||o||r),c=0;if(("ArrowUp"===t&&l||"Tab"===t&&n||"P"===t&&a||"p"===t&&a)&&(c=-1),("ArrowDown"===t&&l||"Tab"===t&&l||"n"===t&&a||"N"===t&&a)&&(c=1),0!==c){let t=this.menu.indexOf(this._activeItem);do t=(t+c+this.menu.length)%this.menu.length;while(mh(this.menu[t]))this._activeItem=this.menu[t],this._scrollToItem(this._activeItem),e.preventDefault(),e.stopPropagation()}"ArrowRight"===t&&l&&(mf(this._activeItem)&&this._openSubMenu(this._activeItem),e.preventDefault(),e.stopPropagation()),("ArrowLeft"===t||"Escape"===t)&&l&&(this.abortController.abort(),e.preventDefault(),e.stopPropagation()),"Enter"===t&&l&&(mf(this._activeItem)?this._openSubMenu(this._activeItem):mp(this._activeItem)&&this.context.onClickItem(this._activeItem),e.preventDefault(),e.stopPropagation())},{capture:!0,signal:this.abortController.signal})}disconnectedCallback(){this.abortController.abort()}render(){if(0===this.menu.length)return L.s6;let e=(0,Z.W)(this.mainMenuStyle??{position:"relative"});return(0,L.qy)`
    ${this.menu.map(this._renderItem)}
    `}willUpdate(e){if(e.has("menu")&&0!==this.menu.length){let e=function(e){let t=e.find(e=>!mh(e));return(0,H.j)(t),t??null}(this.menu);(0,H.Z1)(e),this._activeItem=e,this._subMenuAbortController?.abort()}}#ls;get _activeItem(){return this.#ls}set _activeItem(e){this.#ls=e}#_;get abortController(){return this.#_}set abortController(e){this.#_=e}#le;get context(){return this.#le}set context(e){this.#le=e}#tK;get depth(){return this.#tK}set depth(e){this.#tK=e}#lo;get mainMenuStyle(){return this.#lo}set mainMenuStyle(e){this.#lo=e}#nq;get menu(){return this.#nq}set menu(e){this.#nq=e}constructor(){super(...arguments),this._closeSubMenu=()=>{this._subMenuAbortController?.abort(),this._subMenuAbortController=null,this._currentSubMenu=null},this._currentSubMenu=null,this._openSubMenu=e=>{if(e===this._currentSubMenu)return;let t=this.shadowRoot?.querySelector(`.${mg(e)}`);if(!t)return;this._closeSubMenu(),this._currentSubMenu=e,this._subMenuAbortController=new AbortController,this._subMenuAbortController.signal.addEventListener("abort",()=>{this._closeSubMenu()});let i=(0,sB.cl)({shadowDom:!1,template:(0,L.qy)` ${e.subMenu.map(this._renderItem)} `,computePosition:{referenceElement:t,autoUpdate:!0,middleware:[(0,sI.cY)(12),(0,sI.RK)({allowedPlacements:["right-start","right-end"]})]},abortController:this._subMenuAbortController});i.style.zIndex=`calc(var(--affine-z-index-popover) + ${this.depth})`,i.focus()},this._renderActionItem=e=>{let{name:t,icon:i,description:s,tooltip:o,customTemplate:r}=e,a=e===this._activeItem;return(0,L.qy)`{this._activeItem=e,this._closeSubMenu()}} @click=${()=>this.context.onClickItem(e)} > ${i&&(0,L.qy)`
    ${i}
    `} ${o&&(0,L.qy)`
    ${o.figure}
    ${o.caption}
    `}
    `},this._renderGroupItem=e=>(0,L.qy)`
    ${e.groupName}
    `,this._renderItem=e=>mh(e)?this._renderGroupItem(e):mp(e)?this._renderActionItem(e):mf(e)?this._renderSubMenuItem(e):(console.error("Unknown item type for slash menu"),console.error(e),L.s6),this._renderSubMenuItem=e=>{let{name:t,icon:i,description:s}=e,o=e===this._activeItem;return(0,L.qy)`{this._activeItem=e,this._openSubMenu(e)}} @touchstart=${()=>{mf(e)&&(this._currentSubMenu===e?this._closeSubMenu():this._openSubMenu(e))}} > ${i&&(0,L.qy)`
    ${i}
    `}
    ${G.ZLN}
    `},this._subMenuAbortController=null,this.#ls=mI(this,h,void 0),this.#_=(mI(this,u),mI(this,p,void 0)),this.#le=(mI(this,f),mI(this,g,void 0)),this.#tK=(mI(this,m),mI(this,v,0)),this.#lo=(mI(this,y),mI(this,b,null)),this.#nq=(mI(this,w),mI(this,x,void 0)),mI(this,_)}static{mI(t,c)}})})();var m$=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},mT=function(e,t,i){for(var s=arguments.length>2,o=0;o{mO=s;let a=new eg.K;s.signal.addEventListener("abort",()=>a.dispose());let n=(0,O.h9)(e.rootComponent.host,e.model);if(!n)return;let l=new mB(n,s);a.add(()=>l.remove()),l.context=e,l.config=o,l.triggerKey=r;let c=(0,td.nF)(()=>{let e=l.slashMenuElement;(0,H.Z1)(e,"You should render the slash menu node even if no position");let i=hp(e,t);l.updatePosition(i)},10);return a.addFromEvent(window,"resize",c),i.append(l),setTimeout(c),l},100),mH="affine-slash-menu-widget",mA=(()=>{let e,t,i=[(0,D.EM)(mH)],s=[],o=P.W;var r=class extends o{static{t=this}constructor(){super(...arguments),this._onBeforeInput=e=>{let t=e.get("defaultState").event.data;if(!t||!this.config.triggerKeys.includes(t))return;let i=this.host.selection.find("text");if(!i)return;let s=this.host.doc.getBlock(i.blockId);(0,H.Z1)(s);let{model:o}=s;if((0,O.op)(o,this.config.ignoreBlockTypes))return;let r=(0,O.h9)(this.host,o);r&&r.slots.inlineRangeApply.once(()=>{let e=this.block;if(!iO(e)){console.error("SlashMenuWidget should be used in RootBlock");return}let i={...this.config,items:function e(t,i){return t.map(e=>"function"==typeof e?e(i):e).flat().filter(e=>!e.showWhen||e.showWhen(i)).map(t=>mf(t)?{...t,subMenu:e(t.subMenu,i)}:{...t})}(this.config.items,{model:o,rootComponent:e})};requestAnimationFrame(()=>{let s=(0,O.oV)();s&&(mO.abort(),mP({context:{model:o,rootComponent:e},range:s,triggerKey:t,config:i}))})})},this.config=r.DEFAULT_CONFIG}static{let a="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;m$(null,e={value:t},i,{kind:"class",name:t.name,metadata:a},null,s),r=t=e.value,a&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:a})}static{this.DEFAULT_CONFIG=mk}connectedCallback(){if(super.connectedCallback(),this.config.triggerKeys.some(e=>0===e.length)){console.error("Trigger key of slash menu should not be empty string");return}this.handleEvent("beforeInput",this._onBeforeInput)}static{mT(t,s)}};return r=t})(),mL=async(e,t)=>{let{edgelessElement:i,surfaceRefBlock:s}=t,o=e.spec.getService("affine:page").exportManager,r=p.z.deserialize(i.xywh),a=(0,tE.Te)(i);return o.edgelessToCanvas(t.surfaceRenderer,r,e=>(0,of.Au)(e,s.host.view),void 0,a?[i]:void 0,a?void 0:[i],{zoom:t.surfaceRenderer.viewport.zoom}).then(e=>((0,H.Z1)(e),new Promise((t,i)=>{e.toBlob(e=>e?t(e):i(null),"image/png")})))},mD=async e=>{window.apis?.clipboard?.copyAsImageFromString?await window.apis.clipboard?.copyAsImageFromString(e):await navigator.clipboard.write([new ClipboardItem({[e.type]:e})])};var mZ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},mj=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-surface-ref-toolbar")],s=[],o=P.W;(class extends o{static{t=this}constructor(){super(...arguments),this._hoverController=new n5.n(this,({abortController:e})=>{let t=this.block,i=this.host.selection,s=i.find("text");if(s&&(s.to||s.from.length))return null;let o=i.filter("block");return o.length>1||1===o.length&&o[0].blockId!==t.blockId?null:{template:function(e){let{block:t,model:i,abortController:s}=e,o=i.doc.readonly,r=!!t.referenceModel,a=[];r&&(a.push({name:"Open in edgeless",icon:sm.d3,handler:()=>t.viewInEdgeless(),disabled:o}),(0,ri.mV)(t)&&a.push({name:"Open in center peek",icon:sv.KR,handler:()=>(0,ri.se)(t)}));let n=[r?[{type:"copy",name:"Copy",icon:sv.Td,handler:()=>{if(!t.referenceModel||!t.doc.root)return;let e=t.previewEditor,i=e?.view.getBlock(t.doc.root.id),s=i?.surface?.renderer;mL(t.host,{surfaceRefBlock:t,surfaceRenderer:s,edgelessElement:t.referenceModel}).then(e=>mD(e)).then(()=>{(0,e5.o)(t.host,"Copied image to clipboard")}).catch(e=>{console.error(e)})}},{type:"download",name:"Download",icon:sv.s3,handler:()=>{if(!t.referenceModel||!t.doc.root)return;let e=t.referenceModel,i=t.previewEditor,s=i?.view.getBlock(t.doc.root.id),o=s?.surface?.renderer;mL(t.host,{surfaceRefBlock:t,surfaceRenderer:o,edgelessElement:e}).then(t=>{let i="title"in e?e.title?.toString()??"Edgeless Content":"Edgeless Content";(0,lb.WN)(t,i)}).catch(e=>{console.error(e)})}}]:[],[{type:"delete",name:"Delete",icon:sv.d7,disabled:o,handler:()=>{i.doc.deleteBlock(i),s.abort()}}]],l=[a.length?(0,L.qy)` ${sv.gb}${sm.eo} `} >
    ${(0,t$.u)(a,e=>e.name,({name:e,icon:t,handler:i,disabled:s})=>(0,L.qy)` ${t}${e} `)}
    `:L.s6,o?L.s6:(0,L.qy)` {s.abort(),t.captionElement.show()}} > ${sv.IT} `,(0,L.qy)` ${sm.FH} `} >
    ${ad(n)}
    `];return(0,L.qy)` ${(0,sj.f)(l.filter(e=>e!==L.s6),an)} `}({block:this.block,model:this.block.model,abortController:e}),computePosition:{referenceElement:this.block,placement:"top-start",middleware:[(0,sI.cY)({mainAxis:12,crossAxis:10}),(0,sI.BN)({crossAxis:!0,padding:{top:eh.Et+12,bottom:12,right:12}})],autoUpdate:!0}}})}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;mZ(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),mj(t,s)}connectedCallback(){super.connectedCallback(),this._hoverController.setReference(this.block)}})})();var mV=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},mz=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("affine-edgeless-root-preview")],n=[],l=P.p_,c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.P)(".edgeless-background")],s=[(0,D.wk)()],o=[(0,D.P)(".edgeless-layer")],r=[(0,D.P)("affine-surface")],mV(this,null,i,{kind:"accessor",name:"background",static:!1,private:!1,access:{has:e=>"background"in e,get:e=>e.background,set:(e,t)=>{e.background=t}},metadata:v},c,d),mV(this,null,s,{kind:"accessor",name:"editorViewportSelector",static:!1,private:!1,access:{has:e=>"editorViewportSelector"in e,get:e=>e.editorViewportSelector,set:(e,t)=>{e.editorViewportSelector=t}},metadata:v},h,u),mV(this,null,o,{kind:"accessor",name:"layer",static:!1,private:!1,access:{has:e=>"layer"in e,get:e=>e.layer,set:(e,t)=>{e.layer=t}},metadata:v},p,f),mV(this,null,r,{kind:"accessor",name:"surface",static:!1,private:!1,access:{has:e=>"surface"in e,get:e=>e.surface,set:(e,t)=>{e.surface=t}},metadata:v},g,m),mV(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` affine-edgeless-root { -webkit-user-select: none; user-select: none; display: block; height: 100%; } .widgets-container { position: absolute; left: 0; top: 0; contain: size layout; z-index: 1; height: 100%; } .edgeless-background { height: 100%; background-color: var(--affine-background-primary-color); background-image: radial-gradient( var(--affine-edgeless-grid-color) 1px, var(--affine-background-primary-color) 1px ); } .edgeless-layer { position: absolute; top: 0; left: 0; contain: size layout style; } @media print { .selected { background-color: transparent !important; } } `}_getLayerViewport(e=!1){let{translateX:t,translateY:i,zoom:s}=this.service.viewport;return e?`scale(${1/s}) translate(${-t}px, ${-i}px)`:`translate(${t}px, ${i}px) scale(${s})`}_initFontLoader(){let e=this.service?.fontLoader;(0,H.Z1)(e),e.ready.then(()=>{this.surface.refresh()}).catch(console.error)}_initPixelRatioChangeEffect(){let e;let t=()=>{e&&(this.service.viewport.onResize(),e.removeEventListener("change",t)),(e=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`)).addEventListener("change",t)};t(),this._disposables.add(()=>{e?.removeEventListener("change",t)})}_initResizeEffect(){if(!this._viewportElement)return;let e=new ResizeObserver(e=>{if(!this.service||!this.service.selection||!this.service.viewport){console.error("Service not ready");return}this.service.selection.set(this.service.selection.surfaceSelections),this.service.viewport.onResize()});e.observe(this.viewportElement),this._resizeObserver?.disconnect(),this._resizeObserver=e}_initSlotEffects(){let{disposables:e}=this;this.disposables.add(this.service.themeObserver.mode$.subscribe(()=>this.surface.refresh())),e.add(this.service.selection)}_initViewport(){this.service.viewport.setContainer(this)}connectedCallback(){super.connectedCallback(),this.handleEvent("selectionChange",()=>{let e=this.host.selection.value.find(e=>e.is("surface"));if(!e)return;let t=this.service.getElementById(e.elements[0]);if((0,tE.r0)(t))return!0})}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}firstUpdated(){this._initSlotEffects(),this._initResizeEffect(),this._initPixelRatioChangeEffect(),this._initFontLoader(),this._initViewport(),this._disposables.add(this.service.viewport.viewportUpdated.on(()=>{this._refreshLayerViewport()})),this._refreshLayerViewport()}getElementsBound(){let{service:e}=this;return tS([...e.elements,...e.blocks])}renderBlock(){return(0,L.qy)`
    ${this.renderChildren(this.model)}${this.renderChildren(this.surfaceBlockModel)}
    `}willUpdate(e){e.has("editorViewportSelector")&&this._initResizeEffect()}get dispatcher(){return this.service?.uiEventDispatcher}get surfaceBlockModel(){return this.model.children.find(e=>"affine:surface"===e.flavour)}get viewportElement(){return this._viewportElement||(this._viewportElement=this.host.closest(this.editorViewportSelector),(0,H.Z1)(this._viewportElement)),this._viewportElement}#rR;get background(){return this.#rR}set background(e){this.#rR=e}#lr;get editorViewportSelector(){return this.#lr}set editorViewportSelector(e){this.#lr=e}#la;get layer(){return this.#la}set layer(e){this.#la=e}#nV;get surface(){return this.#nV}set surface(e){this.#nV=e}constructor(){super(...arguments),this._refreshLayerViewport=(0,O.GR)(()=>{let{zoom:e,translateX:t,translateY:i}=this.service.viewport,{gap:s}=(0,tE.p1)(e,!0);this.background.style.setProperty("background-position",`${t}px ${i}px`),this.background.style.setProperty("background-size",`${s}px ${s}px`),this.layer.style.setProperty("transform",this._getLayerViewport()),this.layer.dataset.scale=e.toString()},this),this._resizeObserver=null,this._viewportElement=null,this.#rR=mz(this,c,void 0),this.#lr=(mz(this,d),mz(this,h,".affine-edgeless-viewport")),this.#la=(mz(this,u),mz(this,p,void 0)),this.#nV=(mz(this,f),mz(this,g,void 0)),mz(this,m)}static{mz(t,n)}})})();var mR=i(9292);class mF{constructor(e){this._activeGroup=null,this._cursorSelection=null,this._lastSurfaceSelections=[],this._remoteCursorSelectionMap=new Map,this._remoteSelectedSet=new Set,this._remoteSurfaceSelectionsMap=new Map,this._selectedSet=new Set,this._surfaceSelections=[],this.disposable=new eg.K,this.slots={updated:new a2.D,remoteUpdated:new a2.D,cursorUpdated:new a2.D,remoteCursorUpdated:new a2.D},this.service=e,this.surfaceModel=e.surface,this.mount()}clear(){this.stdSelectionManager.clear(),this.set({elements:[],editing:!1})}clearLast(){this._lastSurfaceSelections=[]}dispose(){this.disposable.dispose()}equals(e){let t=0,i=!1;return e.every(e=>{let s=e.elements.every(e=>this._selectedSet.has(e));return s&&(t+=e.elements.length),e.editing&&(i=!0),s})&&t===this._selectedSet.size&&i===this.editing}has(e){return this._selectedSet.has(e)}hasRemote(e){return this._remoteSelectedSet.has(e)}isEmpty(e){return e.every(e=>0===e.elements.length)}isInSelectedRect(e,t){let i=this.selectedElements;if(!i.length)return!1;let s=tS(i),[o,r]=this.service.viewport.toModelCoord(e,t);return!!(s&&s.isPointInBound([o,r]))}mount(){this.disposable.add(this.stdSelectionManager.slots.changed.on(e=>{let{cursor:t=[],surface:i=[]}=(0,sk.$z)(e,e=>e.is("surface")?"surface":e.is("cursor")?"cursor":"none");(0,H.j)(t),(0,H.j)(i),t[0]&&!this.cursorSelection?.equals(t[0])&&(this._cursorSelection=t[0],this.slots.cursorUpdated.emit(t[0])),0===i.length&&this.empty||this.equals(i)||(this._lastSurfaceSelections=this.surfaceSelections,this._surfaceSelections=i,this._selectedSet=new Set,i.forEach(e=>e.elements.forEach(e=>{this._selectedSet.add(e)})),this.slots.updated.emit(this.surfaceSelections))})),this.disposable.add(this.stdSelectionManager.slots.remoteChanged.on(e=>{let t=new Map,i=new Map,s=new Set;e.forEach((e,o)=>{let r=!1,a=!1;e.forEach(e=>{if(e.is("text")&&(r=!0),e.is("block")&&(a=!0),e.is("surface")){let i=t.get(o)??[];i.push(e),t.set(o,i),e.elements.forEach(e=>s.add(e))}e.is("cursor")&&i.set(o,e)}),(a||r)&&t.delete(o),r&&i.delete(o)}),this._remoteCursorSelectionMap=i,this._remoteSurfaceSelectionsMap=t,this._remoteSelectedSet=s,this.slots.remoteUpdated.emit(),this.slots.remoteCursorUpdated.emit()}))}set(e){if(Array.isArray(e)){this.stdSelectionManager.setGroup("gfx",this.cursorSelection?[...e,this.cursorSelection]:e);return}let{blocks:t=[],elements:i=[]}=(0,sk.$z)(e.elements,e=>this.service.doc.getBlockById(e)?"blocks":"elements"),s=[];i.length>0&&s.push(this.stdSelectionManager.create("surface",this.surfaceModel.id,i,e.editing,e.inoperable)),t.length>0&&(s=s.concat(t.map(t=>this.stdSelectionManager.create("surface",t,[t],e.editing,e.inoperable)))),this.stdSelectionManager.setGroup("gfx",this.cursorSelection?s.concat([this.cursorSelection]):s),s.length>0&&this.stdSelectionManager.setGroup("note",[]),1===e.elements.length&&(this.firstElement instanceof v.$f||this.firstElement instanceof ut.AR)?this._activeGroup=this.firstElement:(this.selectedElements.some(e=>e.group!==this._activeGroup)||0===this.selectedElements.length)&&(this._activeGroup=null)}setCursor(e){let t=this.stdSelectionManager.create("cursor",e.x,e.y);this.stdSelectionManager.setGroup("gfx",[...this.surfaceSelections,t])}get activeGroup(){return this._activeGroup}get cursorSelection(){return this._cursorSelection}get editing(){return this.surfaceSelections.some(e=>e.editing)}get empty(){return this.surfaceSelections.every(e=>0===e.elements.length)}get firstElement(){return this.selectedElements[0]}get inoperable(){return this.surfaceSelections.some(e=>e.inoperable)}get lastSurfaceSelections(){return this._lastSurfaceSelections}get remoteCursorSelectionMap(){return this._remoteCursorSelectionMap}get remoteSelectedSet(){return this._remoteSelectedSet}get remoteSurfaceSelectionsMap(){return this._remoteSurfaceSelectionsMap}get selectedBound(){return tS(this.selectedElements)}get selectedElements(){let e=[];return this.selectedIds.forEach(t=>{let i=this.service.getElementById(t);i&&e.push(i)}),e}get selectedIds(){return[...this._selectedSet]}get selectedSet(){return this._selectedSet}get stdSelectionManager(){return this.service.std.selection}get surfaceSelections(){return this._surfaceSelections}}let mN=["affine:surface","affine:surface-ref"],mq=["affine:surface","affine:page"],mU=["template","sticker"];class mW{static{this.middlewares=[]}constructor({model:e,type:t,middlewares:i}){this._template=null,this.slots={beforeInsert:new a2.D},this.job=new f._O({collection:e.doc.collection,middlewares:[]}),this.model=e,this.type=mU.includes(t)?t:"template",i.forEach(e=>e(this)),mW.middlewares.forEach(e=>e(this))}static create(e){return new mW(e)}_getMergeBlockId(e){switch(e.flavour){case"affine:page":return this.model.doc.root.id;case"affine:surface":return this.model.id}}_getTemplateBound(){let e=[];return this.walk(t=>{if(t.props.xywh&&e.push(p.z.deserialize(t.props.xywh)),"affine:surface"===t.flavour){let i=["connector","group"];Object.entries(t.props.elements).forEach(([t,s])=>{let o=s.type;s.xywh&&!i.includes(o)&&e.push(p.z.deserialize(s.xywh)),"connector"===o&&["target","source"].forEach(t=>{let i=s[t];if((0,H.j)(i),i.id||!i.position)return;let o=i.position;o&&e.push(new p.z(o[0],o[1],0,0))})})}}),(0,v.ql)(e)}_insertToDoc(e){let t=this.model.doc,i=new Map,s=[],o=(e,o=!0)=>{let{flavour:r,json:a,modelData:n,parent:l,index:c}=e,d=mq.includes(r);if(d&&i.set(a.id,this._getMergeBlockId(a)),o&&mN.includes(r)){s.push(e);return}if(d){this._mergeProps(a,this.model.doc.getBlockById(this._getMergeBlockId(a)));return}(0,H.Z1)(n),t.addBlock(n.flavour,{...n.props,id:n.id},l?i.get(l)??l:void 0,c)};e.forEach(e=>o(e)),s.forEach(e=>o(e,!1))}async _jsonToModelData(e){let t=this.job,i=[],s=[],o=async(e,r,a,n=!0)=>{if(n&&mN.includes(e.flavour)){i.push({snapshot:e,parent:r,index:a});return}this.slots.beforeInsert.emit({type:"block",data:{blockJson:e,parent:r,index:a}});let l=mq.includes(e.flavour)?null:await t.snapshotToModelData(e)??null;if(s.push({flavour:e.flavour,json:e,modelData:l,parent:r,index:a}),e.children){let t=0;for(let i of e.children)await o(i,e.id,t),++t}};for(let t of(await o(e),i))await o(t.snapshot,t.parent,t.index,!1);return s}_mergeProps(e,t){switch(e.flavour){case"affine:page":break;case"affine:surface":this._mergeSurfaceElements(e.props.elements,t.elements.getValue())}}_mergeSurfaceElements(e,t){let i=this.model.doc.collection.schema.flavourSchemaMap.get("affine:surface"),s=i?.transformer?.();this.model.doc.transact(()=>{let i=[];Object.entries(e).forEach(([e,o])=>{["connector","group"].includes(o.type)?i.push([e,o]):t.set(e,s.elementFromJSON(o))}),i.forEach(([e,i])=>{t.set(e,s.elementFromJSON(i))})})}async insertTemplate(e){f.gE.parse(e),(0,H.j)(e),this._template=e;let t=this._getTemplateBound();this.slots.beforeInsert.emit({type:"template",template:e,bound:t});let i=await this._jsonToModelData(e.blocks);return this._insertToDoc(i),t}walk(e){if(!this._template)throw Error("Template not loaded, please call insertTemplate first");let t=(i,s)=>{e(i,s),i.children&&i.children.forEach(e=>t(e,s))};t(this._template.blocks,this._template)}}class mG{constructor(e){this._add=(e,t)=>{this._disposables.add(this.dispatcher.add(e,t))},this._controllers={},this._disposables=new eg.K,this._dragging=!1,this._edgelessTool=this._getToolFromLocalStorage(),this._lastMousePos={x:0,y:0},this._mounted=!1,this._onContainerClick=e=>this.currentController.onContainerClick(e),this._onContainerContextMenu=e=>{this.selection.editing||e.event.preventDefault()},this._onContainerDblClick=e=>this.currentController.onContainerDblClick(e),this._onContainerDragEnd=e=>{if((!this.doc.readonly||"pan"===this.edgelessTool.type)&&(2!==e.button||"pan"===this.edgelessTool.type||"copilot"===this.edgelessTool.type))return this.currentController.onContainerDragEnd(e)},this._onContainerDragMove=e=>{if((!this.doc.readonly||"pan"===this.edgelessTool.type)&&(2!==e.button||"pan"===this.edgelessTool.type||"copilot"===this.edgelessTool.type))return this.currentController.onContainerDragMove(e)},this._onContainerDragStart=e=>{if((!this.doc.readonly||"pan"===this.edgelessTool.type)&&(2!==e.button||"pan"===this.edgelessTool.type||"copilot"===this.edgelessTool.type))return this.currentController.onContainerDragStart(e)},this._onContainerPointerDown=e=>{let t=e.raw,i=ij.vL?t.metaKey:t.ctrlKey;if(!this.selection.editing&&((0,O.q5)(t)||(0,O.f9)(t)||i)){let s=(0,O.f9)(t),o=s||i?{type:"copilot"}:{type:"pan",panning:!0},r=this._edgelessTool,a=t=>(0,O.q5)(e.raw)&&!(0,O.q5)(t)||s&&!(0,O.f9)(t)||i,n=e=>{"copilot"!==o.type&&a(e)&&(this.setEdgelessTool(r,void 0,!s&&!i),document.removeEventListener("pointerup",n,!1),document.removeEventListener("pointerover",n,!1))};this.dispatcher.disposables.addFromEvent(document,"pointerup",n),this.setEdgelessTool(o);return}if(!this.doc.readonly)return this.currentController.onContainerPointerDown(e)},this._onContainerPointerMove=e=>(this._updateLastMousePos(e),this._controllers[this.edgelessTool.type].onContainerMouseMove(e)),this._onContainerPointerOut=e=>this._controllers[this.edgelessTool.type].onContainerMouseOut(e),this._onContainerPointerUp=e=>{},this._onContainerTripleClick=e=>this.currentController.onContainerTripleClick(e),this._shiftKey=!1,this._spaceBar=!1,this.setEdgelessTool=(e,t={elements:[],editing:!1},i=!0)=>{let{type:s}=e;if(this.doc.readonly&&"pan"!==s&&"frameNavigator"!==s||this.edgelessTool===e||this.currentController instanceof f$&&this.currentController.processing)return;let o=this.edgelessTool.type;if(this._controllers[o].beforeModeSwitch(e),this._controllers[s].beforeModeSwitch(e),!(!Array.isArray(t)&&t.editing)){let e="default"===s,r="lasso"===s,a="lasso"===o,n="copilot"===s,l="copilot"===o,c="default"===o,d=Array.isArray(t)?this.selection.isEmpty(t):0===t.elements.length,h=!!this.selection.lastSurfaceSelections,u=!(this.selection.lastSurfaceSelections&&this.selection.lastSurfaceSelections[0]&&1===this.selection.lastSurfaceSelections[0].elements.length&&this._isDocOnlyNote(this.selection.lastSurfaceSelections[0].elements[0]));e&&c||r&&c||e&&a||r&&a||n&&c||n&&l?t||(t=this.selection.surfaceSelections):(e&&!a||r)&&(e&&!l||n)&&d&&h&&u&&i&&(t=this.selection.lastSurfaceSelections)}this.selection.set(t),this.edgelessTool=e,this.container.slots.edgelessToolUpdated.emit(e),this._controllers[o].afterModeSwitch(e),this._controllers[e.type].afterModeSwitch(e)},this._service=e}static create(e,t){let i=new mG(e);return t.forEach(e=>{i.register(e)}),i}_getToolFromLocalStorage(){return"pan"===localStorage.defaultTool?{type:"pan",panning:!1}:{type:"default"}}_initMouseAndWheelEvents(){this._add("dragStart",e=>{this._dragging=!0;let t=e.get("pointerState");this._onContainerDragStart(t)}),this._add("dragMove",e=>{let t=e.get("pointerState");this._onContainerDragMove(t)}),this._add("dragEnd",e=>{this._dragging=!1;let t=e.get("pointerState");this._onContainerDragEnd(t)}),this._add("click",e=>{let t=e.get("pointerState");this._onContainerClick(t)}),this._add("doubleClick",e=>{let t=e.get("pointerState");this._onContainerDblClick(t)}),this._add("tripleClick",e=>{let t=e.get("pointerState");this._onContainerTripleClick(t)}),this._add("pointerMove",e=>{let t=e.get("pointerState");this._onContainerPointerMove(t)}),this._add("pointerDown",e=>{let t=e.get("pointerState");this._onContainerPointerDown(t)}),this._add("pointerUp",e=>{let t=e.get("pointerState");this._onContainerPointerUp(t)}),this._add("pointerOut",e=>{let t=e.get("pointerState");this._onContainerPointerOut(t)}),this._add("contextMenu",e=>{let t=e.get("defaultState");this._onContainerContextMenu(t)})}_isDocOnlyNote(e){let t=this.service.doc.getBlockById(e);return!!t&&(0,tE._h)(t)&&t.displayMode===O.ko.DocOnly}_updateLastMousePos(e){this._lastMousePos={x:e.x,y:e.y}}clear(){}dispose(){this._disposables.dispose()}getHoverState(){if(!this.currentController.enableHover)return null;let{x:e,y:t}=this._lastMousePos,[i,s]=this.service.viewport.toModelCoord(e,t),o=this.service.pickElement(i,s);return!o||this.selection?.editing?null:{rect:this.service.viewport.toViewBound(tS([o])),content:o}}mount(e){this._container=e,this._mounted=!0,Object.values(this._controllers).forEach(t=>{t.mount(e)}),this._initMouseAndWheelEvents()}register(e){let t=new e(this.service);this._controllers[t.tool.type]=t,this._mounted&&t.mount(this.container)}switchToDefaultMode(e){this.setEdgelessTool({type:"default"},e)}get container(){return this._container}get controllers(){return this._controllers}get currentController(){return this._controllers[this.edgelessTool.type]}get dispatcher(){return this.container.dispatcher}get doc(){return this.service.doc}get dragging(){return this._dragging}get draggingArea(){if(!this.currentController.draggingArea)return null;let{start:e,end:t}=this.currentController.draggingArea,i=Math.min(e.x,t.x),s=Math.min(e.y,t.y);return new DOMRect(i,s,Math.max(e.x,t.x)-i,Math.max(e.y,t.y)-s)}get edgelessTool(){return this._edgelessTool}set edgelessTool(e){this._edgelessTool=e,this._controllers[this._edgelessTool.type].tool=this._edgelessTool}get lastMousePos(){return this._lastMousePos}get selection(){return this.service.selection}get service(){return this._service}set shiftKey(e){this._shiftKey=e,this.currentController.onPressShiftKey(e)}get shiftKey(){return this._shiftKey}set spaceBar(e){this._spaceBar=e,this.currentController.onPressSpaceBar(e)}get spaceBar(){return this._spaceBar}}class mY extends v.hJ{constructor(e){super(),this._rootService=e,this._alignableBounds=[],this._distributedAlignLines=[],this._intraGraphicAlignLines=[],this.cleanupAlignables=()=>{this._alignableBounds=[],this._intraGraphicAlignLines=[],this._distributedAlignLines=[],this._surface.renderer?.removeOverlay(this)}}_alignDistributeHorizontally(e,t,i,s){let o=[];this._alignableBounds.forEach(e=>{e.isHorizontalCross(t)&&o.push(e)});let r=1/0,a=1/0;for(let n=0;n{if((r=Math.abs(t.center[0]-h))<=i&&re-t),o=(i[1]+i[2])/2,n=2/s.zoom,l=[h-t.w/2-n,h+t.w/2+n,d.minX,d.maxX,c.minX,c.maxX].sort((e,t)=>e-t);this._distributedAlignLines[0]=[new u.b(l[1],o),new u.b(l[2],o)],this._distributedAlignLines[1]=[new u.b(l[3],o),new u.b(l[4],o)]}};c.horizontalDistance(d)>t.w&&(h=(c.maxX+d.minX)/2,p()),h=c.minX-(d.minX-c.maxX)-t.w/2,p(),h=d.minX-c.maxX+d.maxX+t.w/2,p()}}_alignDistributeVertically(e,t,i,s){let o=[];this._alignableBounds.forEach(e=>{e.isVerticalCross(t)&&o.push(e)});let r=1/0,a=1/0;for(let n=0;n{if((r=Math.abs(t.center[1]-h))<=i&&re-t),o=(i[1]+i[2])/2,n=2/s.zoom,l=[h-t.h/2-n,h+t.h/2+n,d.minY,d.maxY,c.minY,c.maxY].sort((e,t)=>e-t);this._distributedAlignLines[3]=[new u.b(o,l[1]),new u.b(o,l[2])],this._distributedAlignLines[4]=[new u.b(o,l[3]),new u.b(o,l[4])]}};c.verticalDistance(d)>t.h&&(h=(c.maxY+d.minY)/2,p()),h=c.minY-(d.minY-c.maxY)-t.h/2,p(),h=d.minY-c.maxY+d.maxY+t.h/2,p()}}_calculateClosestDistances(e,t){let i=t.center[0]-e.center[0],s=t.center[1]-e.center[1],o=t.minX-e.center[0],r=t.maxX-e.center[0],a=t.minY-e.center[1],n=t.maxY-e.center[1],l=t.minX-e.minX,c=t.maxX-e.minX,d=t.minX-e.maxX,h=t.maxX-e.maxX,u=t.minY-e.minY,p=t.maxY-e.minY,f=t.minY-e.maxY,g=t.maxY-e.maxY,m=[i,o,r,l,c,d,h],v=[s,a,n,u,p,f,g],y=m.map(Math.abs),b=v.map(Math.abs),w=Math.min(...y),x=Math.min(...b),_=y.indexOf(w),C=b.indexOf(x);return{absXDistance:w,absYDistance:x,xDistance:m[_],yDistance:v[C],indexX:_,indexY:C}}_draw(){this._surface.refresh()}_getBoundsWithRotationByAlignable(e){let t=(0,tE.Te)(e)?0:e.rotate,[i,s,o,r]=(0,h.W)(e.xywh);return p.z.from((0,v.e0)({x:i,y:s,w:o,h:r,rotate:t}))}get _surface(){let e=this._rootService.doc.getBlockByFlavour("affine:surface")[0];return this._rootService.std.view.getBlock(e.id)}_updateXAlignPoint(e,t,i,s){let o=s.indexX;e.dx=s.xDistance;let r=[i.center[0],i.minX,i.maxX,t.minX+e.dx,t.minX+e.dx,t.maxX+e.dx,t.maxX+e.dx][o];this._intraGraphicAlignLines[0]=[new u.b(r,t.center[1]),new u.b(r,i.center[1])]}_updateYAlignPoint(e,t,i,s){let o=s.indexY;e.dy=s.yDistance;let r=[i.center[1],i.minY,i.maxY,t.minY+e.dy,t.minY+e.dy,t.maxY+e.dy,t.maxY+e.dy][o];this._intraGraphicAlignLines[1]=[new u.b(t.center[0],r),new u.b(i.center[0],r)]}align(e){let t={dx:0,dy:0},{viewport:i}=this._rootService;for(let i of(this._intraGraphicAlignLines=[],this._distributedAlignLines=[],this._alignableBounds)){let s=this._calculateClosestDistances(e,i);s.absXDistance<5&&this._updateXAlignPoint(t,e,i,s),s.absYDistance<5&&this._updateYAlignPoint(t,e,i,s)}return 0===t.dx&&this._alignDistributeHorizontally(t,e,5,i),0===t.dy&&this._alignDistributeVertically(t,e,5,i),this._draw(),t}render(e){if(0===this._intraGraphicAlignLines.length&&0===this._distributedAlignLines.length)return;let{viewport:t}=this._rootService,i=1/t.zoom,s=5/t.zoom;e.strokeStyle="#1672F3",e.lineWidth=i,e.beginPath(),this._intraGraphicAlignLines.forEach(t=>{let i="";if(t[0].x===t[1].x){let e=t[0].x,o=Math.min(t[0].y,t[1].y),r=Math.max(t[0].y,t[1].y);i=`M${e},${o-s}L${e},${r}`}else{let e=t[0].y,o=Math.min(t[0].x,t[1].x),r=Math.max(t[0].x,t[1].x);i=`M${o-s},${e}L${r+s},${e}`}e.stroke(new Path2D(i))}),this._distributedAlignLines.forEach(i=>{let o=10/t.zoom,r="";if(i[0].x===i[1].x){let e=i[0].x,t=Math.min(i[0].y,i[1].y)+s,a=Math.max(i[0].y,i[1].y)-s;r=`M${e},${t}L${e},${a} M${e-o},${t}L${e+o},${t} M${e-o},${a}L${e+o},${a} `}else{let e=i[0].y,t=Math.min(i[0].x,i[1].x)+s,a=Math.max(i[0].x,i[1].x)-s;r=`M${t},${e}L${a},${e} M${t},${e-o}L${t},${e+o} M${a},${e-o}L${a},${e+o}`}e.stroke(new Path2D(r))})}setupAlignables(e){if(0===e.length)return new p.z;let t=e.filter(tE.JC).reduce((e,t)=>{let i=this._rootService.getConnectors(t);return i.length>0&&(e=e.concat(i)),e},[]),{viewport:i}=this._rootService,s=p.z.from(i.viewportBounds);this._surface.renderer.addOverlay(this);let o=this._rootService.elements,r=[...e,...t];return this._alignableBounds=[],[...this._rootService.blocks,...o].forEach(e=>{let t=this._getBoundsWithRotationByAlignable(e);s.isOverlapWithBound(t)&&!r.includes(e)&&this._alignableBounds.push(t)}),e.reduce((e,t)=>{let i=this._getBoundsWithRotationByAlignable(t);return e.unite(i)},p.z.deserialize(e[0].xywh))}}class mK extends n_{constructor(e){super(e),this.TemplateJob=mW,this.slots={edgelessToolUpdated:new f.DX,pressShiftKeyUpdated:new f.DX,cursorUpdated:new f.DX,copyAsPng:new f.DX,readonlyUpdated:new f.DX,draggingAreaUpdated:new f.DX,navigatorSettingUpdated:new f.DX,navigatorFrameChanged:new f.DX,fullScreenToggled:new f.DX,elementResizeStart:new f.DX,elementResizeEnd:new f.DX,toggleNoteSlicer:new f.DX,docLinkClicked:new f.DX,tagClicked:new f.DX,toolbarLocked:new f.DX};let t=(0,gL.J)(this.doc);if(!t)throw new c.Ss(d.O.NoSurfaceModelError,"This doc is missing surface block in edgeless.");this._surface=t,this._layer=mR.T.create(this.doc,this._surface),this._frame=new aU(this),this._snap=new mY(this),this._viewport=new sO.LM,this._selection=new mF(this),this._tool=mG.create(this,[])}_initReadonlyListener(){let e=this.doc,t=e.readonly;this.disposables.add(e.awarenessStore.slots.update.on(()=>{t!==e.readonly&&(t=e.readonly,this.slots.readonlyUpdated.emit(t))}))}_initSlotEffects(){let{disposables:e,slots:t}=this;e.add(t.edgelessToolUpdated.on(e=>{t.cursorUpdated.emit((0,tE.qX)(e))})),e.add(t.pressShiftKeyUpdated.on(e=>{this.tool.shiftKey=e}))}addBlock(e,t,i,s){return t.index=this.generateIndex(e),this.editPropsStore.applyLastProps(e,t),this.doc.addBlock(e,t,i,s)}addElement(e,t){return void 0===t.index&&(t.index=this.generateIndex(e)),t.type=e,this.editPropsStore.applyLastProps(e,t),this._surface.addElement(t)}createGroup(e){let t=this.elements.filter(e=>"group"===e.type);return this.addElement("group",{children:e.reduce((e,t)=>(e["string"==typeof t?t:t.id]=!0,e),{}),title:`Group ${t.length+1}`})}createGroupFromSelected(){let{selection:e}=this;if(0===e.selectedElements.length||!e.selectedElements.every(t=>t.group===e.firstElement.group&&!(t.group instanceof v.AR)))return;let t=e.firstElement.group;null!==t&&e.selectedElements.forEach(e=>{t.removeChild(e.id)});let i=this.createGroup(e.selectedElements);return null!==t&&t.addChild(i),e.set({editing:!1,elements:[i]}),i}createTemplateJob(e){let t=[];if("template"===e){let e=(0,v.ql)(this.blocks.map(e=>p.z.deserialize(e.xywh)).concat(this.elements));e&&(e.x+=e.w+20/this.viewport.zoom,t.push(p8(e)));let i=this.layer.createIndexGenerator(!0);t.push(fe(e=>i(e)))}return"sticker"===e&&t.push(p9(this.viewport.center,()=>this.layer.generateIndex("affine:image"))),t.push(p6),mW.create({model:this.surface,type:e,middlewares:t})}generateIndex(e){return this._layer.generateIndex(e)}getConnectors(e){let t="string"==typeof e?e:e.id;return this.surface.getConnectors(t)}getElementById(e){return this._surface.getElementById(e)??this.doc.getBlockById(e)}getElementsByType(e){return this.surface.getElementsByType(e)}getFitToScreenData(e=[0,0,0,0],t){let i=[];if(t&&t.length)i=t;else{this.blocks.forEach(e=>{i.push(p.z.deserialize(e.xywh))});let e=(0,v.ql)(this.elements);e&&i.push(e)}let[s,o,r,a]=e,{viewport:n}=this,{centerX:l,centerY:c,zoom:d}=n;if(i.length){let{width:e,height:t}=n,h=(0,v.ql)(i);h?(d=Math.min((e-100-(o+a))/h.w,(t-100-(s+r))/h.h),d=(0,tv.qE)(d,sO.DH,sO.rL),l=h.x+(h.w+o/d)/2-a/d/2,c=h.y+(h.h+r/d)/2-s/d/2):d=sO.rL}else d=sO.rL;return{zoom:d,centerX:l,centerY:c}}mounted(){super.mounted(),this._initSlotEffects(),this._initReadonlyListener()}pickElement(e,t,i={all:!1,expand:10}){i.expand??=10,i.zoom=this._viewport.zoom;let s={x:e-i.expand/2,y:t-i.expand/2,w:i.expand,h:i.expand},o=this._layer.frames.filter(s=>s.includesPoint(e,t,i)||s.externalBound?.isPointInBound([e,t]));if(0!==o.length&&!i.all)return(0,sk.HV)(o)??null;{let r=this._layer.canvasGrid.search(s).filter(s=>s.includesPoint(e,t,i,this.host)||s.externalBound?.isPointInBound([e,t])).concat(this._layer.blocksGrid.search(s).filter(s=>s.includesPoint(e,t,i,this.host)||s.externalBound?.isPointInBound([e,t])));return r.sort(this._layer.compare),r=r.concat(o),i.all?r:(0,sk.HV)(r)??null}}pickElementInGroup(e,t,i){let s=this._selection,o=this.pickElement(e,t,{...i,all:!0}),r=(0,sk.HV)(o)??null,{activeGroup:a}=s,n=r;if(a&&r&&a.hasDescendant(r.id)){let e=o.length-1;for(;r===a||r instanceof ty.$b&&r.hasDescendant(a);)r=o[--e]}else if(r){let e=o.length-1;for(;null!==r.group;){if(--e<0){r=null;break}r=o[e]}}return r??n}pickElementsByBound(e,t="all"){e=new p.z(e.x,e.y,e.w,e.h);let i=()=>this._layer.canvasGrid.search(e).filter(t=>t.intersectsBound(e)),s=()=>this._layer.blocksGrid.search(e).filter(t=>t.intersectsBound(e)),o=()=>this._layer.framesGrid.search(e).filter(t=>t.intersectsBound(e));switch(t){case"canvas":return i();case"blocks":return s().concat(o());case"frame":return o();case"all":{let e=i().concat(s());return e.sort(this._layer.compare),e.concat(o())}}}registerTool(e){return this.tool.register(e)}removeElement(e){e="string"==typeof e?e:e.id;let t=this.getElementById(e);if(t instanceof tc.y){this.doc.deleteBlock(t);return}if(this._surface.hasElementById(e)){this._surface.removeElement(e);return}}reorderElement(e,t){let i=this._layer.getReorderedIndex(e,t);e instanceof tc.y?this.doc.transact(()=>{e.index=i}):e.index=i}setZoomByAction(e){if(!this.locked)switch(e){case"fit":this.zoomToFit();break;case"reset":this.viewport.smoothZoom(1);break;case"in":case"out":this.setZoomByStep(sO.bL*("in"===e?1:-1))}}setZoomByStep(e){this.viewport.smoothZoom((0,tv.qE)(this.zoom+e,sO.DH,sO.ZV))}ungroup(e){let{selection:t}=this,i=e.childElements,s=e.group;e instanceof v.AR||(null!==s&&s.removeChild(e.id),i.forEach(t=>{e.removeChild(t.id)}),i.forEach(e=>{let t=e.type||e.flavour;e.index=this.generateIndex(t)}),null!==s&&i.forEach(e=>{s.addChild(e.id)}),t.set({editing:!1,elements:i.map(e=>e.id)}))}unmounted(){super.unmounted(),this._layer?.dispose(),this._selection?.dispose(),this.viewport?.dispose(),this.tool?.dispose(),this._frame?.dispose(),this.selectionManager.set([]),this.disposables.dispose()}updateElement(e,t){let i=this._surface.getElementById(e);if(i){this.editPropsStore.recordLastProps(i.type,t),this._surface.updateElement(e,t);return}let s=this.doc.getBlockById(e);s&&(this.editPropsStore.recordLastProps(s.flavour,t),this.doc.updateBlock(s,t))}zoomToFit(){let{centerX:e,centerY:t,zoom:i}=this.getFitToScreenData();this.viewport.setViewport(i,[e,t],!0)}get blocks(){return this.frames.concat(this._layer.blocks)}get edgelessElements(){return[...this._layer.canvasElements,...this._layer.blocks,...this._layer.frames].sort(fx.UD)}get elements(){return this._layer.canvasElements}get frame(){return this._frame}get frames(){return this._layer.frames}get host(){return this.std.host}get layer(){return this._layer}get locked(){return this.viewport.locked}set locked(e){this.viewport.locked=e}get selection(){return this._selection}get snap(){return this._snap}get surface(){return this._surface}get tool(){return this._tool}get viewport(){return this._viewport}get zoom(){return this.viewport.zoom}}let mX={schema:iB.x,service:mK,view:{component:(0,th.eu)`affine-edgeless-root`,widgets:{[hM]:(0,th.eu)`${(0,th.Bk)(hM)}`,[hu]:(0,th.eu)`${(0,th.Bk)(hu)}`,[gI]:(0,th.eu)`${(0,th.Bk)(gI)}`,[mH]:(0,th.eu)`${(0,th.Bk)(mH)}`,[hw]:(0,th.eu)`${(0,th.Bk)(hw)}`,[sf]:(0,th.eu)`${(0,th.Bk)(sf)}`,[ag]:(0,th.eu)`${(0,th.Bk)(ag)}`,[az]:(0,th.eu)`${(0,th.Bk)(az)}`,[iD]:(0,th.eu)`${(0,th.Bk)(iD)}`,[sE]:(0,th.eu)`${(0,th.Bk)(sE)}`,[sD]:(0,th.eu)`${(0,th.Bk)(sD)}`,[he]:(0,th.eu)`${(0,th.Bk)(he)}`,[nM]:(0,th.eu)`${(0,th.Bk)(nM)}`,[sC]:(0,th.eu)`${(0,th.Bk)(sC)}`}}},mQ={schema:iB.x,service:mK,view:{component:(0,th.eu)`affine-edgeless-root-preview`},setup(e){e.viewConnected.on(({service:e})=>{e.locked=!0})}};var mJ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},m1=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-surface-void")],s=[],o=P.p_;(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;mJ(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),m1(t,s)}render(){return L.s6}})})();var m0=i(72674);let m2=(e,t)=>{let{oldId:i,newId:s}=e;(0,H.Z1)(i,"The old block ID is required!"),(0,H.Z1)(s,"The new block ID is required!");let o=e.std.spec.getService("affine:surface");(0,H.Z1)(o);let r=o.surface;for(let{id:e,source:t,target:o}of r.getConnectors(i)){if(t.id===i){r.updateElement(e,{source:{...t,id:s}});continue}o.id===i&&r.updateElement(e,{target:{...o,id:s}})}t()};class m5 extends P.ps{mounted(){if(super.mounted(),this.std.command.add("reassociateConnectors",m2),this.surface=this.doc.getBlockByFlavour("affine:surface")[0],this.surface)this.layer=mR.T.create(this.doc,this.surface);else{let e=this.doc.slots.blockUpdated.on(t=>{if("affine:surface"===t.flavour){e.dispose();let i=this.doc.getBlockById(t.id);i&&(this.surface=i,this.layer=mR.T.create(this.doc,i))}})}}unmounted(){this.layer?.dispose()}}let m7={schema:m0.Y,view:{component:(0,th.eu)`affine-surface-void`},service:m5},m3={schema:m0.Y,view:{component:(0,th.eu)`affine-surface`},service:m5};var m4=i(14512);class m6{constructor(e,t,i,s={enableStackingCanvas:!1}){this.id=e,this.doc=t,this.std=i,this._disposables=new eg.K,this._surfaceModel=null,this.slots={surfaceRendererInit:new a2.D,surfaceRendererRefresh:new a2.D,surfaceModelChanged:new a2.D,mounted:new a2.D,unmounted:new a2.D};let o=new sO.LM,r=new v.A4({viewport:o,layerManager:this.surfaceService.layer,enableStackingCanvas:s.enableStackingCanvas,provider:{generateColorProperty:(e,t)=>j.Q.generateColorProperty(e,t),getColorScheme:()=>j.Q.mode,getColorValue:(e,t,i)=>j.Q.getColorValue(e,t,i),getPropertyValue:e=>j.Q.getPropertyValue(e)}});this._surfaceRenderer=r,this._viewport=o}_initSurfaceModel(){let e=()=>{let e=(0,gL.J)(this.doc);this._surfaceModel=e,e&&this.slots.surfaceModelChanged.emit(e)};e(),this._surfaceModel||this._disposables.add(this.doc.slots.blockUpdated.on(({type:t})=>{"add"===t&&!this._surfaceModel&&(0,gL.J)(this.doc)&&e()}))}_initSurfaceRenderer(){this.slots.surfaceRendererInit.emit()}getModel(e){return this.doc.getBlockById(e)??this._surfaceModel?.getElementById(e)??null}mount(){this._disposables.disposed&&(this._disposables=new eg.K),this._initSurfaceModel(),this._initSurfaceRenderer(),this.slots.mounted.emit()}unmount(){this._disposables.dispose(),this.slots.unmounted.emit()}get surfaceModel(){return this._surfaceModel}get surfaceRenderer(){return this._surfaceRenderer}get surfaceService(){return this.std.spec.getService("affine:surface")}get viewport(){return this._viewport}}class m8 extends P.ps{constructor(){super(...arguments),this._rendererMap=new Map}getRenderer(e,t=this.doc,i=!1){if(this._rendererMap.has(e))return this._rendererMap.get(e);let s=new m6(e,t,this.std,{enableStackingCanvas:i});return this._rendererMap.set(e,s),s}removeRenderer(e){let t=this._rendererMap.get(e);t&&(t.unmount(),this._rendererMap.delete(e))}}let m9={schema:m4.H,service:m8,view:{component:(0,th.eu)`affine-surface-ref`,widgets:{surfaceToolbar:(0,th.eu)`affine-surface-ref-toolbar`}}},ve={schema:m4.H,service:m8,view:{component:(0,th.eu)`affine-edgeless-surface-ref`}};class vt extends P.ps{constructor(){super(...arguments),this._dragHandleOption={flavour:ly.OH.model.flavour,edgeless:!0,onDragStart:({state:e,startDragging:t,anchorBlockPath:i,editorHost:s})=>{if(!i)return!1;let o=s.std.view.getBlock(i);if(!o||!(0,tf.o)(o.model,[ly.OH.model.flavour]))return!1;let r=i8(e.raw.target),a=!!r?.closest(sf),n=o.contains(r),l=o.isInSurface;if(!l&&(a||n))return s.selection.setGroup("note",[s.selection.create("block",{blockId:o.blockId})]),t([o],e),!0;if(l&&a){let i=s.std.spec.getService("affine:page"),r=i?.viewport.zoom??1,a=document.createElement("div"),n=p.z.deserialize(o.model.xywh),l=new u.b(n.x*r,n.y*r);return(0,L.XX)(o.host.renderModel(o.model),a),t([o],e,a,l),!0}return!1},onDragEnd:e=>{let{state:t,draggingElements:i,editorHost:s}=e;if(1!==i.length||!(0,tf.o)(i[0].model,[ly.OH.model.flavour]))return!1;let o=i[0],r=o.isInSurface,a=i8(t.raw.target),n=a?.classList.contains("edgeless-container");if(r){let t=o.model.style;return sh({blockComponent:o,style:"cubeThick"===t?"horizontalThin":t,...e})}if(n){let t=o.model.style??"cubeThick";return o.model.embed&&(t="cubeThick",s.doc.updateBlock(o.model,{style:t,embed:!1})),sd({blockComponent:o,cssSelector:".affine-attachment-container",width:eh.Cd[t],height:eh.Hn[t],...e})}return!1}},this._fileDropOptions={flavour:this.flavour,onDrop:async({files:e,targetModel:t,place:i,point:s})=>{if(!e.length)return!1;let o=e.filter(e=>!e.type.startsWith("image/"));if(t&&!(0,tf.o)(t,["affine:surface"]))await lB(this.host,o,this.maxFileSize,t,i);else if((0,of.Ar)(this.host)){let e=this.rootComponent;if(!(e instanceof fG))return!1;s=e.service.viewport.toViewCoordFromClientCoord(s),await e.addAttachments(o,s),e.service.telemetryService?.track("CanvasElementAdded",{control:"canvas:drop",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"attachment"})}return this.slots.onFilesDropped.emit(o),!0}},this.maxFileSize=1e7,this.slots={onFilesDropped:new f.DX}}mounted(){super.mounted(),this.fileDropManager=new aN.f(this,this._fileDropOptions),this.disposables.add(sg.registerOption(this._dragHandleOption))}get rootComponent(){let e=this.doc.root;return e?this.std.view.viewFromPath("block",[e.id]):null}}let vi={schema:ly.OH,view:{component:(0,th.eu)`affine-attachment`},service:vt};class vs extends P.ps{constructor(){super(...arguments),this._dragHandleOption={flavour:ah.DD.model.flavour,edgeless:!0,onDragStart:({state:e,startDragging:t,anchorBlockPath:i,editorHost:s})=>{if(!i)return!1;let o=s.std.view.getBlock(i);if(!o||!(0,tf.o)(o.model,[ah.DD.model.flavour]))return!1;let r=i8(e.raw.target),a=!!r?.closest(sf),n=o.contains(r),l=o.isInSurface;if(!l&&(a||n))return s.selection.setGroup("note",[s.selection.create("block",{blockId:o.blockId})]),t([o],e),!0;if(l&&a){let i=s.std.spec.getService("affine:page"),r=i?.viewport.zoom??1,a=document.createElement("div"),n=p.z.deserialize(o.model.xywh),l=new u.b(n.x*r,n.y*r);return(0,L.XX)(o.host.renderModel(o.model),a),t([o],e,a,l),!0}return!1},onDragEnd:e=>{let{state:t,draggingElements:i}=e;if(1!==i.length||!(0,tf.o)(i[0].model,[ah.DD.model.flavour]))return!1;let s=i[0],o=s.isInSurface,r=i8(t.raw.target),a=r?.classList.contains("edgeless-container");if(o){let t=s.model.style;return sh({blockComponent:s,style:"vertical"===t||"cube"===t?"horizontal":t,...e})}if(a){let t=s.model.style;return sd({blockComponent:s,cssSelector:"bookmark-card",width:eh.Cd[t],height:eh.Hn[t],...e})}return!1}},this.queryUrlData=(e,t)=>vs.linkPreviewer.query(e,t)}static{this.linkPreviewer=new rs.y}static{this.setLinkPreviewEndpoint=vs.linkPreviewer.setEndpoint}mounted(){super.mounted(),this.disposables.add(sg.registerOption(this._dragHandleOption))}}let vo={schema:ah.DD,view:{component:(0,th.eu)`affine-bookmark`},service:vs},vr={schema:i(65828).c,view:{component:(0,th.eu)`affine-code`,widgets:{codeToolbar:(0,th.eu)`affine-code-toolbar-widget`,codeLangList:(0,th.eu)`affine-code-language-list-widget`}}};var va=i(87196);class vn{constructor(){this._markdownMatches=[],this._specs=[],this.embedChecker=e=>{for(let t of this._specs)if(t.embed&&t.match(e))return!0;return!1},this.getRenderer=()=>{let e=(0,A.zA)();return(t,i)=>{for(let e of this._specs.toReversed())if(e.match(t))return e.renderer(t,i);return e(t,i)}},this.getSchema=()=>{let e=A.oe;return this._specs.reduce((e,t)=>{let i=a7.z.object({[t.name]:t.schema});return e.merge(i)},e)},this.markdownShortcutHandler=(e,t)=>{let{inlineEditor:i,prefixText:s,inlineRange:o}=e;for(let e of this._markdownMatches)if(s.match(e.pattern))return e.action({inlineEditor:i,prefixText:s,inlineRange:o,pattern:e.pattern,undoManager:t});return A.gT}}registerMarkdownMatches(e){this._markdownMatches=e}registerSpecs(e){Array.isArray(e)&&(this._specs=e)}get markdownMatches(){return this._markdownMatches}get specs(){return this._specs}}var vl=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},vc=function(e,t,i){for(var s=arguments.length>2,o=0;o0?i:"none",...s,...t})}(()=>{let e,t,i=[(0,D.EM)("affine-text")],s=[],o=P.ao,r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;vl(this,null,[(0,D.MZ)({type:Object})],{kind:"accessor",name:"delta",static:!1,private:!1,access:{has:e=>"delta"in e,get:e=>e.delta,set:(e,t)=>{e.delta=t}},metadata:n},r,a),vl(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n}),vc(t,s)}render(){let e=this.delta.attributes?vd(this.delta.attributes):(0,Z.W)({});return this.delta.attributes?.code?(0,L.qy)``:(0,L.qy)``}#iu=vc(this,r,{insert:A.pe});get delta(){return this.#iu}set delta(e){this.#iu=e}constructor(){super(...arguments),vc(this,a)}})})();let vh=(0,L.AH)` .affine-link-edit-popover { ${sU}; display: grid; grid-template-columns: auto auto; grid-template-rows: repeat(2, 1fr); grid-template-areas: 'text-area .' 'link-area btn'; justify-items: center; align-items: center; width: 320px; gap: 8px 12px; padding: 12px; box-sizing: content-box; } .affine-link-edit-popover label { box-sizing: border-box; color: var(--affine-icon-color); ${sN}; font-weight: 400; } .affine-link-edit-popover input { color: inherit; padding: 0; border: none; background: transparent; color: var(--affine-text-primary-color); ${sN}; } .affine-link-edit-popover input::placeholder { color: var(--affine-placeholder-color); } input:focus { outline: none; } .affine-link-edit-popover input:focus ~ label, .affine-link-edit-popover input:active ~ label { color: var(--affine-primary-color); } .affine-edit-area { width: 280px; padding: 4px 10px; display: grid; gap: 8px; grid-template-columns: 26px auto; grid-template-rows: repeat(1, 1fr); grid-template-areas: 'label input'; user-select: none; box-sizing: border-box; border: 1px solid var(--affine-border-color); box-sizing: border-box; outline: none; border-radius: 4px; background: transparent; } .affine-edit-area:focus-within { border-color: var(--affine-blue-700); box-shadow: var(--affine-active-shadow); } .affine-edit-area.text { grid-area: text-area; } .affine-edit-area.link { grid-area: link-area; } .affine-edit-label { grid-area: label; } .affine-edit-input { grid-area: input; } .affine-confirm-button { grid-area: btn; user-select: none; } `,vu=(0,L.AH)` :host { box-sizing: border-box; } .mock-selection { position: absolute; background-color: rgba(35, 131, 226, 0.28); } .affine-link-popover-container { z-index: var(--affine-z-index-popover); animation: affine-popover-fade-in 0.2s ease; position: absolute; } @keyframes affine-popover-fade-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } } .affine-link-popover-overlay-mask { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: var(--affine-z-index-popover); } .affine-link-preview { display: flex; justify-content: flex-start; min-width: 60px; max-width: 140px; padding: var(--1, 0px); border-radius: var(--1, 0px); opacity: var(--add, 1); user-select: none; cursor: pointer; color: var(--affine-link-color); font-feature-settings: 'clig' off, 'liga' off; font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 400; text-decoration: none; text-wrap: nowrap; } .affine-link-preview > span { display: inline-block; -webkit-line-clamp: 1; -webkit-box-orient: vertical; text-overflow: ellipsis; overflow: hidden; opacity: var(--add, 1); } .affine-link-popover.create { ${sU}; gap: 12px; padding: 12px; color: var(--affine-text-primary-color); } .affine-link-popover-input { min-width: 280px; height: 30px; box-sizing: border-box; padding: 4px 10px; background: var(--affine-white-10); border-radius: 4px; border-width: 1px; border-style: solid; border-color: var(--affine-border-color); color: var(--affine-text-primary-color); ${sN}; } .affine-link-popover-input::placeholder { color: var(--affine-placeholder-color); } .affine-link-popover-input:focus { border-color: var(--affine-blue-700); box-shadow: var(--affine-active-shadow); } ${vh} `;var vp=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},vf=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d,h=[(0,D.EM)("link-popup")],u=[],p=(0,P.Tm)(L.WF),f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[];return class extends p{static{t=this}static{let O="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.P)(".affine-confirm-button")],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.P)("#link-input")],a=[(0,D.P)(".mock-selection-container")],n=[(0,D.P)(".affine-link-popover-container")],l=[(0,D.MZ)({attribute:!1})],c=[(0,D.P)("#text-input")],d=[(0,D.MZ)()],vp(this,null,i,{kind:"accessor",name:"abortController",static:!1,private:!1,access:{has:e=>"abortController"in e,get:e=>e.abortController,set:(e,t)=>{e.abortController=t}},metadata:O},f,g),vp(this,null,s,{kind:"accessor",name:"confirmButton",static:!1,private:!1,access:{has:e=>"confirmButton"in e,get:e=>e.confirmButton,set:(e,t)=>{e.confirmButton=t}},metadata:O},m,v),vp(this,null,o,{kind:"accessor",name:"inlineEditor",static:!1,private:!1,access:{has:e=>"inlineEditor"in e,get:e=>e.inlineEditor,set:(e,t)=>{e.inlineEditor=t}},metadata:O},y,b),vp(this,null,r,{kind:"accessor",name:"linkInput",static:!1,private:!1,access:{has:e=>"linkInput"in e,get:e=>e.linkInput,set:(e,t)=>{e.linkInput=t}},metadata:O},w,x),vp(this,null,a,{kind:"accessor",name:"mockSelectionContainer",static:!1,private:!1,access:{has:e=>"mockSelectionContainer"in e,get:e=>e.mockSelectionContainer,set:(e,t)=>{e.mockSelectionContainer=t}},metadata:O},_,C),vp(this,null,n,{kind:"accessor",name:"popupContainer",static:!1,private:!1,access:{has:e=>"popupContainer"in e,get:e=>e.popupContainer,set:(e,t)=>{e.popupContainer=t}},metadata:O},k,S),vp(this,null,l,{kind:"accessor",name:"targetInlineRange",static:!1,private:!1,access:{has:e=>"targetInlineRange"in e,get:e=>e.targetInlineRange,set:(e,t)=>{e.targetInlineRange=t}},metadata:O},M,E),vp(this,null,c,{kind:"accessor",name:"textInput",static:!1,private:!1,access:{has:e=>"textInput"in e,get:e=>e.textInput,set:(e,t)=>{e.textInput=t}},metadata:O},I,B),vp(this,null,d,{kind:"accessor",name:"type",static:!1,private:!1,access:{has:e=>"type"in e,get:e=>e.type,set:(e,t)=>{e.type=t}},metadata:O},$,T),vp(null,e={value:t},h,{kind:"class",name:t.name,metadata:O},null,u),t=e.value,O&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:O})}static{this.styles=vu}get _canConvertToEmbedView(){return this._embedOptions?.viewType==="embed"}_confirmBtnTemplate(){return(0,L.qy)` ${G.Mwl} `}_convertToCardView(){if(!this.inlineEditor.isValidInlineRange(this.targetInlineRange))return;let e="affine:bookmark";this._embedOptions&&"card"===this._embedOptions.viewType&&(e=this._embedOptions.flavour);let t=this.block;if(!t)return;let i=this.currentLink,s=this.currentText,o=t.doc,r=o.getParent(t.model);(0,H.Z1)(r);let a=r.children.indexOf(t.model);o.addBlock(e,{url:i,title:s===i?"":s},r,a+1),this.inlineEditor.yTextLength===this.targetInlineRange.length?o.deleteBlock(t.model):this.inlineEditor.formatText(this.targetInlineRange,{link:null}),this.abortController.abort()}_convertToEmbedView(){if(!this._embedOptions||"embed"!==this._embedOptions.viewType)return;let{flavour:e}=this._embedOptions,t=this.currentLink,i=this.block;if(!i)return;let s=i.doc,o=s.getParent(i.model);(0,H.Z1)(o);let r=o.children.indexOf(i.model);s.addBlock(e,{url:t},o,r+1),this.inlineEditor.yTextLength===this.targetInlineRange.length?s.deleteBlock(i.model):this.inlineEditor.formatText(this.targetInlineRange,{link:null}),this.abortController.abort()}_copyUrl(){navigator.clipboard.writeText(this.currentLink).catch(console.error),this.host&&((0,e5.o)(this.host,"Copied link to clipboard"),this.abortController.abort())}get _isBookmarkAllowed(){let e=this.block;if(!e)return!1;let t=e.doc.schema,i=e.doc.getParent(e.model);if(!i)return!1;let s=t.flavourSchemaMap.get("affine:bookmark");if(!s)return!1;let o=t.flavourSchemaMap.get(i.flavour);if(!o)return!1;try{t.validateSchema(s,o)}catch{return!1}return!0}_moreActions(){return ad([[{name:"Open",icon:G.gb9,handler:this._openLink},{name:"Copy",icon:G.TdU,handler:this._copyUrl},{name:"Remove link",icon:G.xPL,handler:this._removeLink}],[{type:"delete",name:"Delete",icon:G.d7y,handler:this._delete}]])}_onConfirm(){if(!this.inlineEditor.isValidInlineRange(this.targetInlineRange)||!this.linkInput)return;let e=this.linkInput.value;if(!e||!(0,oT.AY)(e))return;let t=(0,oT.l2)(e);if("create"===this.type){this.inlineEditor.formatText(this.targetInlineRange,{link:t,reference:null}),this.inlineEditor.setInlineRange(this.targetInlineRange);let e=this.host?.selection.find("text");if(!e)return;this.std?.range.syncTextSelectionToRange(e)}else if("edit"===this.type){let e=this.textInput?.value??t;this.inlineEditor.insertText(this.targetInlineRange,e,{link:t,reference:null}),this.inlineEditor.setInlineRange({index:this.targetInlineRange.index,length:e.length});let i=this.host?.selection.find("text");if(!i)return;this.std?.range.syncTextSelectionToRange(i)}this.abortController.abort()}_onKeydown(e){e.stopPropagation(),"Enter"!==e.key||e.isComposing||(e.preventDefault(),this._onConfirm())}get _rootService(){return this.std?.spec.getService("affine:page")}_updateConfirmBtn(){(0,H.Z1)(this.confirmButton);let e=this.linkInput?.value.trim();this.confirmButton.disabled=!(e&&(0,oT.AY)(e)),this.confirmButton.requestUpdate()}_viewMenuButton(){if(!this._isBookmarkAllowed)return L.s6;let e=[];return e.push({type:"inline",name:"Inline view"}),e.push({type:"card",name:"Card view",handler:()=>this._convertToCardView()}),this._canConvertToEmbedView&&e.push({type:"embed",name:"Embed view",handler:()=>this._convertToEmbedView()}),(0,L.qy)`
    Inline view
    ${G.eoI} `} >
    ${(0,t$.u)(e,e=>e.type,({type:e,name:t,handler:i})=>(0,L.qy)` ${t} `)}
    `}connectedCallback(){super.connectedCallback(),0!==this.targetInlineRange.length&&("edit"===this.type||"create"===this.type)&&(this._bodyOverflowStyle=document.body.style.overflow,document.body.style.overflow="hidden",this.disposables.add({dispose:()=>{document.body.style.overflow=this._bodyOverflowStyle}}))}firstUpdated(){this.linkInput&&(this._disposables.addFromEvent(this.linkInput,"copy",e=>{e.stopPropagation()}),this._disposables.addFromEvent(this.linkInput,"cut",e=>{e.stopPropagation()}),this._disposables.addFromEvent(this.linkInput,"paste",e=>{e.stopPropagation()}))}render(){return(0,L.qy)`
    ${"view"===this.type?L.s6:(0,L.qy)` `}
    `}updated(){(0,H.Z1)(this.popupContainer);let e=this.inlineEditor.toDomRange(this.targetInlineRange);(0,H.Z1)(e),"view"!==this.type&&Object.values(e.getClientRects()).forEach(e=>{let t=document.createElement("div");t.classList.add("mock-selection"),t.style.left=`${e.left}px`,t.style.top=`${e.top}px`,t.style.width=`${e.width}px`,t.style.height=`${e.height}px`,(0,H.Z1)(this.mockSelectionContainer),this.mockSelectionContainer.append(t)}),(0,sI.rD)({getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects()},this.popupContainer,{middleware:[(0,sI.cY)(10),(0,sI.mG)(),(0,sI.BN)({padding:6})]}).then(({x:e,y:t})=>{let i=this.popupContainer;i&&(i.style.left=`${e}px`,i.style.top=`${t}px`)}).catch(console.error)}get block(){return this.inlineEditor.rootElement.closest(`[${eh.u_}]`)||null}get currentLink(){let e=this.inlineEditor.getFormat(this.targetInlineRange).link;return(0,H.Z1)(e),e}get currentText(){return this.inlineEditor.yTextString.slice(this.targetInlineRange.index,this.targetInlineRange.index+this.targetInlineRange.length)}get host(){return this.block?.host}get std(){return this.block?.std}#_;get abortController(){return this.#_}set abortController(e){this.#_=e}#ln;get confirmButton(){return this.#ln}set confirmButton(e){this.#ln=e}#ll;get inlineEditor(){return this.#ll}set inlineEditor(e){this.#ll=e}#lc;get linkInput(){return this.#lc}set linkInput(e){this.#lc=e}#ld;get mockSelectionContainer(){return this.#ld}set mockSelectionContainer(e){this.#ld=e}#lh;get popupContainer(){return this.#lh}set popupContainer(e){this.#lh=e}#lu;get targetInlineRange(){return this.#lu}set targetInlineRange(e){this.#lu=e}#lp;get textInput(){return this.#lp}set textInput(e){this.#lp=e}#tW;get type(){return this.#tW}set type(e){this.#tW=e}constructor(){super(...arguments),this._bodyOverflowStyle="",this._createTemplate=()=>(this.updateComplete.then(()=>{this.linkInput?.focus(),this._updateConfirmBtn()}).catch(console.error),(0,L.qy)` `),this._delete=()=>{this.inlineEditor.isValidInlineRange(this.targetInlineRange)&&this.inlineEditor.deleteText(this.targetInlineRange),this.abortController.abort()},this._edit=()=>{this.type="edit"},this._editTemplate=()=>(this.updateComplete.then(()=>{(0,H.Z1)(this.textInput),this.textInput.value=this.currentText,(0,H.Z1)(this.linkInput),this.linkInput.value=this.currentLink,this.textInput.select(),this._updateConfirmBtn()}).catch(console.error),(0,L.qy)` `),this._embedOptions=null,this._openLink=()=>{let e=this.currentLink;e.match(/^[a-zA-Z]+:\/\//)||(e="https://"+e),window.open(e,"_blank"),this.abortController.abort()},this._removeLink=()=>{this.inlineEditor.isValidInlineRange(this.targetInlineRange)&&this.inlineEditor.formatText(this.targetInlineRange,{link:null}),this.abortController.abort()},this._viewTemplate=()=>{if(!this._rootService)return L.s6;this._embedOptions=this._rootService.getEmbedBlockOptions(this.currentLink);let e=[(0,L.qy)` ${(0,oT.yz)(this.currentLink)} ${G.TdU} ${G.qUP} `,this._viewMenuButton(),(0,L.qy)` ${G.FHP} `} >
    ${this._moreActions()}
    `];return(0,L.qy)` ${(0,sj.f)(e.filter(e=>e!==L.s6),an)} `},this.#_=vf(this,f,void 0),this.#ln=(vf(this,g),vf(this,m,null)),this.#ll=(vf(this,v),vf(this,y,void 0)),this.#lc=(vf(this,b),vf(this,w,null)),this.#ld=(vf(this,x),vf(this,_,void 0)),this.#lh=(vf(this,C),vf(this,k,void 0)),this.#lu=(vf(this,S),vf(this,M,void 0)),this.#lp=(vf(this,E),vf(this,I,null)),this.#tW=(vf(this,B),vf(this,$,"create")),vf(this,T)}static{vf(t,u)}},t})();function vm(e,t,i,s){let o=new vg;return o.inlineEditor=e,o.type=t,o.targetInlineRange=i,o.abortController=s,document.body.append(o),o}var vv=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},vy=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-link")],s=[],o=P.ao,r=[],a=[];(class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;vv(this,null,[(0,D.MZ)({type:Object})],{kind:"accessor",name:"delta",static:!1,private:!1,access:{has:e=>"delta"in e,get:e=>e.delta,set:(e,t)=>{e.delta=t}},metadata:n},r,a),vv(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` affine-link a:hover [data-v-text='true'] { text-decoration: underline; } `}_onMouseUp(){let e=this.querySelector("a");(0,H.Z1)(e),e.isContentEditable&&(e.contentEditable="false",setTimeout(()=>{e.removeAttribute("contenteditable")},0))}render(){let e={color:"var(--affine-link-color)",fill:"var(--affine-link-color)","text-decoration":"none",cursor:"pointer"};if(this.delta.attributes&&this.delta.attributes?.code){let t=vd(this.delta.attributes);return(0,L.qy)``}let t=this.delta.attributes?vd(this.delta.attributes,e):(0,Z.W)({});return(0,L.qy)``}get block(){let e=this.inlineEditor.rootElement.closest(`[${eh.u_}]`);return(0,H.Z1)(e),e}get inlineEditor(){let e=this.closest(`[${A.jN}]`);return(0,H.Z1)(e),e.inlineEditor}get link(){return this.delta.attributes?.link||""}get selfInlineRange(){let e=this.inlineEditor.getInlineRangeFromElement(this);return(0,H.Z1)(e),e}get std(){let e=this.block.std;return(0,H.Z1)(e),e}#iu;get delta(){return this.#iu}set delta(e){this.#iu=e}constructor(){super(...arguments),this._whenHover=new aC.n(this,({abortController:e})=>{if(this.block.doc.readonly)return null;let t=this.std.selection,i=t.find("text");return i&&(i.to||i.from.length)||t.filter("block").length?null:{template:vm(this.inlineEditor,"view",this.selfInlineRange,e)}},{enterDelay:500}),this.#iu=vy(this,r,{insert:A.pe}),vy(this,a)}static{vy(t,s)}})})();let vb=(0,L.AH)` :host { box-sizing: border-box; } .affine-reference-popover-container { z-index: var(--affine-z-index-popover); animation: affine-popover-fade-in 0.2s ease; position: absolute; } @keyframes affine-popover-fade-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } } `;var vw=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},vx=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("reference-popup")],c=[],d=(0,P.Tm)(L.WF),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];return class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.P)(".affine-reference-popover-container")],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],vw(this,null,i,{kind:"accessor",name:"abortController",static:!1,private:!1,access:{has:e=>"abortController"in e,get:e=>e.abortController,set:(e,t)=>{e.abortController=t}},metadata:C},h,u),vw(this,null,s,{kind:"accessor",name:"docTitle",static:!1,private:!1,access:{has:e=>"docTitle"in e,get:e=>e.docTitle,set:(e,t)=>{e.docTitle=t}},metadata:C},p,f),vw(this,null,o,{kind:"accessor",name:"inlineEditor",static:!1,private:!1,access:{has:e=>"inlineEditor"in e,get:e=>e.inlineEditor,set:(e,t)=>{e.inlineEditor=t}},metadata:C},g,m),vw(this,null,r,{kind:"accessor",name:"popupContainer",static:!1,private:!1,access:{has:e=>"popupContainer"in e,get:e=>e.popupContainer,set:(e,t)=>{e.popupContainer=t}},metadata:C},v,y),vw(this,null,a,{kind:"accessor",name:"target",static:!1,private:!1,access:{has:e=>"target"in e,get:e=>e.target,set:(e,t)=>{e.target=t}},metadata:C},b,w),vw(this,null,n,{kind:"accessor",name:"targetInlineRange",static:!1,private:!1,access:{has:e=>"targetInlineRange"in e,get:e=>e.targetInlineRange,set:(e,t)=>{e.targetInlineRange=t}},metadata:C},x,_),vw(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}static{this.styles=vb}_convertToCardView(){let e=this.block,t=e.host.doc,i=t.getParent(e.model);(0,H.Z1)(i);let s=i.children.indexOf(e.model),o=this.referenceDocId;t.addBlock("affine:embed-linked-doc",{pageId:o},i,s+1),this.inlineEditor.yTextLength===this.targetInlineRange.length?t.deleteBlock(e.model):this.inlineEditor.insertText(this.targetInlineRange,this.docTitle),this.abortController.abort()}_convertToEmbedView(){let e=this.block,t=e.host.doc,i=t.getParent(e.model);(0,H.Z1)(i);let s=i.children.indexOf(e.model),o=this.referenceDocId;t.addBlock("affine:embed-synced-doc",{pageId:o},i,s+1),this.inlineEditor.yTextLength===this.targetInlineRange.length?t.deleteBlock(e.model):this.inlineEditor.insertText(this.targetInlineRange,this.docTitle),this.abortController.abort()}_delete(){this.inlineEditor.isValidInlineRange(this.targetInlineRange)&&this.inlineEditor.deleteText(this.targetInlineRange),this.abortController.abort()}get _embedViewButtonDisabled(){return!!(this.block.doc.readonly||(0,tf.a)(this.block.doc,this.block.model,"affine:edgeless-text"))||!!this.block.closest("affine-embed-synced-doc-block")||this.referenceDocId===this.doc.id}_moreActions(){return ad([[{type:"delete",name:"Delete",icon:G.d7y,disabled:this.doc.readonly,handler:()=>this._delete()}]])}get _openButtonDisabled(){return this.referenceDocId===this.doc.id}_openDoc(){let e=this.referenceDocId,t=this.block;if(e===t.doc.id)return;let i=this.std.view.viewFromPath("block",[t.doc.root?.id??""]);(0,H.Z1)(i),i.slots.docLinkClicked.emit({docId:e})}_openMenuButton(){let e=[{name:"Open this doc",icon:G.UYC,handler:()=>this._openDoc(),disabled:this._openButtonDisabled}];return((0,U.mV)(this.target)&&e.push({name:"Open in center peek",icon:G.KRn,handler:()=>(0,U.se)(this.target)}),0===e.length)?L.s6:(0,L.qy)` ${G.gb9}${G.eoI} `} >
    ${(0,t$.u)(e,e=>e.name,({name:e,icon:t,handler:i,disabled:s})=>(0,L.qy)` ${t}${e} `)}
    `}_viewMenuButton(){let e=this.doc.awarenessStore.getFlag("enable_synced_doc_block"),t=[];return t.push({type:"inline",name:"Inline view"}),t.push({type:"card",name:"Card view",handler:()=>this._convertToCardView()}),e&&t.push({type:"embed",name:"Embed view",handler:()=>this._convertToEmbedView(),disabled:this._embedViewButtonDisabled}),(0,L.qy)` Inline view ${G.eoI} `} >
    ${(0,t$.u)(t,e=>e.type,({type:e,name:t,handler:i,disabled:s})=>(0,L.qy)` ${t} `)}
    `}connectedCallback(){if(super.connectedCallback(),0===this.targetInlineRange.length)return;let e=this.block.host.doc.getParent(this.block.model);(0,H.Z1)(e),this.disposables.add((0,q.QZ)(()=>{e.children.includes(this.block.model)||this.abortController.abort()}))}render(){let e=[this._openMenuButton(),this._viewMenuButton(),(0,L.qy)` ${G.FHP} `} >
    ${this._moreActions()}
    `];return(0,L.qy)`
    ${(0,sj.f)(e.filter(e=>e!==L.s6),an)}
    `}updated(){(0,H.Z1)(this.popupContainer);let e=this.inlineEditor.toDomRange(this.targetInlineRange);(0,H.Z1)(e),(0,sI.rD)({getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects()},this.popupContainer,{middleware:[(0,sI.cY)(10),(0,sI.mG)(),(0,sI.BN)({padding:6})]}).then(({x:e,y:t})=>{let i=this.popupContainer;i&&(i.style.left=`${e}px`,i.style.top=`${t}px`)}).catch(console.error)}get block(){let e=this.inlineEditor.rootElement.closest(`[${eh.u_}]`);return(0,H.Z1)(e),e}get doc(){let e=this.block.doc;return(0,H.Z1)(e),e}get referenceDocId(){let e=this.inlineEditor.getFormat(this.targetInlineRange).reference?.pageId;return(0,H.Z1)(e),e}get std(){let e=this.block.std;return(0,H.Z1)(e),e}#_=vx(this,h,void 0);get abortController(){return this.#_}set abortController(e){this.#_=e}#lf=(vx(this,u),vx(this,p,void 0));get docTitle(){return this.#lf}set docTitle(e){this.#lf=e}#ll=(vx(this,f),vx(this,g,void 0));get inlineEditor(){return this.#ll}set inlineEditor(e){this.#ll=e}#lh=(vx(this,m),vx(this,v,void 0));get popupContainer(){return this.#lh}set popupContainer(e){this.#lh=e}#lg=(vx(this,y),vx(this,b,void 0));get target(){return this.#lg}set target(e){this.#lg=e}#lu=(vx(this,w),vx(this,x,void 0));get targetInlineRange(){return this.#lu}set targetInlineRange(e){this.#lu=e}constructor(){super(...arguments),vx(this,_)}static{vx(t,c)}},t})();var vC=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},vk=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("affine-reference"),(0,ri.YE)({action:!1})],n=[],l=(0,P.Tm)(P.ao),c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];return class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({type:Object})],o=[(0,D.wk)()],r=[(0,D.MZ)({type:Boolean})],vC(this,null,i,{kind:"accessor",name:"config",static:!1,private:!1,access:{has:e=>"config"in e,get:e=>e.config,set:(e,t)=>{e.config=t}},metadata:v},c,d),vC(this,null,s,{kind:"accessor",name:"delta",static:!1,private:!1,access:{has:e=>"delta"in e,get:e=>e.delta,set:(e,t)=>{e.delta=t}},metadata:v},h,u),vC(this,null,o,{kind:"accessor",name:"refMeta",static:!1,private:!1,access:{has:e=>"refMeta"in e,get:e=>e.refMeta,set:(e,t)=>{e.refMeta=t}},metadata:v},p,f),vC(this,null,r,{kind:"accessor",name:"selected",static:!1,private:!1,access:{has:e=>"selected"in e,get:e=>e.selected,set:(e,t)=>{e.selected=t}},metadata:v},g,m),vC(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` .affine-reference { white-space: normal; word-break: break-word; color: var(--affine-text-primary-color); fill: var(--affine-icon-color); border-radius: 4px; text-decoration: none; cursor: pointer; user-select: none; padding: 1px 2px 1px 0; } .affine-reference:hover { background: var(--affine-hover-color); } .affine-reference[data-selected='true'] { background: var(--affine-hover-color); } .affine-reference-title { margin-left: 4px; border-bottom: 0.5px solid var(--affine-divider-color); transition: border 0.2s ease-out; } .affine-reference-title:hover { border-bottom: 0.5px solid var(--affine-icon-color); } `}_onClick(){if(!this.config.interactable)return;let e=this.refMeta,t=(0,of.dz)(this);if(!e){console.warn("The doc is deleted",this._refAttribute.pageId);return}if(e.id===t.doc.id)return;let i=e.id,s=t.doc.root;(0,H.Z1)(s);let o=(0,of.mD)(this);(0,H.Z1)(o),o.slots.docLinkClicked.emit({docId:i})}connectedCallback(){super.connectedCallback(),(0,H.Z1)(this.config,"`reference-node` need `ReferenceNodeConfig`.")," "!==this.delta.insert&&console.error(`Reference node must be initialized with ' ', but got '${this.delta.insert}'`);let e=this.doc;this._disposables.add(e.collection.slots.docUpdated.on(()=>this._updateRefMeta(e))),this.updateComplete.then(()=>{this.disposables.add(this.inlineEditor.slots.textChange.on(()=>this._updateRefMeta(e)))}).catch(console.error)}render(){let e=this.refMeta,t=!e,i=this.delta.attributes;(0,H.Z1)(i,"Failed to get attributes!");let s=i.reference?.type;(0,H.Z1)(s,"Unable to get reference type!");let o=this.customTitle?this.customTitle(this):t?"Deleted doc":e.title.length>0?e.title:s2,r=this.customIcon?this.customIcon(this):"LinkedPage"===s?sv.ET:sv.dv,a=vd(i,t?{color:"var(--affine-text-disable-color)",textDecoration:"line-through",fill:"var(--affine-text-disable-color)"}:{}),n=this.customContent?this.customContent(this):(0,L.qy)`${r}${o}`;return(0,L.qy)`${n}`}willUpdate(e){super.willUpdate(e);let t=this.doc;this._updateRefMeta(t)}get block(){let e=this.inlineEditor.rootElement.closest(`[${eh.u_}]`);return(0,H.Z1)(e),e}get customContent(){return this.config.customContent}get customIcon(){return this.config.customIcon}get customTitle(){return this.config.customTitle}get doc(){let e=this.config.doc;return(0,H.Z1)(e,"`reference-node` need `Doc`."),e}get inlineEditor(){let e=this.closest(`[${A.jN}]`);return(0,H.Z1)(e),e.inlineEditor}get selfInlineRange(){let e=this.inlineEditor.getInlineRangeFromElement(this);return(0,H.Z1)(e),e}get std(){let e=this.block.std;return(0,H.Z1)(e),e}#th;get config(){return this.#th}set config(e){this.#th=e}#iu;get delta(){return this.#iu}set delta(e){this.#iu=e}#lm;get refMeta(){return this.#lm}set refMeta(e){this.#lm=e}#lv;get selected(){return this.#lv}set selected(e){this.#lv=e}constructor(){super(...arguments),this._refAttribute={type:"LinkedPage",pageId:"0"},this._updateRefMeta=e=>{let t=this.delta.attributes?.reference;(0,H.Z1)(t,"Failed to get reference attribute!"),this._refAttribute=t;let i=e.collection.meta.docMetas.find(e=>e.id===t.pageId);this.refMeta=i?{...i}:void 0},this._whenHover=new n5.n(this,({abortController:e})=>{if(this.doc.readonly||this.closest(".prevent-reference-popup"))return null;let t=this.std.selection,i=t.find("text");return i&&(i.to||i.from.length)||t.filter("block").length?null:{template:function(e,t,i,s,o){let r=new v_;return r.target=e,r.inlineEditor=t,r.targetInlineRange=i,r.docTitle=s,r.abortController=o,document.body.append(r),r}(this,this.inlineEditor,this.selfInlineRange,this.refMeta?.title??s2,e)}},{enterDelay:500}),this.#th=vk(this,c,void 0),this.#iu=(vk(this,d),vk(this,h,{insert:A.pe,attributes:{}})),this.#lm=(vk(this,u),vk(this,p,void 0)),this.#lv=(vk(this,f),vk(this,g,!1)),vk(this,m)}static{vk(t,n)}},t})(),vM=[{name:"bold",schema:a7.z.literal(!0).optional().nullable().catch(void 0),match:e=>!!e.attributes?.bold,renderer:e=>(0,L.qy)``},{name:"italic",schema:a7.z.literal(!0).optional().nullable().catch(void 0),match:e=>!!e.attributes?.italic,renderer:e=>(0,L.qy)``},{name:"underline",schema:a7.z.literal(!0).optional().nullable().catch(void 0),match:e=>!!e.attributes?.underline,renderer:e=>(0,L.qy)``},{name:"strike",schema:a7.z.literal(!0).optional().nullable().catch(void 0),match:e=>!!e.attributes?.strike,renderer:e=>(0,L.qy)``},{name:"code",schema:a7.z.literal(!0).optional().nullable().catch(void 0),match:e=>!!e.attributes?.code,renderer:e=>(0,L.qy)``},{name:"background",schema:a7.z.string().optional().nullable().catch(void 0),match:e=>!!e.attributes?.background,renderer:e=>(0,L.qy)``},{name:"color",schema:a7.z.string().optional().nullable().catch(void 0),match:e=>!!e.attributes?.color,renderer:e=>(0,L.qy)``}];function vE(e){return[...vM,{name:"reference",schema:a7.z.object({type:a7.z.enum(["Subpage","LinkedPage"]),pageId:a7.z.string()}).optional().nullable().catch(void 0),match:e=>!!e.attributes?.reference,renderer:(t,i)=>(0,L.qy)``,embed:!0},{name:"link",schema:a7.z.string().optional().nullable().catch(void 0),match:e=>!!e.attributes?.link,renderer:e=>(0,L.qy)``}]}let vI=[{name:"bolditalic",pattern:/(?:\*\*\*)([^\s\*](?:[^*]*?[^\s\*])?)(?:\*\*\*)$/g,action:({inlineEditor:e,prefixText:t,inlineRange:i,pattern:s,undoManager:o})=>{let r=s.exec(t);if(!r)return A.gT;let a=r[0],n=i.index-a.length;return e.insertText({index:n+a.length,length:0}," "),e.setInlineRange({index:n+a.length+1,length:0}),o.stopCapturing(),e.formatText({index:n,length:a.length},{bold:!0,italic:!0}),e.deleteText({index:n+a.length,length:1}),e.deleteText({index:n+a.length-3,length:3}),e.deleteText({index:n,length:3}),e.setInlineRange({index:n+a.length-6,length:0}),A.rM}},{name:"bold",pattern:/(?:\*\*)([^\s\*](?:[^*]*?[^\s\*])?)(?:\*\*)$/g,action:({inlineEditor:e,prefixText:t,inlineRange:i,pattern:s,undoManager:o})=>{let r=s.exec(t);if(!r)return A.gT;let a=r[0],n=i.index-a.length;return e.insertText({index:n+a.length,length:0}," "),e.setInlineRange({index:n+a.length+1,length:0}),o.stopCapturing(),e.formatText({index:n,length:a.length},{bold:!0}),e.deleteText({index:n+a.length,length:1}),e.deleteText({index:n+a.length-2,length:2}),e.deleteText({index:n,length:2}),e.setInlineRange({index:n+a.length-4,length:0}),A.rM}},{name:"italic",pattern:/(?:\*)([^\s\*](?:[^*]*?[^\s\*])?)(?:\*)$/g,action:({inlineEditor:e,prefixText:t,inlineRange:i,pattern:s,undoManager:o})=>{let r=s.exec(t);if(!r)return A.gT;let a=r[0],n=i.index-a.length;return e.insertText({index:n+a.length,length:0}," "),e.setInlineRange({index:n+a.length+1,length:0}),o.stopCapturing(),e.formatText({index:n,length:a.length},{italic:!0}),e.deleteText({index:n+a.length,length:1}),e.deleteText({index:n+a.length-1,length:1}),e.deleteText({index:n,length:1}),e.setInlineRange({index:n+a.length-2,length:0}),A.rM}},{name:"strikethrough",pattern:/(?:~~)([^\s~](?:[^~]*?[^\s~])?)(?:~~)$/g,action:({inlineEditor:e,prefixText:t,inlineRange:i,pattern:s,undoManager:o})=>{let r=s.exec(t);if(!r)return A.gT;let a=r[0],n=i.index-a.length;return e.insertText({index:n+a.length,length:0}," "),e.setInlineRange({index:n+a.length+1,length:0}),o.stopCapturing(),e.formatText({index:n,length:a.length},{strike:!0}),e.deleteText({index:n+a.length,length:1}),e.deleteText({index:n+a.length-2,length:2}),e.deleteText({index:n,length:2}),e.setInlineRange({index:n+a.length-4,length:0}),A.rM}},{name:"underthrough",pattern:/(?:~)([^\s~](?:[^~]*?[^\s~])?)(?:~)$/g,action:({inlineEditor:e,prefixText:t,inlineRange:i,pattern:s,undoManager:o})=>{let r=s.exec(t);if(!r)return A.gT;let a=r[0],n=i.index-a.length;return e.insertText({index:n+a.length,length:0}," "),e.setInlineRange({index:n+a.length+1,length:0}),o.stopCapturing(),e.formatText({index:n,length:a.length},{underline:!0}),e.deleteText({index:n+a.length,length:1}),e.deleteText({index:i.index-1,length:1}),e.deleteText({index:n,length:1}),e.setInlineRange({index:n+a.length-2,length:0}),A.rM}},{name:"code",pattern:/(?:`)([^\s`](?:[^`]*?[^\s`])?)(?:`)$/g,action:({inlineEditor:e,prefixText:t,inlineRange:i,pattern:s,undoManager:o})=>{let r=s.exec(t);if(!r)return A.gT;let a=r[0],n=i.index-a.length;return t.match(/^([* \n]+)$/g)?A.gT:(e.insertText({index:n+a.length,length:0}," "),e.setInlineRange({index:n+a.length+1,length:0}),o.stopCapturing(),e.formatText({index:n,length:a.length},{code:!0}),e.deleteText({index:n+a.length,length:1}),e.deleteText({index:n+a.length-1,length:1}),e.deleteText({index:n,length:1}),e.setInlineRange({index:n+a.length-2,length:0}),A.rM)}},{name:"link",pattern:/(?:\[(.+?)\])(?:\((.+?)\))$/g,action:({inlineEditor:e,prefixText:t,inlineRange:i,pattern:s,undoManager:o})=>{let r=t.search(s),a=t.match(s)?.[0],n=t.match(/(?:\[(.*?)\])/g)?.[0],l=t.match(/(?:\((.*?)\))/g)?.[0];if(-1===r||!a||!n||!l)return A.gT;let c=i.index-a.length;return e.insertText({index:i.index,length:0}," "),e.setInlineRange({index:i.index+1,length:0}),o.stopCapturing(),e.formatText({index:c,length:n.length},{link:l.slice(1,l.length-1)}),e.deleteText({index:i.index+a.length,length:1}),e.deleteText({index:i.index-l.length-1,length:l.length+1}),e.deleteText({index:c,length:1}),e.setInlineRange({index:c+n.length-1,length:0}),A.rM}}];class vB{constructor(){this._Doc=null,this._customContent=null,this._customIcon=null,this._customTitle=null,this._interactable=!0}setCustomContent(e){this._customContent=e}setCustomIcon(e){this._customIcon=e}setCustomTitle(e){this._customTitle=e}setDoc(e){this._Doc=e}setInteractable(e){this._interactable=e}get customContent(){return this._customContent}get customIcon(){return this._customIcon}get customTitle(){return this._customTitle}get doc(){return this._Doc}get interactable(){return this._interactable}}class v$ extends P.ps{constructor(){super(...arguments),this.inlineManager=new vn,this.referenceNodeConfig=new vB}mounted(){super.mounted(),this.selectionManager.register(N.Gl),this.referenceNodeConfig.setDoc(this.doc);let e=vE(this.referenceNodeConfig);this.inlineManager.registerSpecs(e),this.inlineManager.registerMarkdownMatches(vI)}}let vT={schema:va.S,service:v$,view:{component:(0,th.eu)`affine-data-view`}};var vO=i(94108),vP=i(55134),vH=i(40048);class vA extends P.ps{constructor(){super(...arguments),this.databaseViewInitEmpty=vH._0,this.inlineManager=new vn,this.referenceNodeConfig=new vB,this.viewPresets=N.q_}initDatabaseBlock(e,t,i,s,o=!0){let r=e.getBlockById(i);if((0,H.Z1)(r),(0,vH.Rg)(r,s),o){let i=e.getParent(t);(0,H.Z1)(i),e.addBlock("affine:paragraph",{},i.id)}r.applyColumnUpdate()}mounted(){super.mounted(),this.selectionManager.register(vP.G),this.referenceNodeConfig.setDoc(this.doc);let e=vE(this.referenceNodeConfig);this.inlineManager.registerSpecs(e),this.inlineManager.registerMarkdownMatches(vI)}}let vL={schema:vO.A,service:vA,view:{component:(0,th.eu)`affine-database`}},vD={schema:i(82192).C,view:{component:(0,th.eu)`affine-divider`}};var vZ=i(45170),vj=i(77824);class vV extends P.ps{mounted(){super.mounted(),this.std.spec.slots.afterApply.once(()=>{this.std.spec.getService("affine:page").registerEmbedBlockOptions({flavour:this.flavour,urlRegex:vj.TE,styles:vj.eE,viewType:"embed"})})}}let vz={schema:vZ.S,view:{component:(0,th.eu)`affine-embed-figma-block`},service:vV};var vR=i(23746);class vF extends P.ps{constructor(){super(...arguments),this.queryApiData=(e,t)=>o4(e,t),this.queryUrlData=(e,t)=>o3(e,vF.linkPreviewer,t)}static{this.linkPreviewer=new rs.y}static{this.setLinkPreviewEndpoint=vF.linkPreviewer.setEndpoint}mounted(){super.mounted(),this.std.spec.slots.afterApply.once(()=>{this.std.spec.getService("affine:page").registerEmbedBlockOptions({flavour:this.flavour,urlRegex:oY.EO,styles:oY.js,viewType:"card"})})}}let vN={schema:vR.f,view:{component:(0,th.eu)`affine-embed-github-block`},service:vF};var vq=i(22042);class vU extends P.ps{}let vW={schema:vq.D,view:{component:(0,th.eu)`affine-embed-html-block`},service:vU};var vG=i(61082);class vY extends P.ps{constructor(){super(...arguments),this.queryUrlData=(e,t)=>rz(e,t)}static{this.linkPreviewer=new rs.y}static{this.setLinkPreviewEndpoint=vY.linkPreviewer.setEndpoint}mounted(){super.mounted(),this.std.spec.slots.afterApply.once(()=>{this.std.spec.getService("affine:page").registerEmbedBlockOptions({flavour:this.flavour,urlRegex:rZ.kn,styles:rZ.lE,viewType:"embed"})})}}let vK={schema:vG.L,view:{component:(0,th.eu)`affine-embed-loom-block`},service:vY};var vX=i(29838);class vQ extends P.ps{}let vJ={schema:vX.O,view:{component:(0,th.eu)`affine-embed-synced-doc-block`},service:vQ};var v1=i(58542);class v0 extends P.ps{constructor(){super(...arguments),this.queryUrlData=(e,t)=>r5(e,v0.linkPreviewer,t)}static{this.linkPreviewer=new rs.y}static{this.setLinkPreviewEndpoint=v0.linkPreviewer.setEndpoint}mounted(){super.mounted(),this.std.spec.slots.afterApply.once(()=>{this.std.spec.getService("affine:page").registerEmbedBlockOptions({flavour:this.flavour,urlRegex:r1.iB,styles:r1.R_,viewType:"embed"})})}}let v2={schema:v1.X,view:{component:(0,th.eu)`affine-embed-youtube-block`},service:v0};var v5=i(14558);let v7=a7.Ay.object({blockId:a7.Ay.string()});class v3 extends P.qZ{static{this.group="note"}static{this.type="image"}static fromJSON(e){return v7.parse(e),new v3({blockId:e.blockId})}equals(e){return e instanceof v3&&this.blockId===e.blockId}toJSON(){return{type:this.type,blockId:this.blockId}}}class v4 extends P.ps{constructor(){super(...arguments),this._dragHandleOption={flavour:v5.e.model.flavour,edgeless:!0,onDragStart:({state:e,startDragging:t,anchorBlockPath:i,editorHost:s})=>{let o=i8(e.raw.target);if(o?.classList.contains("resize")||!i)return!1;let r=s.std.view.getBlock(i);if(!r||!(0,tf.o)(r.model,[v5.e.model.flavour]))return!1;let a=!!o?.closest(sf),n=r.contains(o),l=r.isInSurface;if(!l&&(a||n))return s.std.selection.setGroup("note",[s.std.selection.create("block",{blockId:r.blockId})]),t([r],e),!0;if(l&&a){let i=s.std.spec.getService("affine:page"),o=i.viewport.zoom||1,a=r.getBoundingClientRect().width,n=p.z.deserialize(r.model.xywh),l=i.viewport.zoom||1,c=new u.b(n.x*l,n.y*l),d=document.createElement("div");return d.style.borderRadius="4px",d.style.overflow="hidden",d.style.width=`${a/o}px`,(0,L.XX)(r.host.renderModel(r.model),d),t([r],e,d,c),!0}return!1},onDragEnd:e=>{let{state:t,draggingElements:i}=e;if(1!==i.length||!(0,tf.o)(i[0].model,[v5.e.model.flavour]))return!1;let s=i[0],o=s.isInSurface,r=i8(t.raw.target),a=r?.classList.contains("edgeless-container");return o?sh({blockComponent:s,...e}):!!a&&sd({blockComponent:s,cssSelector:".drag-target",...e})}},this._fileDropOptions={flavour:this.flavour,onDrop:async({files:e,targetModel:t,place:i,point:s})=>{let o=e.filter(e=>e.type.startsWith("image/"));if(!o.length)return!1;if(t&&!(0,tf.o)(t,["affine:surface"]))ds(this.host,o,this.maxFileSize,t,i);else if((0,of.Ar)(this.host)){let e=this.rootComponent;if(!(e instanceof fG))return!1;s=e.service.viewport.toViewCoordFromClientCoord(s),await e.addImages(o,s),e.service.telemetryService?.track("CanvasElementAdded",{control:"canvas:drop",page:"whiteboard editor",module:"toolbar",segment:"toolbar",type:"image"})}return!0}},this.maxFileSize=1e7}static{this.setImageProxyURL=e1}mounted(){super.mounted(),this.selectionManager.register(v3),this.fileDropManager=new aN.f(this,this._fileDropOptions),this.disposables.add(sg.registerOption(this._dragHandleOption))}get rootComponent(){let e=this.doc.root;return e?this.std.view.viewFromPath("block",[e.id]):null}}let v6={schema:v5.e,service:v4,view:{component:(0,th.eu)`affine-image`,widgets:{imageToolbar:(0,th.eu)`affine-image-toolbar-widget`}}};var v8=i(47982);function v9(e,t){let i="string"==typeof t?e.getBlock(t).model:t,s=e.getParent(i);if(!s)return[];let o=s.children.indexOf(i);if(-1===o)return[];let r=s.children.findIndex((e,t)=>t>o&&(!(0,tf.o)(e,["affine:list"])||"numbered"!==e.type)),a=s.children.slice(o+1,-1===r?void 0:r);return a.every(e=>(0,tf.o)(e,["affine:list"])&&"numbered"===e.type)?a:[]}function ye(e,t,i=!0){let s="string"==typeof t?e.getBlock(t).model:t;if(!(0,tf.o)(s,["affine:list"])||"numbered"!==s.type$.value)return;let o=()=>{let t=e.getPrev(s);t&&(0,tf.o)(t,["affine:list"])&&"numbered"===t.type?(t.order||(t.order=1),s.order=t.order+1):s.order=1;let i=s.order+1;v9(e,s).forEach(e=>{e.order=i,i++})};i?e.transact(o):o()}let yt=(e,t)=>{let{std:i,id:s,order:o,stopCapturing:r=!0}=e,a=i.host,n=a.doc;r&&a.doc.captureSync();let l=n.getBlock(s).model;if(!l.text)return;let c=n.getParent(l);if(!c)return;let d=c.children.indexOf(l),h=n.getPrev(l),u=o;h&&(0,tf.o)(h,["affine:list"])&&"numbered"===h.type&&n.transact(()=>{h.order||(h.order=1),u=h.order+1});let p=n.addBlock("affine:list",{type:"numbered",text:l.text.clone(),order:u},c,d),f=n.getBlock(p).model;n.deleteBlock(l,{deleteChildren:!1,bringChildrenTo:f});let g=v9(n,f),m=u+1;g.forEach(e=>{n.transact(()=>{e.order=m}),m+=1}),t({list:f})},yi=(e,t)=>{let{blockId:i,inlineIndex:s,std:o}=e,r=o.host,a=r.doc,n=a.getBlock(i).model;if(!(0,tf.o)(n,["affine:list"])){console.error(`block ${i} is not a list block`);return}let l=a.getPrev(n);if(!l)return;let c=a.getNext(n);a.captureSync(),a.moveBlocks([n],l),ye(a,n),c&&ye(a,c),r.updateComplete.then(()=>{r.selection.setGroup("note",[r.selection.create("text",{from:{blockId:i,index:s,length:0},to:null})])}).catch(console.error),t()},ys=(e,t)=>{let{blockId:i,inlineIndex:s,std:o}=e,r=o.host,a=r.doc,n=a.getBlock(i).model;if(!(0,tf.o)(n,["affine:list"])){console.error(`block ${i} is not a list block`);return}let l=a.getParent(n);if(!l){console.error(`block ${i} has no parent`);return}let c=l.children.indexOf(n);if(-1===c){console.error(`block ${i} is not a child of its parent`);return}if(a.captureSync(),0===n.text.length){if("hub"===l.role){let e=a.addBlock("affine:paragraph",{},l,c),i=a.getBlock(e);if(!i)return;a.deleteBlock(n,{bringChildrenTo:i.model});let s=v9(a,i.model),o=1;s.forEach(e=>{a.transact(()=>{e.order=o}),o+=1}),r.updateComplete.then(()=>{r.command.exec("focusBlockStart",{focusBlock:r.view.getBlock(e)})}).catch(console.error),t();return}"content"===l.role&&(r.command.exec("unindentList",{blockId:i,inlineIndex:0}),t());return}let d=null;if(n.children.length>0&&!n.collapsed){let e=n.text.split(s);if(d=a.addBlock("affine:list",{type:n.type,text:e,order:"numbered"===n.type?1:null},n,0),"numbered"===n.type){let e=v9(a,d),t=2;e.forEach(e=>{a.transact(()=>{e.order=t}),t+=1})}}else{let e=n.text.split(s);d=a.addBlock("affine:list",{type:n.type,text:e,order:null},l,c+1),ye(a,d)}if(d){r.updateComplete.then(()=>{r.command.exec("focusBlockStart",{focusBlock:r.view.getBlock(d)})}).catch(console.error),t();return}},yo=(e,t)=>{let{blockId:i,inlineIndex:s,std:o}=e,r=o.host,a=r.doc,n=a.getBlock(i).model;if(!(0,tf.o)(n,["affine:list"])){console.error(`block ${i} is not a list block`);return}let l=a.getParent(n);if(!l){console.error(`block ${i} has no parent`);return}if("content"!==l.role)return;let c=a.getParent(l);if(!c){console.error(`block ${i} has no grand parent`);return}if(-1===l.children.indexOf(n)){console.error(`block ${i} is not a child of its parent`);return}a.captureSync();let d=a.getNexts(n);a.moveBlocks(d,n);let h=d.at(0);h&&ye(a,h),a.moveBlocks([n],c,l,!1),ye(a,n),r.updateComplete.then(()=>{r.selection.setGroup("note",[r.selection.create("text",{from:{blockId:i,index:s,length:0},to:null})])}).catch(console.error),t()},yr=(0,L.AH)` .affine-list-block__prefix { display: flex; color: var(--affine-blue-700); font-size: var(--affine-font-sm); user-select: none; position: relative; } .affine-list-block__numbered { min-width: 22px; height: 24px; margin-left: 2px; } .affine-list-block__todo-prefix { display: flex; align-items: center; cursor: pointer; width: 24px; height: 24px; color: var(--affine-icon-color); } .affine-list-block__todo-prefix.readonly { cursor: default; } .affine-list-block__todo-prefix > svg { width: 20px; height: 20px; } `,ya=(0,L.AH)` .toggle-icon { display: flex; align-items: center; height: 16px; margin: 4px 0; position: absolute; left: 0; transform: translateX(-100%); border-radius: 4px; cursor: pointer; opacity: 0; transition: opacity 0.2s ease-in-out; } .toggle-icon:hover { background: var(--affine-hover-color); } .affine-list-rich-text-wrapper:hover .toggle-icon { opacity: 1; } .toggle-icon__collapsed { opacity: 1; } .with-drag-handle .affine-list-rich-text-wrapper .toggle-icon { opacity: 1; } .with-drag-handle .affine-block-children-container .toggle-icon { opacity: 0; } .affine-list__collapsed { display: none; } `,yn=(0,L.AH)` affine-list { display: block; font-size: var(--affine-font-base); } .affine-list-block-container { box-sizing: border-box; border-radius: 4px; position: relative; } .affine-list-block-container .affine-list-block-container { margin-top: 0; } .affine-list-rich-text-wrapper { position: relative; display: flex; } .affine-list-rich-text-wrapper rich-text { flex: 1; } .affine-list--checked { color: var(--affine-text-secondary-color); } ${yr} ${ya} `;var yl=i(80796);let yc=e=>{let t=0,i=e.doc.getParent(e);for(;i?.flavour===e.flavour;)t++,i=e.doc.getParent(i);return t};function yd(e,t,i){let s=yc(e);switch(e.type){case"bulleted":return(0,L.qy)`
    ${yl.R2[s%yl.R2.length]}
    `;case"numbered":return(0,L.qy)`
    ${e.order?function(e,t){let i=function(e,t){let i=[()=>t,()=>(function(e){let t="";for(;e>=0;)t=String.fromCharCode(e%26+97)+t,e=Math.floor(e/26)-1;return t})(t-1),()=>(function(e){let t={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1},i="";for(let s in t)for(;e>=t[s];)i+=s,e-=t[s];return i})(t)];return i[e%i.length]()}(t,e);return`${i}.`}(e.order,s):"1."}
    `;case"todo":return(0,L.qy)`
    ${e.checked?(0,yl.xY)():(0,yl.wb)()}
    `;case"toggle":return(0,L.qy)`
    ${t?yl.l_:yl.fp}
    `;default:return console.error("Unknown list type",e.type,e),null}}class yh extends P.ps{constructor(){super(...arguments),this.inlineManager=new vn,this.referenceNodeConfig=new vB,this.styles={icon:yd,prefix:yr,toggle:ya}}mounted(){super.mounted(),this.std.command.add("convertToNumberedList",yt),this.std.command.add("splitList",ys),this.std.command.add("unindentList",yo),this.std.command.add("indentList",yi),this.referenceNodeConfig.setDoc(this.doc);let e=vE(this.referenceNodeConfig);this.inlineManager.registerSpecs(e),this.inlineManager.registerMarkdownMatches(vI),this.disposables.add(sg.registerOption({flavour:v8.z.model.flavour,onDragEnd:({draggingElements:e,editorHost:t})=>(e.forEach(e=>{let i=e.model,s=e.doc;if((0,tf.o)(i,["affine:list"])&&"numbered"===i.type){let o=e.doc.getNext(i);t.updateComplete.then(()=>{ye(s,i),o&&ye(s,o)}).catch(console.error)}}),!1)}))}}let yu={schema:v8.z,view:{component:(0,th.eu)`affine-list`},service:yh},yp=(e,t)=>{let{focusBlock:i,std:s}=e;if(!i||!i.model.text)return;let{selection:o}=s;return o.setGroup("note",[o.create("text",{from:{blockId:i.blockId,index:i.model.text.length,length:0},to:null})]),t()},yf=(e,t)=>{let{focusBlock:i,std:s}=e;if(!i||!i.model.text)return;let{selection:o}=s;return o.setGroup("note",[o.create("text",{from:{blockId:i.blockId,index:0,length:0},to:null})]),t()},yg=(e,t)=>{let{std:i,flavour:s,props:o}=e,r=i.host,a=i.doc,n=(()=>{let{selectedBlocks:t}=e;if(null==t){let[e,s]=i.command.chain().tryAll(e=>[e.getTextSelection(),e.getBlockSelections()]).getSelectedBlocks({types:["text","block"]}).run();e&&(t=s.selectedBlocks)}return t})();if(!n||0===n.length)return!1;let l=n.map(e=>e.model);n.every(e=>e.doc===a)||console.error("Not all models have the same doc instance, the result for update text type may not be correct",n);let c=(e,t)=>{if("affine:code"!==s)return;let i=function(e){if(0===e.length)return null;let t=e[0].doc,i=t.getParent(e[0]);if(!i)return null;let s=i.children.indexOf(e[0]),o=e.map(e=>e.text instanceof f.EY?e.text.toString():null).filter(Boolean).join("\n");return e.map(e=>t.deleteBlock(e)),t.addBlock("affine:code",{text:new f.EY(o)},i,s)}(l);if(!i)return;let o=a.getBlockById(i);if(o)return(0,O.xw)(r,o,{index:o.text?.length??0,length:0}).catch(console.error),t({updatedBlocks:[o]})},d=(e,t)=>{if("affine:divider"!==s)return!1;let i=l.at(-1);if(!i)return t({updatedBlocks:[]});let o=a.getParent(i);if(!o)return t({updatedBlocks:[]});let n=o.children.indexOf(i),c=a.getNext(i),d=c?.id,h=a.addBlock("affine:divider",{},o,n+1);c||(d=a.addBlock("affine:paragraph",{},o)),O.Km(r,d)?.catch(console.error);let u=a.getBlockById(h);return t(u?{updatedBlocks:[u]}:{updatedBlocks:[]})},h=(e,t)=>{let{updatedBlocks:i}=e;if(!i||0===i.length)return!1;let s=i[0],o=i[i.length-1],a=i.map(e=>gH(r,e)),n=r.selection,l=n.find("text");if(!l)return!1;let c=n.create("text",{from:{blockId:s.id,index:l.from.index,length:l.from.length},to:l.to?{blockId:o.id,index:l.to.index,length:l.to.length}:null});return Promise.all(a).then(()=>{n.setGroup("note",[c])}).catch(console.error),t()},u=(e,t)=>{let{updatedBlocks:i}=e;if(!i||0===i.length)return!1;let s=r.selection;return 0!==s.filter("block").length&&(requestAnimationFrame(()=>{let e=i.map(e=>s.create("block",{blockId:e.id}));s.setGroup("note",e)}),t())},[p,g]=i.command.chain().inline((e,t)=>(a.captureSync(),t())).try(e=>[e.inline(c),e.inline(d),e.inline((e,t)=>{let i=[];return l.forEach(e=>{if(!(0,O.op)(e,["affine:paragraph","affine:list","affine:code"]))return;if(e.flavour===s){a.updateBlock(e,o??{}),i.push(e);return}let t=lw(e,s,o),r=a.getBlockById(t);r&&i.push(r)}),t({updatedBlocks:i})})]).try(e=>[e.inline((e,t)=>!!["affine:code","affine:divider"].includes(s)&&t()),e.inline(h),e.inline(u),e.inline((e,t)=>t())]).run();return!!p&&t({updatedBlocks:g.updatedBlocks})},ym=(e,t)=>{let{focusBlock:i,std:s}=e;if(!i)return;let{selection:o}=s;return o.setGroup("note",[o.create("block",{blockId:i.blockId})]),t()},yv=(e,t)=>{let{focusBlock:i,anchorBlock:s,tail:o}=e;if(!i||!s)return;let r=e.std.selection;if(s.blockId===i.blockId){let e=i.blockId;return r.setGroup("note",[r.create("block",{blockId:e})]),t()}let a=[...r.value];a.every(e=>e.blockId!==i.blockId)&&(o?a.push(r.create("block",{blockId:i.blockId})):a.unshift(r.create("block",{blockId:i.blockId})));let n=!1,l=a.filter(e=>e.blockId===s.blockId||e.blockId===i.blockId?(n=!n,!0):n);return r.setGroup("note",l),t()},yy=am("bold"),yb=am("italic"),yw=am("underline"),yx=am("strike"),y_=am("code"),yC=(e,t)=>{let i=document.getSelection();if(!i||0===i.rangeCount)return!1;let s=i.getRangeAt(0);if(s.collapsed)return!1;let o=s.startContainer.parentElement?.closest(`[${A.jN}]`);if(!o)return!1;let r=o.inlineEditor,a=r.getInlineRange();if(!a||0===a.length)return!1;if(r.getFormat(a).link)return r.formatText(a,{link:null}),t();let n=new AbortController,l=vm(r,"create",a,n);return n.signal.addEventListener("abort",()=>l.remove()),t()},yk=(e,t)=>{let[i,s]=aw(e.std.command.chain()).run();return!!i&&t({textStyle:s.textStyle})},yS=(e,t)=>{let i=e.key,[s]=aw(e.std.command.chain()).inline((e,t)=>{let{textStyle:s}=e;return!!s&&i in s&&t()}).run();return!!s&&t()},yM=e=>{e.command.add("toggleBold",yy).add("toggleItalic",yb).add("toggleUnderline",yw).add("toggleStrike",yx).add("toggleCode",y_).add("toggleLink",yC).add("getTextStyle",yk).add("isTextStyleActive",yS)};class yE extends P.ps{constructor(){super(...arguments),this._dragHandleOption={flavour:ue.h.model.flavour,edgeless:!0,onDragStart:({state:e,startDragging:t,anchorBlockPath:i,editorHost:s})=>{if(!i)return!1;let o=i8(e.raw.target);if(!o?.closest(sf))return!1;let r=s.std.view.getBlock(i);if(!r||!(0,tf.o)(r.model,[ue.h.model.flavour]))return!1;let a=s.std.spec.getService("affine:page"),n=a?.viewport.zoom??1,l=document.createElement("div"),c=p.z.deserialize(r.model.xywh),d=new u.b(c.x*n,c.y*n);return(0,L.XX)(r.host.renderModel(r.model),l),t([r],e,l,d),!0},onDragEnd:({draggingElements:e,dropBlockId:t,dropType:i,state:s,editorHost:o})=>{if(1!==e.length||!(0,tf.o)(e[0].model,[ue.h.model.flavour]))return!1;if("in"===i)return!0;let r=e[0].model,a=o.doc.getBlockById(t),n=o.doc.getParent(t);if(!a||!n)return!0;if(s.raw.altKey){let e=sc(r.children),t=n.children.indexOf(a)+("after"===i?1:0);o.doc.addBlocks(e,n,t)}else o.doc.moveBlocks(r.children,n,a,"before"===i),o.doc.deleteBlock(r),o.selection.setGroup("gfx",[]);return!0}}}mounted(){super.mounted(),this.std.command.add("selectBlocksBetween",yv).add("selectBlock",ym).add("focusBlockStart",yf).add("focusBlockEnd",yp).add("updateBlockType",yg),yM(this.std),this.disposables.add(sg.registerOption(this._dragHandleOption))}}let yI={schema:ue.h,service:yE,view:{component:(0,th.eu)`affine-note`}},yB={schema:ue.h,service:yE,view:{component:(0,th.eu)`affine-edgeless-note`}};var y$=i(98452);class yT extends P.ps{constructor(){super(...arguments),this.inlineManager=new vn,this.placeholderGenerator=e=>"text"===e.type?"Type '/' for commands":({h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",quote:""})[e.type],this.referenceNodeConfig=new vB}mounted(){super.mounted(),this.referenceNodeConfig.setDoc(this.doc);let e=vE(this.referenceNodeConfig);this.inlineManager.registerSpecs(e),this.inlineManager.registerMarkdownMatches(vI)}}let yO={schema:y$.x,view:{component:(0,th.eu)`affine-paragraph`},service:yT},yP=[yu,yI,vL,vT,vD,vr,v6,yO,vo,vi,vz,vN,v2,vK,vW,vJ,rD],yH=[yu,yB,vL,vT,vD,vr,v6,yO,vo,vi,vz,vN,v2,vK,vW,vJ,rD],yA=[mX,...yH,m3,ve,iI,iM],yL=[mQ,...yH,m3,ve,iI,iM],yD={schema:iB.x,service:nC,view:{component:(0,th.eu)`affine-page-root`,widgets:{[hM]:(0,th.eu)`${(0,th.Bk)(hM)}`,[hu]:(0,th.eu)`${(0,th.Bk)(hu)}`,[mH]:(0,th.eu)`${(0,th.Bk)(mH)}`,[hw]:(0,th.eu)`${(0,th.Bk)(hw)}`,[sf]:(0,th.eu)`${(0,th.Bk)(sf)}`,[ag]:(0,th.eu)`${(0,th.Bk)(ag)}`,[az]:(0,th.eu)`${(0,th.Bk)(az)}`,[iD]:(0,th.eu)`${(0,th.Bk)(iD)}`,[hB]:(0,th.eu)`${(0,th.Bk)(hB)}`,[nM]:(0,th.eu)`${(0,th.Bk)(nM)}`}}},yZ=[yD,...yP,m7,m9],yj=[{schema:iB.x,service:nC,view:{component:(0,th.eu)`affine-preview-root`}},...yP,m7,m9];(0,td.lQ)(oG),(0,td.lQ)(rt);var yV=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},yz=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("embed-html-fullscreen-toolbar")],n=[],l=L.WF,c=[],d=[],h=[],u=[],p=[],f=[],g=[],m=[];(class extends l{static{t=this}static{let v="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.P)(".fullscreen-toolbar-container")],o=[(0,D.wk)()],r=[(0,D.MZ)({attribute:!1})],yV(this,null,i,{kind:"accessor",name:"_copied",static:!1,private:!1,access:{has:e=>"_copied"in e,get:e=>e._copied,set:(e,t)=>{e._copied=t}},metadata:v},c,d),yV(this,null,s,{kind:"accessor",name:"_fullScreenToolbarContainer",static:!1,private:!1,access:{has:e=>"_fullScreenToolbarContainer"in e,get:e=>e._fullScreenToolbarContainer,set:(e,t)=>{e._fullScreenToolbarContainer=t}},metadata:v},h,u),yV(this,null,o,{kind:"accessor",name:"_popperVisible",static:!1,private:!1,access:{has:e=>"_popperVisible"in e,get:e=>e._popperVisible,set:(e,t)=>{e._popperVisible=t}},metadata:v},p,f),yV(this,null,r,{kind:"accessor",name:"embedHtml",static:!1,private:!1,access:{has:e=>"embedHtml"in e,get:e=>e.embedHtml,set:(e,t)=>{e.embedHtml=t}},metadata:v},g,m),yV(null,e={value:t},a,{kind:"class",name:t.name,metadata:v},null,n),t=e.value,v&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:v})}static{this.styles=(0,L.AH)` :host { box-sizing: border-box; position: absolute; z-index: 1; left: 50%; transform: translateX(-50%); bottom: 0; -webkit-user-select: none; user-select: none; } .toolbar-toggle-control { padding-bottom: 20px; } .toolbar-toggle-control[data-auto-hide='true'] { transition: 0.27s ease; padding-top: 100px; transform: translateY(100px); } .toolbar-toggle-control[data-auto-hide='true']:hover { padding-top: 0; transform: translateY(0); } .fullscreen-toolbar-container { background: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-menu-shadow); border: 1px solid var(--affine-border-color); border-radius: 40px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 20px; height: 64px; } .short-v-divider { display: inline-block; background-color: var(--affine-border-color); width: 1px; height: 36px; } `}get autoHideToolbar(){return this.embedHtml.rootService?.editPropsStore.getStorage("autoHideEmbedHTMLFullScreenToolbar")??!1}set autoHideToolbar(e){this.embedHtml.rootService?.editPropsStore.setStorage("autoHideEmbedHTMLFullScreenToolbar",e)}render(){let e=!this._popperVisible&&this.autoHideToolbar;return(0,L.qy)`
    ${sv.EI} ${sm.Ze}
    ${this._copied?G.eqL:sv.Td}
    `}#ly;get _copied(){return this.#ly}set _copied(e){this.#ly=e}#lb;get _fullScreenToolbarContainer(){return this.#lb}set _fullScreenToolbarContainer(e){this.#lb=e}#lw;get _popperVisible(){return this.#lw}set _popperVisible(e){this.#lw=e}#lx;get embedHtml(){return this.#lx}set embedHtml(e){this.#lx=e}constructor(){super(...arguments),this._popSettings=()=>{this._popperVisible=!0,(0,U.zs)(this._fullScreenToolbarContainer,{options:{items:[{type:"custom",render:()=>(0,L.qy)`
    Settings
    `},{type:"group",name:"thing",children:()=>[{type:"toggle-switch",name:"Hide toolbar",on:this.autoHideToolbar,onChange:e=>{this.autoHideToolbar=e}}]}],onClose:()=>{this._popperVisible=!1}},placement:"top-end",middleware:[(0,sI.UU)(),(0,sI.cY)({mainAxis:4,crossAxis:-40})],container:this.embedHtml.iframeWrapper})},this.copyCode=()=>{this._copied||this.embedHtml.std.clipboard.writeToClipboard(e=>(e["text/plain"]=this.embedHtml.model.html??"",e)).then(()=>{this._copied=!0,setTimeout(()=>this._copied=!1,1500)}).catch(console.error)},this.#ly=yz(this,c,!1),this.#lb=(yz(this,d),yz(this,h,void 0)),this.#lw=(yz(this,u),yz(this,p,!1)),this.#lx=(yz(this,f),yz(this,g,void 0)),yz(this,m)}static{yz(t,n)}})})();var yR=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},yF=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("affine-embed-html-block")],a=[],n=oF,l=[],c=[],d=[],h=[],u=[],f=[];return class extends n{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.P)(".embed-html-block-iframe-wrapper")],yR(this,null,i,{kind:"accessor",name:"_isSelected",static:!1,private:!1,access:{has:e=>"_isSelected"in e,get:e=>e._isSelected,set:(e,t)=>{e._isSelected=t}},metadata:p},l,c),yR(this,null,s,{kind:"accessor",name:"_showOverlay",static:!1,private:!1,access:{has:e=>"_showOverlay"in e,get:e=>e._showOverlay,set:(e,t)=>{e._showOverlay=t}},metadata:p},d,h),yR(this,null,o,{kind:"accessor",name:"iframeWrapper",static:!1,private:!1,access:{has:e=>"iframeWrapper"in e,get:e=>e.iframeWrapper,set:(e,t)=>{e.iframeWrapper=t}},metadata:p},u,f),yR(null,e={value:t},r,{kind:"class",name:t.name,metadata:p},null,a),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=h8}_handleClick(e){e.stopPropagation(),this.isInSurface||this._selectBlock()}_handleDoubleClick(e){e.stopPropagation(),this.open()}_selectBlock(){let e=this.host.selection,t=e.create("block",{blockId:this.blockId});e.setGroup("note",[t])}connectedCallback(){super.connectedCallback(),this.disposables.add(this.std.selection.slots.changed.on(()=>{this._isSelected=!!this.selected?.is("block")||!!this.selected?.is("surface"),this._showOverlay=this._isResizing||this._isDragging||!this._isSelected})),this.handleEvent("dragStart",()=>{this._isDragging=!0,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}),this.handleEvent("dragEnd",()=>{this._isDragging=!1,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}),this.isInSurface&&(this.disposables.add(this.model.propsUpdated.on(()=>{this.requestUpdate()})),this.rootService?.slots.elementResizeStart.on(()=>{this._isResizing=!0,this._showOverlay=!0}),this.rootService?.slots.elementResizeEnd.on(()=>{this._isResizing=!1,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}))}renderBlock(){let{style:e,xywh:t}=this.model;this._cardStyle=e;let i=p.z.deserialize(t);this._width=this.isInSurface?i.w:eh.Cd[e],this._height=this.isInSurface?i.h:eh.Hn[e];let s=` ${this.model.html} `;return this.renderEmbed(()=>this.model.html?(0,L.qy)`
    ${h9}
    ${"Basic HTML Page Structure"}
    `:(0,L.qy)`
    Empty
    `)}#i9;get _isSelected(){return this.#i9}set _isSelected(e){this.#i9=e}#sr;get _showOverlay(){return this.#sr}set _showOverlay(e){this.#sr=e}#l_;get iframeWrapper(){return this.#l_}set iframeWrapper(e){this.#l_=e}constructor(){super(...arguments),this._cardStyle="html",this._isDragging=!1,this._isResizing=!1,this.close=()=>{document.exitFullscreen().catch(console.error)},this.open=()=>{this.iframeWrapper?.requestFullscreen().catch(console.error)},this.refreshData=()=>{},this.#i9=yF(this,l,!1),this.#sr=(yF(this,c),yF(this,d,!0)),this.#l_=(yF(this,h),yF(this,u,void 0)),yF(this,f)}static{yF(t,a)}},t})();i(58280),(0,td.lQ)(yN),(0,td.lQ)(rU),(0,td.lQ)(r8),iU.f.getInstance().addSpec("page",yZ),iU.f.getInstance().addSpec("edgeless",yA),iU.f.getInstance().addSpec("page:preview",yj),iU.f.getInstance().addSpec("edgeless:preview",yL);var yq=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},yU=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("surface-ref-generic-block-portal")],a=[],n=(0,P.Tm)(P.ao),l=[],c=[],d=[],h=[],u=[],f=[];(class extends n{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],yq(this,null,i,{kind:"accessor",name:"index",static:!1,private:!1,access:{has:e=>"index"in e,get:e=>e.index,set:(e,t)=>{e.index=t}},metadata:p},l,c),yq(this,null,s,{kind:"accessor",name:"model",static:!1,private:!1,access:{has:e=>"model"in e,get:e=>e.model,set:(e,t)=>{e.model=t}},metadata:p},d,h),yq(this,null,o,{kind:"accessor",name:"renderModel",static:!1,private:!1,access:{has:e=>"renderModel"in e,get:e=>e.renderModel,set:(e,t)=>{e.renderModel=t}},metadata:p},u,f),yq(null,e={value:t},r,{kind:"class",name:t.name,metadata:p},null,a),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=(0,L.AH)` surface-ref-generic-block-portal { position: relative; } `}firstUpdated(){this.disposables.add(this.model.propsUpdated.on(()=>this.requestUpdate()))}render(){let{model:e,index:t}=this,i=p.z.deserialize(e.xywh),s={position:"absolute",zIndex:`${t}`,width:`${i.w}px`,height:`${i.h}px`,transform:`translate(${i.x}px, ${i.y}px)`};return(0,th.qy)`
    ${this.renderModel(e)}
    `}#i=yU(this,l,void 0);get index(){return this.#i}set index(e){this.#i=e}#iJ=(yU(this,c),yU(this,d,void 0));get model(){return this.#iJ}set model(e){this.#iJ=e}#lC=(yU(this,h),yU(this,u,void 0));get renderModel(){return this.#lC}set renderModel(e){this.#lC=e}constructor(){super(...arguments),yU(this,f)}static{yU(t,a)}})})();var yW=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},yG=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("surface-ref-note-portal")],n=[],l=(0,P.Tm)(P.ao),c=[],d=[],u=[],p=[],g=[],m=[],v=[],y=[];(class extends l{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],yW(this,null,i,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:h},c,d),yW(this,null,s,{kind:"accessor",name:"index",static:!1,private:!1,access:{has:e=>"index"in e,get:e=>e.index,set:(e,t)=>{e.index=t}},metadata:h},u,p),yW(this,null,o,{kind:"accessor",name:"model",static:!1,private:!1,access:{has:e=>"model"in e,get:e=>e.model,set:(e,t)=>{e.model=t}},metadata:h},g,m),yW(this,null,r,{kind:"accessor",name:"renderer",static:!1,private:!1,access:{has:e=>"renderer"in e,get:e=>e.renderer,set:(e,t)=>{e.renderer=t}},metadata:h},v,y),yW(null,e={value:t},a,{kind:"class",name:t.name,metadata:h},null,n),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` surface-ref-note-portal { position: relative; } `}connectedCallback(){super.connectedCallback();let e=new Set,t=this.model;for(;t;)this.ancestors.add(t.id),t=this.model.doc.getParent(t.id);let i={mode:"include",match:Array.from(e).map(e=>({id:e,viewType:f.lv.Display}))};this.query=i;let s=this.model.doc;this._disposables.add(()=>{s.blockCollection.clearQuery(i,!0)})}firstUpdated(){this.disposables.add(this.model.propsUpdated.on(()=>this.requestUpdate()))}render(){let{model:e,index:t}=this,{displayMode:i,edgeless:s,doc:o}=e;if(i&&i===e$.ko.DocOnly)return L.s6;let r=`${W.KI}`;o.awarenessStore.getFlag("enable_color_picker")?r=this.renderer.getColorValue(e.background,r):"string"==typeof e.background&&(r=e.background);let[a,n,l,c]=(0,h.W)(e.xywh),d={zIndex:`${t}`,width:l+"px",height:s.collapse&&s.collapsedHeight?s.collapsedHeight+"px":void 0,transform:`translate(${a}px, ${n}px)`,padding:`${eh.ei}px`,border:`${eh.m9}px none var(--affine-black-10)`,background:r.startsWith("--")?`var(${r})`:r,boxShadow:"var(--affine-note-shadow-sticker)",position:"absolute",borderRadius:"0px",boxSizing:"border-box",pointerEvents:"none",overflow:"hidden",transformOrigin:"0 0",userSelect:"none"};return(0,th.qy)`
    ${this.renderPreview()}
    `}renderPreview(){if(!this.query)return console.error("Query is not set before rendering note preview"),L.s6;let e=this.model.doc.blockCollection.getDoc({query:this.query,readonly:!0}),t=iU.f.getInstance().getSpec("page:preview");return this.host.renderSpecPortal(e,t.value.slice())}updated(){setTimeout(()=>{let e=Array.from(this.querySelectorAll("[contenteditable]")),t=Array.from(this.querySelectorAll("[data-block-id]"));e.forEach(e=>{"true"===e.contentEditable&&(e.contentEditable="false")}),t.forEach(e=>{e.setAttribute(P.vz.rangeQueryExcludeAttr,"true")})},500)}#n;get host(){return this.#n}set host(e){this.#n=e}#i;get index(){return this.#i}set index(e){this.#i=e}#iJ;get model(){return this.#iJ}set model(e){this.#iJ=e}#lk;get renderer(){return this.#lk}set renderer(e){this.#lk=e}constructor(){super(...arguments),this.ancestors=new Set,this.query=null,this.#n=yG(this,c,void 0),this.#i=(yG(this,d),yG(this,u,void 0)),this.#iJ=(yG(this,p),yG(this,g,void 0)),this.#lk=(yG(this,m),yG(this,v,void 0)),yG(this,y)}static{yG(t,n)}})})();var yY=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},yK=function(e,t,i){for(var s=arguments.length>2,o=0;oyX[e.flavour]??"surface-ref-generic-block-portal",yJ=(()=>{let e,t,i,s,o,r,a,n,l,c=[(0,D.EM)("surface-ref-portal")],d=[],h=(0,P.Tm)(P.ao),u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[];return class extends h{static{t=this}static{let M="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,D.P)(".stacking-canvas")],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.P)(".surface-blocks-portal")],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],yY(this,null,i,{kind:"accessor",name:"canvasSlot",static:!1,private:!1,access:{has:e=>"canvasSlot"in e,get:e=>e.canvasSlot,set:(e,t)=>{e.canvasSlot=t}},metadata:M},u,p),yY(this,null,s,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:M},f,g),yY(this,null,o,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:M},m,v),yY(this,null,r,{kind:"accessor",name:"portal",static:!1,private:!1,access:{has:e=>"portal"in e,get:e=>e.portal,set:(e,t)=>{e.portal=t}},metadata:M},y,b),yY(this,null,a,{kind:"accessor",name:"refModel",static:!1,private:!1,access:{has:e=>"refModel"in e,get:e=>e.refModel,set:(e,t)=>{e.refModel=t}},metadata:M},w,x),yY(this,null,n,{kind:"accessor",name:"renderModel",static:!1,private:!1,access:{has:e=>"renderModel"in e,get:e=>e.renderModel,set:(e,t)=>{e.renderModel=t}},metadata:M},_,C),yY(this,null,l,{kind:"accessor",name:"renderer",static:!1,private:!1,access:{has:e=>"renderer"in e,get:e=>e.renderer,set:(e,t)=>{e.renderer=t}},metadata:M},k,S),yY(null,e={value:t},c,{kind:"class",name:t.name,metadata:M},null,d),t=e.value,M&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:M})}static{this.styles=(0,L.AH)` .surface-blocks-portal { pointer-events: none; position: absolute; left: 0; top: 0; transform-origin: 0 0; } .stacking-canvas { position: absolute; left: 0; top: 0; } .stacking-canvas > canvas { transform: var(--stacking-canvas-transform); transform-origin: 0 0; position: absolute; left: 0; top: 0; } `}_getBlocksInGroup(e){return Array.from(e.childIds).map(e=>this.doc.getBlockById(e)).filter(e=>e)}render(){return(0,L.qy)`
    ${this._renderGfxBlocks()}
    `}setStackingCanvas(e){this.canvasSlot&&this.canvasSlot.replaceChildren(...e)}get surfaceService(){return this.host.std.spec.getService("affine:surface")}#lS;get canvasSlot(){return this.#lS}set canvasSlot(e){this.#lS=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}#n;get host(){return this.#n}set host(e){this.#n=e}#lM;get portal(){return this.#lM}set portal(e){this.#lM=e}#lE;get refModel(){return this.#lE}set refModel(e){this.#lE=e}#lC;get renderModel(){return this.#lC}set renderModel(e){this.#lC=e}#lk;get renderer(){return this.#lk}set renderer(e){this.#lk=e}constructor(){super(...arguments),this._getBlocksInFrame=e=>{let t=e.elementBound;return this.surfaceService?.layer.blocksGrid.search(t)??[]},this._renderGfxBlocks=()=>{let e=this.refModel,t="flavour"in e?this._getBlocksInFrame(e):this._getBlocksInGroup(e),i=this.surfaceService?.layer.layers.filter(e=>"block"===e.type)??[],s=0,o=0;return(0,t$.u)(t,e=>e.id,(e,t)=>{let r=(0,th.eu)`${(0,th.Bk)(yQ(e))}`,a=i[s];if(!i[s].set.has(e)){for(;!a.set.has(e);)a=i[++s];o=0}let n=a.zIndex+o++;return(0,th.qy)`<${r} .index=${t} .model=${e} .doc=${this.doc} .host=${this.host} .renderer=${this.renderer} .renderModel=${this.renderModel} style=${(0,Z.W)({"z-index":n})} >`})},this.setViewport=e=>{this.requestUpdate(),this.updateComplete.then(()=>{this.portal?.style.setProperty("transform",`translate(${e.translateX}px, ${e.translateY}px) scale(${e.zoom})`),this.portal?.style.setProperty("transform-origin","0 0"),this.canvasSlot?.style.setProperty("--stacking-canvas-transform",`scale(${1/e.zoom}) translate(${-e.translateX}px, ${-e.translateY}px)`)}).catch(console.error)},this.#lS=yK(this,u,void 0),this.#d=(yK(this,p),yK(this,f,void 0)),this.#n=(yK(this,g),yK(this,m,void 0)),this.#lM=(yK(this,v),yK(this,y,void 0)),this.#lE=(yK(this,b),yK(this,w,void 0)),this.#lC=(yK(this,x),yK(this,_,void 0)),this.#lk=(yK(this,C),yK(this,k,void 0)),yK(this,S)}static{yK(t,d)}},t})();var y1=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},y0=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d,u,g=[(0,D.EM)("frame-preview")],m=[],v=(0,P.Tm)(P.ao),y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],H=[],A=[],j=[],V=[],z=[];return class extends v{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(v[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.P)(".frame-preview-surface-container surface-ref-portal")],o=[(0,D.P)(".frame-preview-surface-canvas-container")],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.wk)()],l=[(0,D.MZ)({attribute:!1})],c=[(0,D.MZ)({attribute:!1})],d=[(0,D.MZ)({attribute:!1})],u=[(0,D.MZ)({attribute:!1})],y1(this,null,i,{kind:"accessor",name:"_surfaceModel",static:!1,private:!1,access:{has:e=>"_surfaceModel"in e,get:e=>e._surfaceModel,set:(e,t)=>{e._surfaceModel=t}},metadata:h},y,b),y1(this,null,s,{kind:"accessor",name:"blocksPortal",static:!1,private:!1,access:{has:e=>"blocksPortal"in e,get:e=>e.blocksPortal,set:(e,t)=>{e.blocksPortal=t}},metadata:h},w,x),y1(this,null,o,{kind:"accessor",name:"container",static:!1,private:!1,access:{has:e=>"container"in e,get:e=>e.container,set:(e,t)=>{e.container=t}},metadata:h},_,C),y1(this,null,r,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:h},k,S),y1(this,null,a,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:h},M,E),y1(this,null,n,{kind:"accessor",name:"fillScreen",static:!1,private:!1,access:{has:e=>"fillScreen"in e,get:e=>e.fillScreen,set:(e,t)=>{e.fillScreen=t}},metadata:h},I,B),y1(this,null,l,{kind:"accessor",name:"frame",static:!1,private:!1,access:{has:e=>"frame"in e,get:e=>e.frame,set:(e,t)=>{e.frame=t}},metadata:h},$,T),y1(this,null,c,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:h},O,H),y1(this,null,d,{kind:"accessor",name:"surfaceHeight",static:!1,private:!1,access:{has:e=>"surfaceHeight"in e,get:e=>e.surfaceHeight,set:(e,t)=>{e.surfaceHeight=t}},metadata:h},A,j),y1(this,null,u,{kind:"accessor",name:"surfaceWidth",static:!1,private:!1,access:{has:e=>"surfaceWidth"in e,get:e=>e.surfaceWidth,set:(e,t)=>{e.surfaceWidth=t}},metadata:h},V,z),y1(null,e={value:t},g,{kind:"class",name:t.name,metadata:h},null,m),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=y2}_attachRenderer(){!this._surfaceRefRenderer?.surfaceRenderer.canvas.isConnected&&this.container&&this.blocksPortal&&(this.surfaceRenderer.viewport.setContainer(this.container),this.surfaceRenderer.attach(this.container),this.blocksPortal.isUpdatePending?this.blocksPortal.updateComplete.then(()=>{this.blocksPortal.setStackingCanvas(this._surfaceRefRenderer.surfaceRenderer.stackingCanvas)}).catch(console.error):this.blocksPortal.setStackingCanvas(this._surfaceRefRenderer.surfaceRenderer.stackingCanvas))}_cleanupSurfaceRefRenderer(){let e=this._surfaceRefService;e&&e.removeRenderer(this._surfaceRefRendererId)}_refreshViewport(){if(!this.frame||!this._surfaceService)return;let e=this.frame;this.updateComplete.then(()=>{this.surfaceRenderer.viewport.onResize(),this.surfaceRenderer.viewport.setViewportByBound(p.z.fromXYWH((0,h.W)(e.xywh))),this.blocksPortal?.setViewport(this.surfaceRenderer.viewport)}).catch(console.error)}_renderSurfaceContent(e){let{width:t,height:i}=this._getViewportWH(e),s=this.surfaceRenderer.generateColorProperty(e.background,"--affine-platte-transparent");return(0,L.qy)`
    `}_setDocDisposables(e){this._clearDocDisposables(),this._docDisposables=new eg.K,this._docDisposables.add(e.slots.blockUpdated.on(t=>{let{type:i}=t;if("update"===i)return;let s=e.getBlockById(t.id);if(!s||!(0,tE.Te)(s)||!s.xywh)return;let o=p.z.deserialize(this.frame.xywh),r=p.z.deserialize(s.xywh);o.containsPoint([r.x,r.y])&&this._refreshViewport()}))}_setEdgelessDisposables(e){this._clearEdgelessDisposables(),e&&(this._edgelessDisposables=new eg.K,this._edgelessDisposables.add(e.slots.navigatorSettingUpdated.on(({fillScreen:e})=>{void 0!==e&&(this.fillScreen=e,this._refreshViewport())})),this._edgelessDisposables.add(e.service.surface.elementAdded.on(({id:e})=>{this._overlapWithFrame(e)&&this._refreshViewport()})),this._edgelessDisposables.add(e.service.surface.elementUpdated.on(this._debounceHandleElementUpdated)),this._edgelessDisposables.add(e.service.surface.elementRemoved.on(()=>this._refreshViewport())))}_setFrameDisposables(e){this._clearFrameDisposables(),this._frameDisposables=new eg.K,this._frameDisposables.add(e.propsUpdated.on(()=>{this.requestUpdate(),this._refreshViewport()}))}_setupSurfaceRefRenderer(){let e=this._surfaceRefService;if(!e)return;let t=e.getRenderer(this._surfaceRefRendererId,this.doc,!0);this._surfaceRefRenderer=t,this._disposables.add(t.slots.surfaceModelChanged.on(e=>{this._surfaceModel=e})),this._disposables.add(t.slots.surfaceRendererRefresh.on(()=>{this.requestUpdate()})),this._disposables.add(this._surfaceRefRenderer.surfaceService.layer.slots.layerUpdated.on(()=>{this.blocksPortal.setStackingCanvas(this._surfaceRefRenderer.surfaceRenderer.stackingCanvas)})),t.mount()}get _surfaceRefService(){return this.host.spec.getService("affine:surface-ref")}get _surfaceService(){return this.host?.std.spec.getService("affine:surface")}_tryLoadFillScreen(){this.edgeless&&(this.fillScreen=this.edgeless.service.editPropsStore.getStorage("presentFillScreen")??!1)}connectedCallback(){super.connectedCallback(),this._tryLoadFillScreen(),this._setupSurfaceRefRenderer(),this._setDocDisposables(this.doc),this._setEdgelessDisposables(this.edgeless)}disconnectedCallback(){super.disconnectedCallback(),this._cleanupSurfaceRefRenderer(),this._clearEdgelessDisposables(),this._clearDocDisposables(),this._clearFrameDisposables()}firstUpdated(){this._refreshViewport(),this._setFrameDisposables(this.frame)}render(){let{_surfaceModel:e,frame:t,host:i,_surfaceService:s}=this,o=!e||!t||!t.xywh||!i||!s;return(0,L.qy)`
    ${o?L.s6:this._renderSurfaceContent(t)}
    `}updated(e){e.has("edgeless")&&(this.edgeless?this._setEdgelessDisposables(this.edgeless):this._clearEdgelessDisposables(),setTimeout(()=>{this._refreshViewport()})),e.has("doc")&&this.doc&&this._setDocDisposables(this.doc),this._attachRenderer()}get surfaceRenderer(){return this._surfaceRefRenderer.surfaceRenderer}#lI;get _surfaceModel(){return this.#lI}set _surfaceModel(e){this.#lI=e}#lB;get blocksPortal(){return this.#lB}set blocksPortal(e){this.#lB=e}#r;get container(){return this.#r}set container(e){this.#r=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#l$;get fillScreen(){return this.#l$}set fillScreen(e){this.#l$=e}#ac;get frame(){return this.#ac}set frame(e){this.#ac=e}#n;get host(){return this.#n}set host(e){this.#n=e}#lT;get surfaceHeight(){return this.#lT}set surfaceHeight(e){this.#lT=e}#lO;get surfaceWidth(){return this.#lO}set surfaceWidth(e){this.#lO=e}constructor(){super(...arguments),this._clearDocDisposables=()=>{this._docDisposables?.dispose(),this._docDisposables=null},this._clearEdgelessDisposables=()=>{this._edgelessDisposables?.dispose(),this._edgelessDisposables=null},this._clearFrameDisposables=()=>{this._frameDisposables?.dispose(),this._frameDisposables=null},this._debounceHandleElementUpdated=(0,td.sg)(e=>{let{id:t,oldValues:i,props:s}=e;if(s.xywh){if(this._overlapWithFrame(t))this._refreshViewport();else if(i.xywh){let e=p.z.deserialize(i.xywh),t=p.z.deserialize(this.frame.xywh);e.isOverlapWithBound(t)&&this._refreshViewport()}}},1e3/30),this._docDisposables=null,this._edgelessDisposables=null,this._frameDisposables=null,this._getViewportWH=e=>{let[,,t,i]=(0,h.W)(e.xywh),s=1;return s=this.fillScreen?Math.max(this.surfaceWidth/t,this.surfaceHeight/i):Math.min(this.surfaceWidth/t,this.surfaceHeight/i),{width:t*s,height:i*s}},this._overlapWithFrame=e=>{let t=this.edgeless?.service.getElementById(e);if(!t||!t.xywh)return!1;let i=p.z.deserialize(this.frame.xywh),s=p.z.deserialize(t.xywh);return i.isOverlapWithBound(s)},this._renderModel=e=>{let t={mode:"include",match:[{id:e.id,viewType:f.lv.Display}]};this._disposables.add(()=>{i.blockCollection.clearQuery(t)});let i=e.doc.blockCollection.getDoc({query:t}),s=iU.f.getInstance().getSpec("page:preview");return this.host.renderSpecPortal(i,s.value)},this._surfaceRefRendererId=(0,f.Ak)(),this.#lI=y0(this,y,null),this.#lB=(y0(this,b),y0(this,w,void 0)),this.#r=(y0(this,x),y0(this,_,void 0)),this.#d=(y0(this,C),y0(this,k,void 0)),this.#i_=(y0(this,S),y0(this,M,null)),this.#l$=(y0(this,E),y0(this,I,!1)),this.#ac=(y0(this,B),y0(this,$,void 0)),this.#n=(y0(this,T),y0(this,O,void 0)),this.#lT=(y0(this,H),y0(this,A,166)),this.#lO=(y0(this,j),y0(this,V,280)),y0(this,z)}static{y0(t,m)}},t})();var y7=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},y3=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-preview-root")],s=[],o=P.p_;(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;y7(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` affine-preview-root { display: block; } `}renderBlock(){return(0,L.qy)`
    ${this.host.renderChildren(this.model)}
    `}static{y3(t,s)}})})();var y4=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},y6=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("affine-database-title")],c=[],d=(0,P.Tm)(P.ao),h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[];(class extends d{static{t=this}static{let C="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.P)("rich-text")],n=[(0,D.MZ)({attribute:!1})],y4(this,null,i,{kind:"accessor",name:"isActive",static:!1,private:!1,access:{has:e=>"isActive"in e,get:e=>e.isActive,set:(e,t)=>{e.isActive=t}},metadata:C},h,u),y4(this,null,s,{kind:"accessor",name:"isComposing",static:!1,private:!1,access:{has:e=>"isComposing"in e,get:e=>e.isComposing,set:(e,t)=>{e.isComposing=t}},metadata:C},p,f),y4(this,null,o,{kind:"accessor",name:"onPressEnterKey",static:!1,private:!1,access:{has:e=>"onPressEnterKey"in e,get:e=>e.onPressEnterKey,set:(e,t)=>{e.onPressEnterKey=t}},metadata:C},g,m),y4(this,null,r,{kind:"accessor",name:"readonly",static:!1,private:!1,access:{has:e=>"readonly"in e,get:e=>e.readonly,set:(e,t)=>{e.readonly=t}},metadata:C},v,y),y4(this,null,a,{kind:"accessor",name:"richText",static:!1,private:!1,access:{has:e=>"richText"in e,get:e=>e.richText,set:(e,t)=>{e.richText=t}},metadata:C},b,w),y4(this,null,n,{kind:"accessor",name:"titleText",static:!1,private:!1,access:{has:e=>"titleText"in e,get:e=>e.titleText,set:(e,t)=>{e.titleText=t}},metadata:C},x,_),y4(null,e={value:t},l,{kind:"class",name:t.name,metadata:C},null,c),t=e.value,C&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:C})}static{this.styles=(0,L.AH)` .affine-database-title { position: relative; flex: 1; } .database-title { font-size: 20px; font-weight: 600; line-height: 28px; color: var(--affine-text-primary-color); font-family: inherit; /* overflow-x: scroll; */ overflow: hidden; cursor: text; } .database-title [data-v-text='true'] { display: block; word-break: break-all !important; } .database-title.ellipsis [data-v-text='true'] { white-space: nowrap !important; text-overflow: ellipsis; overflow: hidden; } .affine-database-title [data-title-empty='true']::before { content: 'Untitled'; position: absolute; pointer-events: none; color: var(--affine-text-primary-color); } .affine-database-title [data-title-focus='true']::before { color: var(--affine-placeholder-color); } `}firstUpdated(){this.titleText.yText.observe(()=>{this.requestUpdate()}),this.updateComplete.then(()=>{this.disposables.add(this.inlineEditor.slots.keydown.on(this._onKeyDown)),this.disposables.add(this.inlineEditor.slots.inputting.on(()=>{this.isComposing=this.inlineEditor.isComposing}));let e=null;this.disposables.add(this.inlineEditor.slots.inlineRangeUpdate.on(([t])=>{t?e||(this.isActive=!0):e&&(this.isActive=!1),e=t}))}).catch(console.error)}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.richText?.updateComplete,e}render(){let e=(!this.titleText||!this.titleText.length)&&!this.isComposing,t=(0,sZ.H)({"database-title":!0,ellipsis:!this.isActive});return(0,L.qy)`
    this.topContenteditableElement?.host?(0,of.dV)(this.topContenteditableElement.host):null} class="${t}" data-title-empty="${e}" data-title-focus="${this.isActive}" data-block-is-database-title="true" title="${this.titleText.toString()}" >
    Untitled
    `}get database(){return this.closest("affine-database")}get inlineEditor(){return(0,H.Z1)(this.richText.inlineEditor),this.richText.inlineEditor}get topContenteditableElement(){return this.database?.topContenteditableElement}#nG;get isActive(){return this.#nG}set isActive(e){this.#nG=e}#lP;get isComposing(){return this.#lP}set isComposing(e){this.#lP=e}#lH;get onPressEnterKey(){return this.#lH}set onPressEnterKey(e){this.#lH=e}#ei;get readonly(){return this.#ei}set readonly(e){this.#ei=e}#eH;get richText(){return this.#eH}set richText(e){this.#eH=e}#n8;get titleText(){return this.#n8}set titleText(e){this.#n8=e}constructor(){super(...arguments),this._onKeyDown=e=>{if("Enter"===e.key&&!e.isComposing){e.preventDefault(),this.onPressEnterKey?.();return}},this.#nG=y6(this,h,!1),this.#lP=(y6(this,u),y6(this,p,!1)),this.#lH=(y6(this,f),y6(this,g,void 0)),this.#ei=(y6(this,m),y6(this,v,void 0)),this.#eH=(y6(this,y),y6(this,b,void 0)),this.#n8=(y6(this,w),y6(this,x,void 0)),y6(this,_)}static{y6(t,c)}})})();let y8=(0,L.qy)` `,y9=(0,L.qy)` `,be=(0,L.qy)` `,bt=(0,L.qy)` `,bi=(0,L.qy)` `,bs=(0,L.qy)` `,bo=(0,L.qy)` `,br=(0,L.qy)` `,ba=(0,L.qy)` `,bn=(0,L.qy)` `,bl=(0,L.qy)` `,bc=(0,L.qy)` `,bd=e=>"affine:paragraph"===e.flavour?({text:bi,quote:bs,h1:bo,h2:br,h3:ba,h4:bn,h5:bl,h6:bc})[e.type]:"affine:list"===e.flavour?({bulleted:y8,numbered:y9,todo:be,toggle:bt})[e.type??"bulleted"]??(0,L.qy)``:(0,L.qy)``;var bh=i(21984),bu=i(1634),bp=i(25420);class bf{constructor(e){this.dataSource=e,this._currentViewId$=(0,q.vP)(void 0),this.currentView$=(0,q.EW)(()=>this.viewGet(this.currentViewId$.value)),this.currentViewId$=(0,q.EW)(()=>this._currentViewId$.value??this.views$.value[0]),this.readonly$=(0,q.EW)(()=>this.dataSource.readonly$.value),this.views$=(0,q.EW)(()=>this.dataSource.viewDataList$.value.map(e=>e.id))}moveTo(e,t){this.dataSource.viewDataMoveTo(e,t)}setCurrentView(e){this._currentViewId$.value=e}viewAdd(e){let t=this.dataSource.viewDataAdd(e);return this.setCurrentView(t),t}viewDataGet(e){return this.dataSource.viewDataGet(e)}viewDelete(e){this.dataSource.viewDataDelete(e),this.setCurrentView(this.views$.value[0])}viewDuplicate(e){let t=this.dataSource.viewDataDuplicate(e);this.setCurrentView(t)}viewGet(e){return new(this.dataSource.viewMetaGetById(e)).model.dataViewManager(this,e)}}var bg=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},bm=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("database-datasource-block-renderer")],a=[],n=(0,P.Tm)(P.ao),l=[],c=[],d=[],h=[],u=[],p=[];return class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],bg(this,null,i,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:f},l,c),bg(this,null,s,{kind:"accessor",name:"rowId",static:!1,private:!1,access:{has:e=>"rowId"in e,get:e=>e.rowId,set:(e,t)=>{e.rowId=t}},metadata:f},d,h),bg(this,null,o,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:f},u,p),bg(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` database-datasource-block-renderer { padding-top: 36px; padding-bottom: 16px; display: flex; flex-direction: column; gap: 16px; margin-bottom: 12px; border-bottom: 1px solid var(--affine-border-color); font-size: var(--affine-font-base); line-height: var(--affine-line-height); } database-datasource-block-renderer .tips-placeholder { display: none; } database-datasource-block-renderer rich-text { font-size: 15px; line-height: 24px; } database-datasource-block-renderer.empty rich-text::before { content: 'Untitled'; position: absolute; color: var(--affine-text-disable-color); font-size: 15px; line-height: 24px; user-select: none; pointer-events: none; } .database-block-detail-header-icon { width: 20px; height: 20px; padding: 2px; border-radius: 4px; background-color: var(--affine-background-secondary-color); } .database-block-detail-header-icon svg { width: 16px; height: 16px; } `}connectedCallback(){if(super.connectedCallback(),this.model&&this.model.text){let e=()=>{this.model?.text?.length==0?this.classList.add("empty"):this.classList.remove("empty")};this.model.text.yText.observe(e),this.disposables.add(()=>{this.model?.text?.yText.unobserve(e)})}this._disposables.addFromEvent(this,"keydown",e=>{if("Enter"===e.key&&!e.shiftKey&&!e.isComposing||"Backspace"===e.key&&!e.shiftKey&&!e.metaKey&&this.model?.text?.length===0){e.stopPropagation(),e.preventDefault();return}},!0)}render(){let e=this.model;if(e)return(0,L.qy)` ${this.renderIcon()} `}renderIcon(){let e=this.view.header$.value.iconColumn;if(e)return(0,L.qy)`
    ${this.view.cellGetValue(this.rowId,e)}
    `}get attributeRenderer(){return this.inlineManager.getRenderer()}get attributesSchema(){return this.inlineManager.getSchema()}get inlineManager(){return this.service.inlineManager}get model(){return this.host?.doc.getBlock(this.rowId)?.model}get service(){return this.host.std.spec.getService("affine:database")}#n=bm(this,l,void 0);get host(){return this.#n}set host(e){this.#n=e}#te=(bm(this,c),bm(this,d,void 0));get rowId(){return this.#te}set rowId(e){this.#te=e}#tt=(bm(this,h),bm(this,u,void 0));get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),bm(this,p)}static{bm(t,a)}},t})();var by=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},bb=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n=[(0,D.EM)("database-datasource-note-renderer")],l=[],c=(0,P.Tm)(P.ao),d=[],h=[],u=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[];return class extends c{static{t=this}static{let w="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.P)("editor-host")],a=[(0,D.MZ)({attribute:!1})],by(this,null,i,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:w},d,h),by(this,null,s,{kind:"accessor",name:"model",static:!1,private:!1,access:{has:e=>"model"in e,get:e=>e.model,set:(e,t)=>{e.model=t}},metadata:w},u,p),by(this,null,o,{kind:"accessor",name:"rowId",static:!1,private:!1,access:{has:e=>"rowId"in e,get:e=>e.rowId,set:(e,t)=>{e.rowId=t}},metadata:w},f,g),by(this,null,r,{kind:"accessor",name:"subHost",static:!1,private:!1,access:{has:e=>"subHost"in e,get:e=>e.subHost,set:(e,t)=>{e.subHost=t}},metadata:w},m,v),by(this,null,a,{kind:"accessor",name:"view",static:!1,private:!1,access:{has:e=>"view"in e,get:e=>e.view,set:(e,t)=>{e.view=t}},metadata:w},y,b),by(null,e={value:t},n,{kind:"class",name:t.name,metadata:w},null,l),t=e.value,w&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:w})}static{this.styles=(0,L.AH)` database-datasource-note-renderer { width: 100%; --affine-editor-side-padding: 0; flex: 1; } `}addNote(){let e=this.host?.std.collection;if(!e)return;this.databaseBlock.notes||(this.databaseBlock.notes={});let t=(0,O.Ux)(e);t&&(this.databaseBlock.notes[this.rowId]=t.id,this.requestUpdate(),requestAnimationFrame(()=>{let e=t.root?.children.find(e=>"affine:note"===e.flavour)?.children.find(e=>O.op(e,["affine:paragraph","affine:list","affine:code"]));this.subHost&&e&&O.Km(this.subHost,e.id)?.catch(console.error)}))}connectedCallback(){super.connectedCallback(),this.databaseBlock.propsUpdated.on(({key:e})=>{"notes"===e&&this.requestUpdate()})}render(){return this.model.doc.awarenessStore.getFlag("enable_database_attachment_note")?(0,L.qy)`
    ${this.renderNote()} `:null}renderNote(){let e=this.host,t=e?.std;if(!t||!e)return;let i=this.databaseBlock.notes?.[this.rowId];if(!i)return(0,L.qy)`
    Click to add note
    `;let s=t.collection.getDoc(i);if(s)return(0,L.qy)`${e.renderSpecPortal(s,e.specs)} `}get databaseBlock(){return this.model}#n=bb(this,d,void 0);get host(){return this.#n}set host(e){this.#n=e}#iJ=(bb(this,h),bb(this,u,void 0));get model(){return this.#iJ}set model(e){this.#iJ=e}#te=(bb(this,p),bb(this,f,void 0));get rowId(){return this.#te}set rowId(e){this.#te=e}#lA=(bb(this,g),bb(this,m,void 0));get subHost(){return this.#lA}set subHost(e){this.#lA=e}#tt=(bb(this,v),bb(this,y,void 0));get view(){return this.#tt}set view(e){this.#tt=e}constructor(){super(...arguments),bb(this,b)}static{bb(t,l)}},t})(),bx=[N.q_.tableViewConfig,N.q_.kanbanViewConfig],b_=Object.fromEntries(bx.map(e=>[e.type,e]));class bC extends N.PL{constructor(e,t){super(),this.host=e,this._batch=0,this.featureFlags$=(0,q.EW)(()=>({enable_number_formatting:this.doc.awarenessStore.getFlag("enable_database_number_formatting")??!1,enable_database_statistics:this.doc.awarenessStore.getFlag("enable_database_statistics")??!1})),this.properties$=(0,q.EW)(()=>this._model.columns$.value.map(e=>e.id)),this.readonly$=(0,q.EW)(()=>this._model.doc.awarenessStore.isReadonly(this._model.doc.blockCollection)),this.rows$=(0,q.EW)(()=>this._model.children.map(e=>e.id)),this.viewDataList$=(0,q.EW)(()=>this._model.views$.value),this.viewManager=new bf(this),this.viewMetas=bx,this._model=e.doc.collection.getDoc(t.pageId)?.getBlockById(t.blockId),this.setContext(bu.x,e)}_runCapture(){this._batch||(this._batch=requestAnimationFrame(()=>{this.doc.captureSync(),this._batch=0}))}getModelById(e){return this._model.children[this._model.childMap.value.get(e)??-1]}newColumnName(){let e=1;for(;this._model.columns$.value.some(t=>t.name===`Column ${e}`);)e++;return`Column ${e}`}cellChangeValue(e,t,i){this._runCapture();let s=this.propertyGetType(t),o=this.getPropertyMeta(s).model.ops.valueUpdate,r=i;if(o&&(r=o(this.cellGetValue(e,t),this.propertyGetData(t),i)),"title"===s&&r instanceof f.EY){this._model.doc.transact(()=>{this._model.text?.clear(),this._model.text?.join(r)});return}this._model.columns$.value.some(e=>e.id===t)&&(this._model.updateCell(e,{columnId:t,value:r}),this._model.applyCellsUpdate())}cellGetValue(e,t){if("type"===t){let t=this.getModelById(e);if(!t)return;return bd(t)}if("title"===this.propertyGetType(t)){let t=this.getModelById(e);return t?.text}return this._model.getCell(e,t)?.value}getPropertyMeta(e){return bh.GA[e]}propertyAdd(e,t){return this.doc.captureSync(),this._model.addColumn(e,bh.GA[t??N.Xx.multiSelectColumnConfig.type].model.create(this.newColumnName()))}propertyChangeData(e,t){this._runCapture(),this._model.updateColumn(e,()=>({data:t})),this._model.applyColumnUpdate()}propertyChangeName(e,t){this.doc.captureSync(),this._model.updateColumn(e,()=>({name:t})),this._model.applyColumnUpdate()}propertyChangeType(e,t){let i=this.propertyGetType(e),s=this.propertyGetData(e),o=this.rows$.value,r=o.map(t=>this.cellGetValue(t,e)),a=bh.GA[i].model?.convertCell(t,s,r)??{column:bh.GA[t].model.defaultData(),cells:r.map(()=>void 0)};this.doc.captureSync(),this._model.updateColumn(e,()=>({type:t,data:a.column}));let n={};r.forEach((e,t)=>{(null!=e||null!=a.cells[t])&&(n[o[t]]=a.cells[t])}),this._model.updateCells(e,n),this._model.applyColumnUpdate()}propertyDelete(e){this.doc.captureSync();let t=this._model.findColumnIndex(e);t<0||this.doc.transact(()=>{this._model.columns=this._model.columns.filter((e,i)=>i!==t)})}propertyDuplicate(e){this.doc.captureSync();let t=this._model.getColumn(e);(0,H.Z1)(t);let{id:i,...s}=t,o=new Set(this._model.columns$.value.map(e=>e.name)),r=1;for(;o.has(`${s.name}(${r})`);)r++;let a={...s,name:`${s.name}(${r})`},n=this._model.addColumn({before:!1,id:e},a);return this._model.copyCellsByColumn(i,n),this._model.applyColumnUpdate(),n}propertyGetData(e){return this._model.columns$.value.find(t=>t.id===e)?.data??{}}propertyGetDefaultWidth(e){return"title"===this.propertyGetType(e)?260:super.propertyGetDefaultWidth(e)}propertyGetName(e){return"type"===e?"Block Type":this._model.columns$.value.find(t=>t.id===e)?.name??""}propertyGetReadonly(e){return"type"===e}propertyGetType(e){return"type"===e?"image":this._model.columns$.value.find(t=>t.id===e)?.type??""}rowAdd(e){this.doc.captureSync();let t="number"==typeof e?e:(0,N.qf)(e,this._model.children);return this.doc.addBlock("affine:paragraph",{},this._model.id,t)}rowDelete(e){this.doc.captureSync(),this.doc.updateBlock(this._model,{children:this._model.children.filter(t=>!e.includes(t.id))}),this._model.deleteRows(e)}rowMove(e,t){let i=this.doc.getBlockById(e);if(i){let s=(0,N.qf)(t,this._model.children),o=this._model.children[s];if(o?.id===e)return;this.doc.moveBlocks([i],this._model,o)}}viewDataAdd(e){return this._model.doc.captureSync(),(0,vH.nP)(this._model,b_[e]).id}viewDataDelete(e){this._model.doc.captureSync(),this._model.deleteView(e)}viewDataDuplicate(e){return this._model.duplicateView(e)}viewDataGet(e){return this.viewDataList$.value.find(t=>t.id===e)}viewDataMoveTo(e,t){this._model.moveViewTo(e,t)}viewDataUpdate(e,t){this._model.updateView(e,t)}viewMetaGet(e){return b_[e]}viewMetaGetById(e){let t=this.viewDataGet(e);return this.viewMetaGet(t.mode)}get addPropertyConfigList(){return bh.Mp.map(e=>e.model)}get detailSlots(){return{...super.detailSlots,header:(0,bp.T)((0,N.Z4)(bv),e=>({...e,host:this.host})),note:(0,bp.T)((0,N.Z4)(bw),e=>({...e,model:this._model,host:this.host}))}}get doc(){return this._model.doc}}var bk=i(1200),bS=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},bM=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-database")],s=[],o=U.wN;(class extends o{static{t=this}constructor(){super(...arguments),this._bindHotkey=e=>({dispose:this.host.event.bindHotkey(e,{path:this.topContenteditableElement?.path??this.path})}),this._clickDatabaseOps=e=>{(0,U.zs)(e.currentTarget,{options:{input:{initValue:this.model.title.toString(),placeholder:"Untitled",onComplete:e=>{this.model.title.replace(0,this.model.title.length,e)}},items:[{type:"action",icon:G.TdU,name:"Copy",select:()=>{let e=f.Ji.fromModels(this.doc,[this.model]);this.std.clipboard.copySlice(e).then(()=>{(0,U.oR)(this.host,"Copied to clipboard")}).catch(console.error)}},{type:"group",name:"",children:()=>[{type:"action",icon:G.d7y,class:"delete-item",name:"Delete Database",select:()=>{this.model.children.slice().forEach(e=>{this.doc.deleteBlock(e)}),this.doc.deleteBlock(this.model)}}]}]}})},this._handleEvent=(e,t)=>({dispose:this.host.event.add(e,t,{path:this.path})}),this.dataView=new N.U$,this.renderTitle=e=>(0,L.qy)` `,this.getRootService=()=>this.std.spec.getService("affine:page"),this.headerWidget=(0,N.F5)(e=>(0,L.qy)`
    ${this.renderTitle(e.viewMethods)} ${this.renderDatabaseOps()}
    ${(0,N.ep)(N.tB.viewBar,e)}
    ${(0,N.ep)(this.toolsWidget,e)}
    ${(0,N.ep)(N.tB.filterBar,e)}
    `),this.indicator=new U.Yz,this.onDrag=(e,t)=>{let i=sa(e);return i&&i.rect?(document.body.append(this.indicator),this.indicator.rect=O.rw.fromLWTH(i.rect.left,i.rect.width,i.rect.top,i.rect.height),()=>{this.indicator.remove();let e=this.doc.getBlock(t).model,s=this.doc.getBlock(i.dropBlockId).model,o=this.doc.getParent(i.dropBlockId),r="in"===i.dropType;r&&(o=s),e&&s&&o&&(r?this.doc.moveBlocks([e],o):this.doc.moveBlocks([e],o,s,"before"===i.dropType))}):(this.indicator.remove(),()=>{})},this.setSelection=e=>{this.selection.setGroup("note",e?[new N.Gl({blockId:this.blockId,viewSelection:e})]:[])},this.toolsWidget=N.tB.createTools({table:[N.tB.tools.filter,N.tB.tools.expand,N.tB.tools.search,N.tB.tools.viewOptions,N.tB.tools.tableAddRow],kanban:[N.tB.tools.filter,N.tB.tools.expand,N.tB.tools.search,N.tB.tools.viewOptions]}),this.viewSelection$=(0,q.EW)(()=>{let e=this.selection.value.find(e=>e.blockId===this.blockId&&e instanceof N.Gl);return e?.viewSelection})}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;bS(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` ${(0,L.iz)((0,bk.S)("affine-database"))} affine-database { display: block; border-radius: 8px; background-color: var(--affine-background-primary-color); padding: 8px; margin: 8px -8px -8px; } .database-block-selected { background-color: var(--affine-hover-color); border-radius: 4px; } .database-ops { margin-top: 4px; padding: 2px; border-radius: 4px; display: flex; cursor: pointer; } .database-ops svg { width: 16px; height: 16px; color: var(--affine-icon-color); } .database-ops:hover { background-color: var(--affine-hover-color); } `}renderDatabaseOps(){return this.doc.readonly?L.s6:(0,L.qy)`
    ${G.jNK}
    `}connectedCallback(){super.connectedCallback(),this.setAttribute(P.vz.rangeSyncExcludeAttr,"true");let e=!1;this.disposables.add(sg.registerOption({flavour:vO.A.model.flavour,onDragMove:t=>{let i=i8(t.raw.target),s=this.view;return s&&i instanceof HTMLElement&&this.contains(i)?e=s.showIndicator?.(t.raw)??!1:e&&(s?.hideIndicator?.(),e=!1),!1},onDragEnd:({state:t,draggingElements:i})=>{let s=t.raw.target,o=this.view;if(e&&o&&o.moveTo&&s instanceof HTMLElement&&this.parentElement?.contains(s)){let e=i.map(e=>e.model);return this.doc.moveBlocks(e,this.model),e.forEach(e=>{o.moveTo?.(e.id,t.raw)}),o.hideIndicator?.(),!1}return e&&(o?.hideIndicator?.(),e=!1),!1}}))}renderBlock(){let e=this.getRootService().peekViewService;return(0,L.qy)`
    ${this.dataView.render({bindHotkey:this._bindHotkey,handleEvent:this._handleEvent,selection$:this.viewSelection$,setSelection:this.setSelection,dataSource:this.dataSource,headerWidget:this.headerWidget,onDrag:this.onDrag,std:this.std,detailPanelConfig:{openDetailPanel:e?(t,i)=>e.peek(t,i):void 0,target:()=>this.innerModalWidget.target}})}
    `}get dataSource(){return this._dataSource||(this._dataSource=new bC(this.host,{pageId:this.host.doc.id,blockId:this.model.id})),this._dataSource}get innerModalWidget(){return this.rootComponent.widgetComponents[hu]}get topContenteditableElement(){return this.rootComponent instanceof fG?this.closest(W.Tk):this.rootComponent}get view(){return this.dataView.expose}static{bM(t,s)}})})();let bE=(0,L.AH)` .affine-divider-block-container { position: relative; width: 100%; height: 1px; display: flex; flex-direction: column; justify-content: center; padding: 18px 8px; margin-top: var(--affine-paragraph-space); } .affine-divider-block-container hr { border: none; border-top: 1px solid var(--affine-divider-color); width: 100%; } `;var bI=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},bB=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-divider")],s=[],o=s0.w;return class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;bI(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=bE}connectedCallback(){super.connectedCallback(),this.contentEditable="false",this.handleEvent("click",()=>{this.host.selection.setGroup("note",[this.host.selection.create("block",{blockId:this.blockId})])})}renderBlock(){let e=(0,L.qy)`
    ${this.renderChildren(this.model)}
    `;return(0,L.qy)`

    ${e}
    `}static{bB(t,s)}},t})();var bT=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},bO=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d,h,u=[(0,D.EM)("edgeless-frame-title")],f=[],g=(0,P.Tm)(P.ao),m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],H=[],A=[],j=[];(class extends g{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(g[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.P)(".affine-frame-title")],r=[(0,D.wk)()],a=[(0,D.wk)()],n=[(0,D.wk)()],l=[(0,D.wk)()],c=[(0,D.MZ)({attribute:!1})],d=[(0,D.MZ)({attribute:!1})],h=[(0,D.MZ)({attribute:!1})],bT(this,null,i,{kind:"accessor",name:"_editing",static:!1,private:!1,access:{has:e=>"_editing"in e,get:e=>e._editing,set:(e,t)=>{e._editing=t}},metadata:p},m,v),bT(this,null,s,{kind:"accessor",name:"_frameTitle",static:!1,private:!1,access:{has:e=>"_frameTitle"in e,get:e=>e._frameTitle,set:(e,t)=>{e._frameTitle=t}},metadata:p},y,b),bT(this,null,o,{kind:"accessor",name:"_frameTitleEl",static:!1,private:!1,access:{has:e=>"_frameTitleEl"in e,get:e=>e._frameTitleEl,set:(e,t)=>{e._frameTitleEl=t}},metadata:p},w,x),bT(this,null,r,{kind:"accessor",name:"_isNavigator",static:!1,private:!1,access:{has:e=>"_isNavigator"in e,get:e=>e._isNavigator,set:(e,t)=>{e._isNavigator=t}},metadata:p},_,C),bT(this,null,a,{kind:"accessor",name:"_nestedFrame",static:!1,private:!1,access:{has:e=>"_nestedFrame"in e,get:e=>e._nestedFrame,set:(e,t)=>{e._nestedFrame=t}},metadata:p},k,S),bT(this,null,n,{kind:"accessor",name:"_xywh",static:!1,private:!1,access:{has:e=>"_xywh"in e,get:e=>e._xywh,set:(e,t)=>{e._xywh=t}},metadata:p},M,E),bT(this,null,l,{kind:"accessor",name:"_zoom",static:!1,private:!1,access:{has:e=>"_zoom"in e,get:e=>e._zoom,set:(e,t)=>{e._zoom=t}},metadata:p},I,B),bT(this,null,c,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:p},$,T),bT(this,null,d,{kind:"accessor",name:"model",static:!1,private:!1,access:{has:e=>"model"in e,get:e=>e.model,set:(e,t)=>{e.model=t}},metadata:p},O,H),bT(this,null,h,{kind:"accessor",name:"service",static:!1,private:!1,access:{has:e=>"service"in e,get:e=>e.service,set:(e,t)=>{e.service=t}},metadata:p},A,j),bT(null,e={value:t},u,{kind:"class",name:t.name,metadata:p},null,f),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=(0,L.AH)` edgeless-frame-title { position: relative; } .affine-frame-title { position: absolute; z-index: 1; left: 0px; top: 0px; border-radius: 4px; width: fit-content; padding: 8px 10px; font-size: 14px; cursor: default; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform-origin: left bottom; line-height: normal; } `}_isInsideFrame(){return this.service.layer.framesGrid.has(this.model.elementBound,!0,!0,new Set([this.model]))}_updateFrameTitleSize(){let{_nestedFrame:e,_zoom:t}=this,{elementBound:i}=this.model,s=this._cachedWidth/t,o=this._cachedHeight/t;s&&o&&(this.model.externalXYWH=`[${i.x+(e?4/t:0)},${i.y+(e?4/t:-(o+4/t))},${s},${o}]`)}connectedCallback(){super.connectedCallback();let{_disposables:e,doc:t,service:i}=this;this._nestedFrame=this._isInsideFrame(),e.add(t.slots.blockUpdated.on(e=>{("update"===e.type&&"xywh"===e.props.key&&t.getBlock(e.id)?.model instanceof iE.K||"add"===e.type&&"affine:frame"===e.flavour)&&(this._nestedFrame=this._isInsideFrame())})),e.add(this.model.propsUpdated.on(()=>{this._xywh=this.model.xywh,this.requestUpdate()})),e.add(i.selection.slots.updated.on(()=>{this._editing=i.selection.selectedIds[0]===this.model.id&&i.selection.editing})),e.add(i.slots.edgelessToolUpdated.on(e=>{this._isNavigator="frameNavigator"===e.type})),e.add(i.viewport.viewportUpdated.on(({zoom:e})=>{this._zoom=e})),this._zoom=i.viewport.zoom;let s=()=>{this._frameTitle=this.model.title.toString()};e.add(()=>{this.model.title.yText.unobserve(s)}),this.model.title.yText.observe(s),this._frameTitle=this.model.title.toString(),this._xywh=this.model.xywh}render(){let e=this.model,t=p.z.deserialize(e.xywh),{_isNavigator:i,_editing:s,_zoom:o}=this,r=this._nestedFrame,a=r?t.w*o-4/o:t.w*o,n=32/o>=t.h&&r,l=[`translate(0%, ${r?0:-100}%)`,`scale(${1/o})`,`translate(${r?4:0}px, ${r?4:-4}px)`];return(0,L.qy)` ${!this._frameTitle||i||s?L.s6:(0,L.qy)`
    ${this._frameTitle}
    `} `}updated(e){if(!this.service.viewport.viewportBounds.contains(this.model.elementBound)&&!this.service.viewport.viewportBounds.isIntersectWithBound(this.model.elementBound)||!this._frameTitleEl)return;let t=!1;(0===this._cachedWidth||0===this._cachedHeight||e.has("_frameTitle")||e.has("_nestedFrame")||e.has("_xywh"))&&(this._cachedWidth=this._frameTitleEl.clientWidth,this._cachedHeight=this._frameTitleEl.clientHeight,t=!0),(t||e.has("zoom"))&&this._updateFrameTitleSize()}#iM;get _editing(){return this.#iM}set _editing(e){this.#iM=e}#lL;get _frameTitle(){return this.#lL}set _frameTitle(e){this.#lL=e}#lD;get _frameTitleEl(){return this.#lD}set _frameTitleEl(e){this.#lD=e}#lZ;get _isNavigator(){return this.#lZ}set _isNavigator(e){this.#lZ=e}#lj;get _nestedFrame(){return this.#lj}set _nestedFrame(e){this.#lj=e}#lV;get _xywh(){return this.#lV}set _xywh(e){this.#lV=e}#lz;get _zoom(){return this.#lz}set _zoom(e){this.#lz=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}#iJ;get model(){return this.#iJ}set model(e){this.#iJ=e}#lR;get service(){return this.#lR}set service(e){this.#lR=e}constructor(){super(...arguments),this._cachedHeight=0,this._cachedWidth=0,this.#iM=bO(this,m,!1),this.#lL=(bO(this,v),bO(this,y,"")),this.#lD=(bO(this,b),bO(this,w,void 0)),this.#lZ=(bO(this,x),bO(this,_,!1)),this.#lj=(bO(this,C),bO(this,k,!1)),this.#lV=(bO(this,S),bO(this,M,null)),this.#lz=(bO(this,E),bO(this,I,void 0)),this.#d=(bO(this,B),bO(this,$,void 0)),this.#iJ=(bO(this,T),bO(this,O,void 0)),this.#lR=(bO(this,H),bO(this,A,void 0)),bO(this,j)}static{bO(t,f)}})})(),(()=>{let e,t,i,s,o=[(0,D.EM)("affine-frame")],r=[],a=P.Yx,n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],bT(this,null,i,{kind:"accessor",name:"_isNavigator",static:!1,private:!1,access:{has:e=>"_isNavigator"in e,get:e=>e._isNavigator,set:(e,t)=>{e._isNavigator=t}},metadata:h},n,l),bT(this,null,s,{kind:"accessor",name:"showBorder",static:!1,private:!1,access:{has:e=>"showBorder"in e,get:e=>e.showBorder,set:(e,t)=>{e.showBorder=t}},metadata:h},c,d),bT(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h}),bO(t,r)}connectedCallback(){super.connectedCallback(),this._disposables.add(this.doc.slots.blockUpdated.on(({type:e,id:t})=>{t===this.model.id&&"update"===e&&this.requestUpdate()}))}firstUpdated(){this.rootService.slots.edgelessToolUpdated.on(e=>{this._isNavigator="frameNavigator"===e.type})}renderGfxBlock(){let{model:e,_isNavigator:t,showBorder:i,doc:s,rootService:o}=this,r=j.Q.generateColorProperty(e.background,"--affine-platte-transparent"),a=o.layer.getZIndex(e);return(0,L.qy)`
    `}toZIndex(){return"auto"}#lZ;get _isNavigator(){return this.#lZ}set _isNavigator(e){this.#lZ=e}#lF;get showBorder(){return this.#lF}set showBorder(e){this.#lF=e}constructor(){super(...arguments),this.rootServiceFlavour="affine:page",this.#lZ=bO(this,n,!1),this.#lF=(bO(this,l),bO(this,c,!0)),bO(this,d)}})})();var bP=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},bH=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("affine-edgeless-image")],r=[],a=(0,P.Tm)(P.ao),n=[],l=[],c=[],d=[];(class extends a{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.P)(".resizable-img")],s=[(0,D.MZ)({attribute:!1})],bP(this,null,i,{kind:"accessor",name:"resizeImg",static:!1,private:!1,access:{has:e=>"resizeImg"in e,get:e=>e.resizeImg,set:(e,t)=>{e.resizeImg=t}},metadata:h},n,l),bP(this,null,s,{kind:"accessor",name:"url",static:!1,private:!1,access:{has:e=>"url"in e,get:e=>e.url,set:(e,t)=>{e.url=t}},metadata:h},c,d),bP(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` affine-edgeless-image .resizable-img, affine-edgeless-image .resizable-img img { width: 100%; height: 100%; } `}_handleError(e){this.dispatchEvent(new CustomEvent("error",{detail:e}))}render(){return(0,L.qy)`
    `}#lN=bH(this,n,null);get resizeImg(){return this.#lN}set resizeImg(e){this.#lN=e}#lq=(bH(this,l),bH(this,c,void 0));get url(){return this.#lq}set url(e){this.#lq=e}constructor(){super(...arguments),bH(this,d)}static{bH(t,r)}})})();class bA{constructor(){this._activeComponent=null,this._dragMoveTarget="right",this._imageCenterX=0,this._imageContainer=null,this._zoom=1}onEnd(){(0,H.Z1)(this._activeComponent),(0,H.Z1)(this._imageContainer);let e=(0,of.dz)(this._activeComponent);e.page.captureSync();let{width:t,height:i}=this._imageContainer.getBoundingClientRect();e.page.updateBlock(e,{width:t/this._zoom,height:i/this._zoom})}onMove(e){(0,H.Z1)(this._activeComponent);let t=this._activeComponent,i=this._imageContainer;(0,H.Z1)(i);let s=t.querySelector("img");(0,H.Z1)(s);let o=0;(o="right"===this._dragMoveTarget?(e.raw.pageX-this._imageCenterX)*2:(this._imageCenterX-e.raw.pageX)*2)<50&&(o=50),o>t.getBoundingClientRect().width&&(o=t.getBoundingClientRect().width);let r=o*(s.naturalHeight/s.naturalWidth),a=i.getBoundingClientRect();(a.width!==o||a.height!==r)&&requestAnimationFrame(()=>{i.style.width=(o/this._zoom).toFixed(2)+"px"})}onStart(e){let t=e.raw.target;this._activeComponent=(0,of.N8)(t);let i=this._activeComponent.closest("affine-edgeless-root, affine-page-root");i&&"edgeless"===i.service.docModeService.getMode()?this._zoom=i.service.viewport.zoom:this._zoom=1,this._imageContainer=t.closest(".resizable-img"),(0,H.Z1)(this._imageContainer);let s=this._imageContainer.getBoundingClientRect();this._imageCenterX=s.left+s.width/2,t.className.includes("right")?this._dragMoveTarget="right":this._dragMoveTarget="left"}}let bL=(0,L.qy)``;var bD=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},bZ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r=[(0,D.EM)("affine-page-image")],a=[],n=(0,P.Tm)(P.ao),l=[],c=[],d=[],h=[],u=[],p=[];(class extends n{static{t=this}static{let f="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.P)(".resizable-img")],bD(this,null,i,{kind:"accessor",name:"_isSelected",static:!1,private:!1,access:{has:e=>"_isSelected"in e,get:e=>e._isSelected,set:(e,t)=>{e._isSelected=t}},metadata:f},l,c),bD(this,null,s,{kind:"accessor",name:"block",static:!1,private:!1,access:{has:e=>"block"in e,get:e=>e.block,set:(e,t)=>{e.block=t}},metadata:f},d,h),bD(this,null,o,{kind:"accessor",name:"resizeImg",static:!1,private:!1,access:{has:e=>"resizeImg"in e,get:e=>e.resizeImg,set:(e,t)=>{e.resizeImg=t}},metadata:f},u,p),bD(null,e={value:t},r,{kind:"class",name:t.name,metadata:f},null,a),t=e.value,f&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:f})}static{this.styles=(0,L.AH)` affine-page-image { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px; line-height: 0; cursor: pointer; } affine-page-image .resizable-img { position: relative; max-width: 100%; } affine-page-image .resizable-img img { width: 100%; height: 100%; } `}_bindKeyMap(){let e=this._host.selection,t=t=>{let i=this._doc.getParent(this._model);if(!i)return;let s=i.children.indexOf(this._model),o=this._doc.addBlock("affine:paragraph",{},i,s+1);t.get("defaultState").event.preventDefault(),e.update(t=>t.filter(e=>!e.is("image")).concat(e.create("text",{from:{blockId:o,index:0,length:0},to:null})))};this.block.bindHotKey({Escape:()=>(e.update(t=>t.map(t=>t.is("image")&&t.blockId===this.block.blockId?e.create("block",{blockId:this.block.blockId}):t)),!0),Delete:e=>{if(!this._host.doc.readonly&&this._isSelected)return t(e),this._doc.deleteBlock(this._model),!0},Backspace:e=>{if(!this._host.doc.readonly&&this._isSelected)return t(e),this._doc.deleteBlock(this._model),!0},Enter:e=>{if(!this._host.doc.readonly&&this._isSelected)return t(e),!0},ArrowDown:e=>{let t=this._host.std;return!!t.selection.find("image")&&(e.get("keyboardState").raw.preventDefault(),t.command.chain().getNextBlock({path:this.block.blockId}).inline((e,t)=>{let{nextBlock:i}=e;if(i)return t({focusBlock:i})}).focusBlockStart().run(),!0)},ArrowUp:e=>{let t=this._host.std;return!!t.selection.find("image")&&(e.get("keyboardState").raw.preventDefault(),t.command.chain().getPrevBlock({path:this.block.blockId}).inline((e,t)=>{let{prevBlock:i}=e;if(i)return t({focusBlock:i})}).focusBlockEnd().run(),!0)}})}get _doc(){return this.block.doc}_handleError(){this.block.error=!0}_handleSelection(){let e=this._host.selection;this._disposables.add(e.slots.changed.on(e=>{this._isSelected=e.some(e=>e.blockId===this.block.blockId&&e.is("image"))})),this._disposables.add(this._model.propsUpdated.on(()=>{this.requestUpdate()})),this._disposables.addFromEvent(this.resizeImg,"click",t=>{if(!t.shiftKey)return t.stopPropagation(),e.update(t=>t.filter(e=>!["block","image","text"].includes(e.type)).concat(e.create("image",{blockId:this.block.blockId}))),!0}),this.block.handleEvent("click",()=>{this._isSelected&&e.update(e=>e.filter(e=>!(e.is("image")&&e.blockId===this.block.blockId)))},{global:!0})}get _host(){return this.block.host}get _model(){return this.block.model}_normalizeImageSize(){if(this._isDragging&&this.resizeImg)return{width:this.resizeImg.style.width};let{width:e,height:t}=this._model;return e&&t?{width:`${e}px`}:{width:"unset",height:"unset"}}_observeDrag(){let e=new bA;this._disposables.add(this._host.event.add("dragStart",t=>{let i=t.get("pointerState"),s=i.event.target;return!!(s&&s instanceof HTMLElement&&this.contains(s)&&s.classList.contains("resize"))&&(this._isDragging=!0,e.onStart(i),!0)})),this._disposables.add(this._host.event.add("dragMove",t=>{let i=t.get("pointerState");return!!this._isDragging&&(e.onMove(i),!0)})),this._disposables.add(this._host.event.add("dragEnd",()=>!!this._isDragging&&(this._isDragging=!1,e.onEnd(),!0)))}connectedCallback(){super.connectedCallback(),this._bindKeyMap(),this._observeDrag()}firstUpdated(e){super.firstUpdated(e),this._handleSelection(),this.addEventListener("click",()=>{document.activeElement&&document.activeElement instanceof HTMLElement&&document.activeElement.blur()})}render(){let e=this._normalizeImageSize(),t=this._isSelected?this._doc.readonly?(0,L.qy)`${bL}
    `:(0,L.qy)` ${bL}
    `:null;return(0,L.qy)`
    ${t}
    `}#i9;get _isSelected(){return this.#i9}set _isSelected(e){this.#i9=e}#T;get block(){return this.#T}set block(e){this.#T=e}#lN;get resizeImg(){return this.#lN}set resizeImg(e){this.#lN=e}constructor(){super(...arguments),this._isDragging=!1,this.#i9=bZ(this,l,!1),this.#T=(bZ(this,c),bZ(this,d,void 0)),this.#lN=(bZ(this,h),bZ(this,u,void 0)),bZ(this,p)}static{bZ(t,a)}})})();var bj=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},bV=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l,c,d,h,u=[(0,D.EM)("affine-image"),(0,U.YE)()],f=[],g=s0.w,m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],P=[],H=[],A=[];(class extends g{static{t=this}constructor(){super(...arguments),this._isInSurface=!1,this.convertToCardView=()=>{dr(this).catch(console.error)},this.copy=()=>{di(this).catch(console.error)},this.download=()=>{de(this).catch(console.error)},this.refreshData=()=>{this.retryCount=0,c9(this).then(()=>{let{width:e,height:t}=this.model;!this.isInSurface||e||t||this.resetImageSize()}).catch(console.error)},this.resetImageSize=()=>{dt(this).catch(console.error)},this.#lU=bV(this,m,null),this.#lW=(bV(this,v),bV(this,y,null)),this.#lG=(bV(this,b),bV(this,w,null)),this.#lY=(bV(this,x),bV(this,_,void 0)),this.#lK=(bV(this,C),bV(this,k,void 0)),this.#lX=(bV(this,S),bV(this,M,!1)),this.#st=(bV(this,E),bV(this,I,!1)),this.#lQ=(bV(this,B),bV(this,$,void 0)),this.#si=(bV(this,T),bV(this,O,!1)),this.#lJ=(bV(this,P),bV(this,H,0)),this.#$=(bV(this,A),!0)}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(g[Symbol.metadata]??null):void 0;i=[(0,D.P)("affine-edgeless-image")],s=[(0,D.P)("affine-image-block-card")],o=[(0,D.P)("affine-page-image")],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],l=[(0,D.MZ)({attribute:!1})],c=[(0,D.wk)()],d=[(0,D.MZ)({attribute:!1})],h=[(0,D.MZ)({attribute:!1})],bj(this,null,i,{kind:"accessor",name:"_edgelessImage",static:!1,private:!1,access:{has:e=>"_edgelessImage"in e,get:e=>e._edgelessImage,set:(e,t)=>{e._edgelessImage=t}},metadata:p},m,v),bj(this,null,s,{kind:"accessor",name:"_imageCard",static:!1,private:!1,access:{has:e=>"_imageCard"in e,get:e=>e._imageCard,set:(e,t)=>{e._imageCard=t}},metadata:p},y,b),bj(this,null,o,{kind:"accessor",name:"_pageImage",static:!1,private:!1,access:{has:e=>"_pageImage"in e,get:e=>e._pageImage,set:(e,t)=>{e._pageImage=t}},metadata:p},w,x),bj(this,null,r,{kind:"accessor",name:"blob",static:!1,private:!1,access:{has:e=>"blob"in e,get:e=>e.blob,set:(e,t)=>{e.blob=t}},metadata:p},_,C),bj(this,null,a,{kind:"accessor",name:"blobUrl",static:!1,private:!1,access:{has:e=>"blobUrl"in e,get:e=>e.blobUrl,set:(e,t)=>{e.blobUrl=t}},metadata:p},k,S),bj(this,null,n,{kind:"accessor",name:"downloading",static:!1,private:!1,access:{has:e=>"downloading"in e,get:e=>e.downloading,set:(e,t)=>{e.downloading=t}},metadata:p},M,E),bj(this,null,l,{kind:"accessor",name:"error",static:!1,private:!1,access:{has:e=>"error"in e,get:e=>e.error,set:(e,t)=>{e.error=t}},metadata:p},I,B),bj(this,null,c,{kind:"accessor",name:"lastSourceId",static:!1,private:!1,access:{has:e=>"lastSourceId"in e,get:e=>e.lastSourceId,set:(e,t)=>{e.lastSourceId=t}},metadata:p},$,T),bj(this,null,d,{kind:"accessor",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:p},O,P),bj(this,null,h,{kind:"accessor",name:"retryCount",static:!1,private:!1,access:{has:e=>"retryCount"in e,get:e=>e.retryCount,set:(e,t)=>{e.retryCount=t}},metadata:p},H,A),bj(null,e={value:t},u,{kind:"class",name:t.name,metadata:p},null,f),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p}),bV(t,f)}_handleClick(e){e.shiftKey||(e.stopPropagation(),this.isInSurface||this._selectBlock())}get _imageElement(){return this.isInSurface?this._edgelessImage:this._pageImage}_selectBlock(){let e=this.host.selection,t=e.create("block",{blockId:this.blockId});e.setGroup("note",[t])}connectedCallback(){super.connectedCallback(),this.refreshData(),this.contentEditable="false";let e=this.host.doc.getParent(this.model);this._isInSurface=e?.flavour==="affine:surface",this.blockContainerStyles=this._isInSurface?void 0:{margin:"18px 0"},this.model.propsUpdated.on(({key:e})=>{"sourceId"===e&&this.refreshData()}),this._isInSurface&&(this.style.position="absolute",this.style.transformOrigin="center")}disconnectedCallback(){this.blobUrl&&URL.revokeObjectURL(this.blobUrl),super.disconnectedCallback()}renderBlock(){let e=(0,Z.W)({position:"relative",width:"100%"});if(this.isInSurface){let{xywh:e,rotate:t}=this.model,i=p.z.deserialize(e);this.style.left=`${i.x}px`,this.style.top=`${i.y}px`,this.style.width=`${i.w}px`,this.style.height=`${i.h}px`,this.style.transform=`rotate(${t}deg)`,this.style.zIndex=`${this.toZIndex()}`}return(0,L.qy)`
    ${this.loading||this.error?(0,L.qy)``:this.isInSurface?(0,L.qy)`{this.error=!0}} >`:(0,L.qy)``}
    ${this.isInSurface?L.s6:Object.values(this.widgets)} `}toZIndex(){return this.rootService?.layer.getZIndex(this.model)??1}updateZIndex(){this.style.zIndex=`${this.toZIndex()}`}updated(){this._imageCard?.requestUpdate()}get imageCard(){return this._imageCard}get isInSurface(){return this._isInSurface}get resizeImg(){return this._imageElement?.resizeImg}get rootService(){let e=this.std.spec.getService("affine:page");return"surface"in e?e:null}#lU;get _edgelessImage(){return this.#lU}set _edgelessImage(e){this.#lU=e}#lW;get _imageCard(){return this.#lW}set _imageCard(e){this.#lW=e}#lG;get _pageImage(){return this.#lG}set _pageImage(e){this.#lG=e}#lY;get blob(){return this.#lY}set blob(e){this.#lY=e}#lK;get blobUrl(){return this.#lK}set blobUrl(e){this.#lK=e}#lX;get downloading(){return this.#lX}set downloading(e){this.#lX=e}#st;get error(){return this.#st}set error(e){this.#st=e}#lQ;get lastSourceId(){return this.#lQ}set lastSourceId(e){this.#lQ=e}#si;get loading(){return this.#si}set loading(e){this.#si=e}#lJ;get retryCount(){return this.#lJ}set retryCount(e){this.#lJ=e}#$;get useCaptionEditor(){return this.#$}set useCaptionEditor(e){this.#$=e}})})();var bz=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},bR=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o=[(0,D.EM)("affine-list")],r=[],a=s0.w,n=[],l=[],c=[],d=[];return class extends a{static{t=this}constructor(){super(...arguments),this._inlineRangeProvider=null,this._onClickIcon=e=>{if(e.stopPropagation(),"toggle"===this.model.type){this._toggleChildren();return}if("todo"===this.model.type){if(this.doc.readonly)return;this.doc.captureSync();let e={checked:!this.model.checked};if(this.doc.updateBlock(this.model,e),this.model.checked){let e=this.querySelector(".affine-list-block__todo-prefix");(0,H.Z1)(e),(0,yl.RY)(e).catch(console.error)}return}this._select()},this.#l1=bR(this,n,!1),this.#eL=(bR(this,l),bR(this,c,null)),this.#I=(bR(this,d),{margin:"10px 0"})}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.P)("rich-text")],bz(this,null,i,{kind:"accessor",name:"_isCollapsedWhenReadOnly",static:!1,private:!1,access:{has:e=>"_isCollapsedWhenReadOnly"in e,get:e=>e._isCollapsedWhenReadOnly,set:(e,t)=>{e._isCollapsedWhenReadOnly=t}},metadata:h},n,l),bz(this,null,s,{kind:"accessor",name:"_richTextElement",static:!1,private:!1,access:{has:e=>"_richTextElement"in e,get:e=>e._richTextElement,set:(e,t)=>{e._richTextElement=t}},metadata:h},c,d),bz(null,e={value:t},o,{kind:"class",name:t.name,metadata:h},null,r),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=yn}_select(){let e=this.host.selection;e.update(t=>t.filter(e=>!e.is("text")&&!e.is("block")).concat(e.create("block",{blockId:this.blockId})))}_toggleChildren(){if(this.doc.readonly){this._isCollapsedWhenReadOnly=!this._isCollapsedWhenReadOnly;return}let e=!this.model.collapsed;this._isCollapsedWhenReadOnly=e,this.doc.captureSync(),this.doc.updateBlock(this.model,{collapsed:e})}_toggleTemplate(e){if(0===this.model.children.length)return L.s6;let t=(0,L.qy)`
    ${yl.l_}
    `,i=(0,L.qy)`
    ${yl.fp}
    `;return e?i:t}connectedCallback(){super.connectedCallback(),oB(this),this._inlineRangeProvider=(0,P.U4)(this),this.disposables.add((0,q.QZ)(()=>{let e=this.model.type$.value,t=this.model.order$.value;"numbered"!==e||Number.isInteger(t)||ye(this.doc,this.model,!1),"numbered"!==e&&null!==t&&(this.model.order=null)}))}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this._richTextElement?.updateComplete,e}renderBlock(){let{model:e,_onClickIcon:t}=this,i=this.doc.readonly?this._isCollapsedWhenReadOnly:!!e.collapsed,s=yd(e,!i,t),o="todo"===this.model.type&&this.model.checked?"affine-list--checked":"",r=(0,L.qy)`
    ${this.renderChildren(this.model)}
    `;return(0,L.qy)`
    ${this._toggleTemplate(i)} ${s} (0,of.dV)(this.host)} >
    ${r}
    `}get attributeRenderer(){return this.inlineManager.getRenderer()}get attributesSchema(){return this.inlineManager.getSchema()}get embedChecker(){return this.inlineManager.embedChecker}get inlineManager(){let e=this.service?.inlineManager;return(0,H.Z1)(e),e}get markdownShortcutHandler(){return this.inlineManager.markdownShortcutHandler}get topContenteditableElement(){return this.rootComponent instanceof fG?this.closest(W.Tk):this.rootComponent}#l1;get _isCollapsedWhenReadOnly(){return this.#l1}set _isCollapsedWhenReadOnly(e){this.#l1=e}#eL;get _richTextElement(){return this.#eL}set _richTextElement(e){this.#eL=e}#I;get blockContainerStyles(){return this.#I}set blockContainerStyles(e){this.#I=e}static{bR(t,r)}},t})(),bN=e=>e.host.selection;function bq(e,t){return bN(e).filter("block").at(t?-1:0)??null}function bU(e){return bN(e).find("text")}let bW=(e,t)=>e.host.view.getBlock(t),bG=[{name:"Move Up",hotkey:["Mod-Alt-ArrowUp","Mod-Shift-ArrowUp"],action:e=>{let t=e.doc,i=bU(e);if(i){let s=bW(e,i.from.blockId)?.model;if(!s)return;let o=t.getPrev(s);if(!o)return;let r=e.doc.getParent(o);if(!r)return;return e.doc.moveBlocks([s],r,o,!0),e.updateComplete.then(()=>{e.std.range.syncTextSelectionToRange(i)}).catch(console.error),!0}let s=bq(e,!0);if(s){let i=bW(e,s.blockId)?.model;if(!i)return;let o=t.getPrev(i);if(!o)return;let r=t.getParent(o);if(!r)return;return t.moveBlocks([i],r,o,!1),!0}}},{name:"Move Down",hotkey:["Mod-Alt-ArrowDown","Mod-Shift-ArrowDown"],action:e=>{let t=e.doc,i=bU(e);if(i){let s=bW(e,i.from.blockId)?.model;if(!s)return;let o=t.getNext(s);if(!o)return;let r=t.getParent(o);if(!r)return;return t.moveBlocks([s],r,o,!1),e.updateComplete.then(()=>{e.std.range.syncTextSelectionToRange(i)}).catch(console.error),!0}let s=bq(e,!0);if(s){let i=bW(e,s.blockId)?.model;if(!i)return;let o=t.getNext(i);if(!o)return;let r=t.getParent(o);if(!r)return;return t.moveBlocks([i],r,o,!1),!0}}}],bY=[{id:"copy",name:"Copy",disabledToolTip:void 0,icon:G.TdU,hotkey:void 0,showWhen:()=>!0,enabledWhen:()=>!0,action:e=>{e.std.command.chain().getSelectedModels().with({onCopy:()=>{(0,e5.o)(e,"Copied to clipboard")}}).draftSelectedModels().copySelectedModels().run()}},{id:"convert-to-database",name:"Group as Database",disabledToolTip:"Contains Block types that cannot be converted to Database",icon:G.yni,showWhen:e=>{let[t,i]=e.std.command.chain().getSelectedModels({types:["block","text"]}).run(),{selectedModels:s}=i;if(!s||0===s.length)return!1;let o=s[0];return(0,H.Z1)(o),!(0,tf.o)(o,["affine:database"])},enabledWhen:e=>{let[t,i]=e.std.command.chain().getSelectedModels({types:["block","text"]}).run(),{selectedModels:s}=i;return!!s&&0!==s.length&&s.every(e=>aA.Z.includes(e.flavour))},action:e=>{(0,sB.p0)({template:(0,L.qy)``})}},{id:"convert-to-linked-doc",name:"Create Linked Doc",icon:G.hhn,hotkey:"Mod-Shift-l",showWhen:e=>{let[t,i]=e.std.command.chain().getSelectedModels({types:["block"]}).run(),{selectedModels:s}=i;return!!s&&s.length>0},enabledWhen:e=>{let[t,i]=e.std.command.chain().getSelectedModels({types:["block"]}).run(),{selectedModels:s}=i;return!!s&&s.length>0},action:e=>{let[t,i]=e.std.command.chain().getSelectedModels({types:["block"],mode:"highest"}).run(),{selectedModels:s}=i;if((0,H.Z1)(s),!s.length)return;e.selection.clear();let o=e.doc,r=(0,iV.G6)(s);(0,iV.fG)(e,r).then(t=>{if(null===t)return;let i=(0,iV.B$)(o,s,t);e.spec.getService("affine:embed-linked-doc").slots.linkedDocCreated.emit({docId:i.id}),(0,iV.eD)(e,o)})}}],bK=(e,t)=>t.contains(e)&&e!==t;class bX{constructor(e){this._anchorSel=null,this._bindMoveBlockHotKey=()=>{bG.forEach(e=>{e.hotkey.forEach(t=>{this.host.bindHotKey({[t]:t=>(t.get("defaultState").event.preventDefault(),e.action(this.host))})})})},this._bindQuickActionHotKey=()=>{bY.forEach(e=>{e.hotkey&&this.host.bindHotKey({[e.hotkey]:t=>{e.showWhen(this.host.host)&&(t.get("defaultState").event.preventDefault(),e.action(this.host.host))}})})},this._bindTextConversionHotKey=()=>{aO.forEach(e=>{e.hotkey&&e.hotkey.forEach(t=>{this.host.bindHotKey({[t]:t=>{t.get("defaultState").event.preventDefault();let[i]=this._std.command.chain().updateBlockType({flavour:e.flavour,props:{type:e.type}}).inline((t,i)=>{let s=t.updatedBlocks,o=t.std.host;if((0,H.Z1)(s),(0,H.Z1)(o),"affine:code"!==e.flavour)return;let[r]=s;gA(o,r,()=>{let e=this._std.view.viewFromPath("block",(0,O.UL)(r));(0,H.Z1)(e),this._std.selection.setGroup("note",[this._std.selection.create("text",{from:{blockId:e.blockId,index:0,length:r.text?.length??0},to:null})])}).catch(console.error),i()}).run();return i}})})})},this._focusBlock=null,this._onArrowDown=e=>{let t=e.get("defaultState").event,[i]=this._std.command.chain().inline((e,t)=>(this._reset(),t())).try(e=>[e.getTextSelection().inline((e,t)=>{let i=e.currentTextSelection;return(0,H.Z1)(i),t({currentSelectionPath:i.blockId})}).getNextBlock().inline((e,t)=>{let{nextBlock:i}=e;if(i)return(0,O.op)(i.model,["affine:paragraph","affine:list","affine:code"])||this._std.command.chain().with({focusBlock:i}).selectBlock().run(),t({})}),e.getBlockSelections().inline((e,t)=>{let i=e.currentBlockSelections;(0,H.Z1)(i);let s=i.at(-1);if(s)return t({currentSelectionPath:s.blockId})}).getNextBlock().inline((e,i)=>{let{nextBlock:s}=e;return((0,H.Z1)(s),t.preventDefault(),(0,O.op)(s.model,["affine:paragraph","affine:list","affine:code"]))?this._std.command.chain().focusBlockStart({focusBlock:s}).run():this._std.command.chain().with({focusBlock:s}).selectBlock().run(),i()})]).run();return i},this._onArrowUp=e=>{let t=e.get("defaultState").event,[i]=this._std.command.chain().inline((e,t)=>(this._reset(),t())).try(e=>[e.getTextSelection().inline((e,t)=>{let i=e.currentTextSelection;return(0,H.Z1)(i),t({currentSelectionPath:i.blockId})}).getPrevBlock().inline((e,t)=>{let{prevBlock:i}=e;if(i)return(0,O.op)(i.model,["affine:paragraph","affine:list","affine:code"])||this._std.command.chain().with({focusBlock:i}).selectBlock().run(),t({})}),e.getBlockSelections().inline((e,t)=>{let i=e.currentBlockSelections;(0,H.Z1)(i);let s=i.at(-1);if(s)return t({currentSelectionPath:s.blockId})}).getPrevBlock().inline((e,i)=>{let{prevBlock:s}=e;return((0,H.Z1)(s),(0,O.op)(s.model,["affine:paragraph","affine:list","affine:code"]))?(t.preventDefault(),this._std.command.chain().focusBlockEnd({focusBlock:s}).run()):this._std.command.chain().with({focusBlock:s}).selectBlock().run(),i()})]).run();return i},this._onBlockShiftDown=e=>e.getBlockSelections().inline((e,t)=>{let i=e.currentBlockSelections;if((0,H.Z1)(i),this._anchorSel||(this._anchorSel=i.at(-1)??null),!this._anchorSel)return;let s=e.std.view.getBlock(this._anchorSel.blockId);if(s)return t({anchorBlock:s,currentSelectionPath:this._focusBlock?.blockId??s?.blockId})}).getNextBlock({}).inline((e,t)=>{if((0,H.Z1)(e.nextBlock),this._focusBlock=e.nextBlock,bK(this._focusBlock,this.host))return t({focusBlock:this._focusBlock})}).selectBlocksBetween({tail:!0}),this._onBlockShiftUp=e=>e.getBlockSelections().inline((e,t)=>{let i=e.currentBlockSelections;if((0,H.Z1)(i),this._anchorSel||(this._anchorSel=i.at(0)??null),!this._anchorSel)return;let s=e.std.view.getBlock(this._anchorSel.blockId);if(s)return t({anchorBlock:s,currentSelectionPath:this._focusBlock?.blockId??s?.blockId})}).getPrevBlock({}).inline((e,t)=>{if((0,H.Z1)(e.prevBlock),this._focusBlock=e.prevBlock,bK(this._focusBlock,this.host))return t({focusBlock:this._focusBlock})}).selectBlocksBetween({tail:!1}),this._onEnter=e=>{let t=e.get("defaultState").event,[i]=this._std.command.chain().getBlockSelections().inline((e,i)=>{let s=e.currentBlockSelections?.at(-1);if(!s)return;let{view:o,doc:r,selection:a}=e.std,n=o.getBlock(s.blockId);if(!n)return;let{model:l}=n,c=r.getParent(l);if(!c)return;let d=c.children.indexOf(l)??void 0,h=r.addBlock("affine:paragraph",{},c,d+1),u=a.create("text",{from:{blockId:h,index:0,length:0},to:null});return t.preventDefault(),a.setGroup("note",[u]),i()}).run();return i},this._onEsc=()=>{let[e]=this._std.command.chain().getBlockSelections().inline((e,t)=>{if(e.currentBlockSelections?.at(-1))return e.std.selection.update(e=>e.filter(e=>!e.is("block"))),t()}).run();return e},this._onSelectAll=e=>{e.get("defaultState").event.preventDefault();let t=this._std.selection;if(!t.find("block"))return;let i=this.host.model.children.map(e=>t.create("block",{blockId:e.id}));t.update(e=>e.filter(e=>!e.is("block")).concat(i))},this._onShiftArrowDown=()=>{let[e]=this._std.command.chain().try(e=>[this._onBlockShiftDown(e)]).run();return e},this._onShiftArrowUp=()=>{let[e]=this._std.command.chain().try(e=>[this._onBlockShiftUp(e)]).run();return e},this._reset=()=>{this._anchorSel=null,this._focusBlock=null},this.bind=()=>{this.host.handleEvent("keyDown",e=>{"Shift"!==e.get("keyboardState").raw.key&&this._reset()}),this.host.bindHotKey({ArrowDown:this._onArrowDown,ArrowUp:this._onArrowUp,"Shift-ArrowDown":this._onShiftArrowDown,"Shift-ArrowUp":this._onShiftArrowUp,Escape:this._onEsc,Enter:this._onEnter,"Mod-a":this._onSelectAll}),this._bindQuickActionHotKey(),this._bindTextConversionHotKey(),this._bindMoveBlockHotKey()},(this.host=e).addController(this)}get _std(){return this.host.std}hostConnected(){this._reset()}hostDisconnected(){this._reset()}}var bQ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},bJ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-note")],s=[],o=P.p_;return class extends o{static{t=this}constructor(){super(...arguments),this.keymapController=new bX(this)}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;bQ(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` .affine-note-block-container { display: flow-root; } .affine-note-block-container.selected { background-color: var(--affine-hover-color); } `}connectedCallback(){super.connectedCallback(),this.keymapController.bind()}renderBlock(){return(0,L.qy)`
    ${this.renderChildren(this.model)}
    `}static{bJ(t,s)}},t})();var b0=i(54702),b2=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},b5=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n=[(0,D.EM)("edgeless-note-mask")],l=[],c=(0,P.Tm)(P.ao),d=[],h=[],u=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[];(class extends c{static{t=this}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,D.MZ)({attribute:!1})],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],b2(this,null,i,{kind:"accessor",name:"display",static:!1,private:!1,access:{has:e=>"display"in e,get:e=>e.display,set:(e,t)=>{e.display=t}},metadata:p},d,h),b2(this,null,s,{kind:"accessor",name:"editing",static:!1,private:!1,access:{has:e=>"editing"in e,get:e=>e.editing,set:(e,t)=>{e.editing=t}},metadata:p},u,f),b2(this,null,o,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:p},g,m),b2(this,null,r,{kind:"accessor",name:"model",static:!1,private:!1,access:{has:e=>"model"in e,get:e=>e.model,set:(e,t)=>{e.model=t}},metadata:p},v,y),b2(this,null,a,{kind:"accessor",name:"zoom",static:!1,private:!1,access:{has:e=>"zoom"in e,get:e=>e.zoom,set:(e,t)=>{e.zoom=t}},metadata:p},b,w),b2(null,e={value:t},n,{kind:"class",name:t.name,metadata:p},null,l),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p}),b5(t,l)}firstUpdated(){let e=this.renderRoot.querySelector(".affine-note-mask"),t=new ResizeObserver(e=>{for(let t of e)if(!this.model.edgeless.collapse){let e=p.z.deserialize(this.model.xywh),i=this.model.edgeless.scale??1,s=t.contentRect.height*i;if(!s||(0,b0.f3)(e.h,s))return;e.h=s,this.model.stash("xywh"),this.model.xywh=e.serialize()}});t.observe(e),this._disposables.add(()=>{this.model.doc.getBlockById(this.model.id)&&this.model.pop("xywh"),t.disconnect()})}render(){let e=this.editing?b7:0;return(0,L.qy)`
    `}#e=b5(this,d,void 0);get display(){return this.#e}set display(e){this.#e=e}#e8=(b5(this,h),b5(this,u,void 0));get editing(){return this.#e8}set editing(e){this.#e8=e}#n=(b5(this,f),b5(this,g,void 0));get host(){return this.#n}set host(e){this.#n=e}#iJ=(b5(this,m),b5(this,v,void 0));get model(){return this.#iJ}set model(e){this.#iJ=e}#l0=(b5(this,y),b5(this,b,void 0));get zoom(){return this.#l0}set zoom(e){this.#l0=e}constructor(){super(...arguments),b5(this,w)}})})();let b7=20;(()=>{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("affine-edgeless-note")],c=[],d=(0,P.$K)(b1),h=[],f=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[];(class extends d{static{t=this}static{let u="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.wk)()],r=[(0,D.wk)()],a=[(0,D.wk)()],n=[(0,D.P)(".edgeless-note-page-content .affine-note-block-container")],b2(this,null,i,{kind:"accessor",name:"_editing",static:!1,private:!1,access:{has:e=>"_editing"in e,get:e=>e._editing,set:(e,t)=>{e._editing=t}},metadata:u},h,f),b2(this,null,s,{kind:"accessor",name:"_isHover",static:!1,private:!1,access:{has:e=>"_isHover"in e,get:e=>e._isHover,set:(e,t)=>{e._isHover=t}},metadata:u},g,m),b2(this,null,o,{kind:"accessor",name:"_isResizing",static:!1,private:!1,access:{has:e=>"_isResizing"in e,get:e=>e._isResizing,set:(e,t)=>{e._isResizing=t}},metadata:u},v,y),b2(this,null,r,{kind:"accessor",name:"_isSelected",static:!1,private:!1,access:{has:e=>"_isSelected"in e,get:e=>e._isSelected,set:(e,t)=>{e._isSelected=t}},metadata:u},b,w),b2(this,null,a,{kind:"accessor",name:"_noteFullHeight",static:!1,private:!1,access:{has:e=>"_noteFullHeight"in e,get:e=>e._noteFullHeight,set:(e,t)=>{e._noteFullHeight=t}},metadata:u},x,_),b2(this,null,n,{kind:"accessor",name:"_notePageContent",static:!1,private:!1,access:{has:e=>"_notePageContent"in e,get:e=>e._notePageContent,set:(e,t)=>{e._notePageContent=t}},metadata:u},C,k),b2(null,e={value:t},l,{kind:"class",name:t.name,metadata:u},null,c),t=e.value,u&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:u})}static{this.styles=(0,L.AH)` .edgeless-note-collapse-button { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; z-index: 2; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); opacity: 0.2; transition: opacity 0.3s; } .edgeless-note-collapse-button:hover { opacity: 1; } .edgeless-note-collapse-button.flip { transform: translateX(-50%) rotate(180deg); } .edgeless-note-collapse-button.hide { display: none; } .edgeless-note-container:has(.affine-embed-synced-doc-container.editing) > .note-background { left: ${-b7}px !important; top: ${-b7}px !important; width: calc(100% + ${2*b7}px) !important; height: calc(100% + ${2*b7}px) !important; } .edgeless-note-container:has(.affine-embed-synced-doc-container.editing) > edgeless-note-mask { display: none; } `}_collapsedContent(){if(!this._isShowCollapsedContent)return L.s6;let{xywh:e,edgeless:t}=this.model,{borderSize:i}=t.style,s=this._editing?b7:0,o=this._editing?i:0,r=p.z.deserialize(e),a=t.scale??1,n=r.w/a+2*s+o,l=r.h/a,c=this._notePageContent?.getBoundingClientRect();if(!c)return L.s6;let d=this.rootService.viewport.zoom;return(this._noteFullHeight=c.height/a/d+2*eh.ei,l>=this._noteFullHeight)?L.s6:(0,L.qy)`
    `}_handleClickAtBackground(e){if(e.stopPropagation(),!this._editing)return;let t=this.getBoundingClientRect(),i=16*this._zoom,s=2*this._zoom,o=(0,b0.qE)(e.x,t.left+s,t.right-s),r=(0,b0.qE)(e.y,t.top+i,t.bottom-i);(0,tp.kW)(o,r),this.doc.readonly||this._tryAddParagraph(o,r)}_hovered(){this.selection.value.some(e=>"surface"===e.type&&e.blockId===this.model.id)&&(this._isHover=!0)}get _isShowCollapsedContent(){return this.model.edgeless.collapse&&(this._isResizing||this._isHover)}_leaved(){this._isHover&&(this._isHover=!1)}_setCollapse(e){e.stopImmediatePropagation();let{collapse:t,collapsedHeight:i}=this.model.edgeless;if(t)this.model.doc.updateBlock(this.model,()=>{this.model.edgeless.collapse=!1});else if(i){let{xywh:e,edgeless:t}=this.model,s=p.z.deserialize(e);s.h=i*(t.scale??1),this.model.doc.updateBlock(this.model,()=>{this.model.edgeless.collapse=!0,this.model.xywh=s.serialize()})}this.selection.clear()}_tryAddParagraph(e,t){let i=(0,of.hF)(new u.b(e,t));if(!i)return;let s=i.getBoundingClientRect(),o=t-s.top{this.std.selection.setGroup("note",[this.std.selection.create("text",{from:{blockId:e,index:0,length:0},to:null})])}).catch(console.error)}}get _zoom(){return this.rootService.viewport.zoom}connectedCallback(){super.connectedCallback();let e=this.rootService.selection;this._editing=e.has(this.model.id)&&e.editing,this._disposables.add(e.slots.updated.on(()=>{e.has(this.model.id)&&e.editing?this._editing=!0:this._editing=!1}))}firstUpdated(){let{_disposables:e}=this,t=this.rootService.selection;e.add(this.rootService.slots.elementResizeStart.on(()=>{t.selectedElements.includes(this.model)&&(this._isResizing=!0)})),e.add(this.rootService.slots.elementResizeEnd.on(()=>{this._isResizing=!1}));let i=new MutationObserver(()=>{let e=this._notePageContent?.getBoundingClientRect();if(!e)return;let t=this.rootService.viewport.zoom,i=this.model.edgeless.scale??1;this._noteFullHeight=e.height/i/t+2*eh.ei});this._notePageContent&&(i.observe(this,{childList:!0,subtree:!0}),e.add(()=>i.disconnect()))}getRenderingRect(){let{xywh:e,edgeless:t}=this.model,{collapse:i,scale:s=1}=t,o=p.z.deserialize(e),r=o.w/s,a=o.h/s;return{x:o.x,y:o.y,w:r,h:i?a:"inherit",zIndex:this.toZIndex()}}renderGfxBlock(){let{model:e}=this,{displayMode:t}=e;if(t&&t===e$.ko.DocOnly)return L.s6;let{xywh:i,edgeless:s}=e,{borderRadius:o,borderSize:r,borderStyle:a,shadowType:n}=s.style,{collapse:l,collapsedHeight:c,scale:d=1}=s,h=p.z.deserialize(i),u=h.w/d,f=h.h/d,g={height:"100%",padding:`${eh.ei}px`,boxSizing:"border-box",borderRadius:o+"px",pointerEvents:"all",transformOrigin:"0 0",transform:`scale(${d})`,fontWeight:"400",lineHeight:"var(--affine-line-height)"},m=this._editing?b7:0,v=j.Q.generateColorProperty(e.background,W.KI),y={position:"absolute",left:`${-m}px`,top:`${-m}px`,width:`${u+2*m}px`,height:`calc(100% + ${2*m}px)`,borderRadius:o+"px",transition:this._editing?"left 0.3s, top 0.3s, width 0.3s, height 0.3s":"none",backgroundColor:v,border:`${r}px ${a===tI.u1.Dash?"dashed":a} var(--affine-black-10)`,boxShadow:this._editing?"var(--affine-active-shadow)":n?`var(${n})`:"none"},b=null!=l&&null!=c&&c!==this._noteFullHeight,w=l?this._noteFullHeight
    ${this.renderPageContent()}
    ${b?(0,L.qy)`
    ${sm.K4}
    `:L.s6} ${this._collapsedContent()} `}toZIndex(){return this.rootService?.layer.getZIndex(this.model).toString()??"0"}get rootService(){return super.rootService}#iM;get _editing(){return this.#iM}set _editing(e){this.#iM=e}#ap;get _isHover(){return this.#ap}set _isHover(e){this.#ap=e}#a$;get _isResizing(){return this.#a$}set _isResizing(e){this.#a$=e}#i9;get _isSelected(){return this.#i9}set _isSelected(e){this.#i9=e}#l2;get _noteFullHeight(){return this.#l2}set _noteFullHeight(e){this.#l2=e}#l5;get _notePageContent(){return this.#l5}set _notePageContent(e){this.#l5=e}constructor(){super(...arguments),this.rootServiceFlavour="affine:page",this.#iM=b5(this,h,!1),this.#ap=(b5(this,f),b5(this,g,!1)),this.#a$=(b5(this,m),b5(this,v,!1)),this.#i9=(b5(this,y),b5(this,b,!1)),this.#l2=(b5(this,w),b5(this,x,0)),this.#l5=(b5(this,_),b5(this,C,null)),b5(this,k)}static{b5(t,c)}})})();let b3=(0,L.AH)` affine-paragraph { box-sizing: border-box; display: block; font-size: var(--affine-font-base); } .affine-paragraph-block-container { position: relative; border-radius: 4px; } .affine-paragraph-rich-text-wrapper { position: relative; } affine-paragraph code { font-size: calc(var(--affine-font-base) - 3px); padding: 0px 4px 2px; } .h1 { font-size: var(--affine-font-h-1); font-weight: 700; letter-spacing: -0.02em; line-height: calc(1em + 8px); margin-top: 18px; margin-bottom: 10px; } .h1 code { font-size: calc(var(--affine-font-base) + 10px); padding: 0px 4px; } .h2 { font-size: var(--affine-font-h-2); font-weight: 600; letter-spacing: -0.02em; line-height: calc(1em + 10px); margin-top: 14px; margin-bottom: 10px; } .h2 code { font-size: calc(var(--affine-font-base) + 8px); padding: 0px 4px; } .h3 { font-size: var(--affine-font-h-3); font-weight: 600; letter-spacing: -0.02em; line-height: calc(1em + 8px); margin-top: 12px; margin-bottom: 10px; } .h3 code { font-size: calc(var(--affine-font-base) + 6px); padding: 0px 4px; } .h4 { font-size: var(--affine-font-h-4); font-weight: 600; letter-spacing: -0.015em; line-height: calc(1em + 8px); margin-top: 12px; margin-bottom: 10px; } .h4 code { font-size: calc(var(--affine-font-base) + 4px); padding: 0px 4px; } .h5 { font-size: var(--affine-font-h-5); font-weight: 600; letter-spacing: -0.015em; line-height: calc(1em + 8px); margin-top: 12px; margin-bottom: 10px; } .h5 code { font-size: calc(var(--affine-font-base) + 2px); padding: 0px 4px; } .h6 { font-size: var(--affine-font-h-6); font-weight: 600; letter-spacing: -0.015em; line-height: calc(1em + 8px); margin-top: 12px; margin-bottom: 10px; } .h6 code { font-size: var(--affine-font-base); padding: 0px 4px 2px; } .quote { line-height: 26px; padding-left: 17px; margin-top: var(--affine-paragraph-space); padding-top: 10px; padding-bottom: 10px; position: relative; } .quote::after { content: ''; width: 2px; height: calc(100% - 20px); margin-top: 10px; margin-bottom: 10px; position: absolute; left: 0; top: 0; background: var(--affine-quote-color); border-radius: 18px; } .affine-paragraph-placeholder { position: absolute; display: none; left: 0; bottom: 0; pointer-events: none; color: var(--affine-black-30); fill: var(--affine-black-30); } .affine-paragraph-placeholder.visible { display: block; } @media print { .affine-paragraph-placeholder.visible { display: none; } } `;var b4=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},b6=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-paragraph")],s=[],o=s0.w,r=[],a=[];return class extends o{static{t=this}constructor(){super(...arguments),this._composing=(0,q.vP)(!1),this._displayPlaceholder=(0,q.vP)(!1),this._inlineRangeProvider=null,this._isInDatabase=()=>{let e=this.parentElement;for(;e&&e!==document.body;){if("affine-database"===e.tagName.toLowerCase())return!0;e=e.parentElement}return!1},this.#eL=b6(this,r,null),this.#I=(b6(this,a),{margin:"10px 0"})}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;b4(this,null,[(0,D.P)("rich-text")],{kind:"accessor",name:"_richTextElement",static:!1,private:!1,access:{has:e=>"_richTextElement"in e,get:e=>e._richTextElement,set:(e,t)=>{e._richTextElement=t}},metadata:n},r,a),b4(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=b3}connectedCallback(){super.connectedCallback(),oB(this),this.handleEvent("compositionStart",()=>{this._composing.value=!0},{flavour:!0}),this.handleEvent("compositionEnd",()=>{this._composing.value=!1},{flavour:!0}),this._inlineRangeProvider=(0,P.U4)(this),this.disposables.add((0,q.QZ)(()=>{if(this._composing.value||this.doc.readonly){this._displayPlaceholder.value=!1;return}let e=this.host.selection.find("text"),t=e?.isCollapsed()??!1;if(!this.selected||!t){this._displayPlaceholder.value=!1;return}this.updateComplete.then(()=>{if((this.inlineEditor?.yTextLength??0)>0||this._isInDatabase()){this._displayPlaceholder.value=!1;return}this._displayPlaceholder.value=!0}).catch(console.error)}))}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this._richTextElement?.updateComplete,e}renderBlock(){let{type$:e}=this.model,t=(0,L.qy)`
    ${this.renderChildren(this.model)}
    `;return(0,L.qy)`
    (0,of.dV)(this.host)} > ${this.inEdgelessText?L.s6:(0,L.qy)`
    ${this.service.placeholderGenerator(this.model)}
    `}
    ${t}
    `}get attributeRenderer(){return this.inlineManager.getRenderer()}get attributesSchema(){return this.inlineManager.getSchema()}get embedChecker(){return this.inlineManager.embedChecker}get inEdgelessText(){return this.topContenteditableElement instanceof ik}get inlineEditor(){return this._richTextElement?.inlineEditor}get inlineManager(){let e=this.service?.inlineManager;return(0,H.Z1)(e),e}get markdownShortcutHandler(){return this.inlineManager.markdownShortcutHandler}get topContenteditableElement(){return this.rootComponent instanceof fG?this.closest(W.Tk):this.rootComponent}#eL;get _richTextElement(){return this.#eL}set _richTextElement(e){this.#eL=e}#I;get blockContainerStyles(){return this.#I}set blockContainerStyles(e){this.#I=e}static{b6(t,s)}},t})();var b9=i(1126),we=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},wt=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a=[(0,D.EM)("affine-surface-ref"),(0,ri.YE)()],n=[],l=P.p_,c=[],d=[],u=[],f=[],g=[],m=[],y=[],b=[];(class extends l{static{t=this}static{let h="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.wk)()],o=[(0,D.P)("affine-surface-ref > block-caption-editor")],r=[(0,D.P)("editor-host")],we(this,null,i,{kind:"accessor",name:"_focused",static:!1,private:!1,access:{has:e=>"_focused"in e,get:e=>e._focused,set:(e,t)=>{e._focused=t}},metadata:h},c,d),we(this,null,s,{kind:"accessor",name:"_surfaceModel",static:!1,private:!1,access:{has:e=>"_surfaceModel"in e,get:e=>e._surfaceModel,set:(e,t)=>{e._surfaceModel=t}},metadata:h},u,f),we(this,null,o,{kind:"accessor",name:"captionElement",static:!1,private:!1,access:{has:e=>"captionElement"in e,get:e=>e.captionElement,set:(e,t)=>{e.captionElement=t}},metadata:h},g,m),we(this,null,r,{kind:"accessor",name:"previewEditor",static:!1,private:!1,access:{has:e=>"previewEditor"in e,get:e=>e.previewEditor,set:(e,t)=>{e.previewEditor=t}},metadata:h},y,b),we(null,e={value:t},a,{kind:"class",name:t.name,metadata:h},null,n),t=e.value,h&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:h})}static{this.styles=(0,L.AH)` .affine-surface-ref { position: relative; user-select: none; margin: 10px 0; } .ref-placeholder { padding: 26px 0px 0px; } .placeholder-image { margin: 0 auto; text-align: center; } .placeholder-text { margin: 12px auto 0; text-align: center; font-size: 28px; font-weight: 600; line-height: 36px; font-family: var(--affine-font-family); } .placeholder-action { margin: 32px auto 0; text-align: center; } .delete-button { width: 204px; padding: 4px 18px; display: inline-flex; justify-content: center; align-items: center; gap: 4px; border-radius: 8px; border: 1px solid var(--affine-border-color); font-family: var(--affine-font-family); font-size: 12px; font-weight: 500; line-height: 20px; background-color: transparent; cursor: pointer; } .delete-button > .icon > svg { color: var(--affine-icon-color); width: 16px; height: 16px; display: block; } .placeholder-reason { margin: 72px auto 0; padding: 10px; text-align: center; font-size: 12px; font-family: var(--affine-font-family); line-height: 20px; color: var(--affine-warning-color); background-color: var(--affine-background-error-color); } .ref-content { position: relative; padding: 20px; background-color: var(--affine-background-primary-color); background: radial-gradient( var(--affine-edgeless-grid-color) 1px, var(--affine-background-primary-color) 1px ); } .ref-viewport { max-width: 100%; margin: 0 auto; position: relative; overflow: hidden; pointer-events: none; user-select: none; } .ref-viewport.frame { border-radius: 2px; border: 1px solid var(--affine-black-30); } .surface-ref-mask { position: absolute; left: 0; top: 0; width: 100%; height: 100%; } .surface-ref-mask:hover { background-color: rgba(211, 211, 211, 0.1); } .surface-ref-mask:hover .ref-label { display: block; } .ref-label { display: none; user-select: none; } .ref-label { position: absolute; left: 0; bottom: 0; width: 100%; padding: 8px 16px; border: 1px solid var(--affine-border-color); gap: 14px; background: var(--affine-background-primary-color); font-size: 12px; user-select: none; } .ref-label .title { display: inline-block; font-weight: 600; font-family: var(--affine-font-family); line-height: 20px; color: var(--affine-text-secondary-color); } .ref-label .title > svg { color: var(--affine-icon-secondary); display: inline-block; vertical-align: baseline; width: 20px; height: 20px; vertical-align: bottom; } .ref-label .suffix { display: inline-block; font-weight: 400; color: var(--affine-text-disable-color); line-height: 20px; } `}_deleteThis(){this.doc.deleteBlock(this.model)}_focusBlock(){this.selection.update(()=>[this.selection.create("block",{blockId:this.blockId})])}_initHotkey(){let e=this.host.selection,t=()=>{if(!this.doc.getParent(this.model))return;let[t]=this.doc.addSiblingBlocks(this.model,[{flavour:"affine:paragraph"}]),i=this.doc.getBlockById(t);(0,H.Z1)(i,"Failed to add paragraph block."),(0,sy.Ak)(()=>{e.update(t=>t.filter(e=>!e.is("block")).concat(e.create("text",{from:{blockId:i.id,index:0,length:0},to:null})))},this)};this.bindHotKey({Enter:()=>{if(this._focused)return t(),!0}})}_initReferencedModel(){let e=this.doc.getBlocksByFlavour("affine:surface")[0]?.model??null;this._surfaceModel=e;let t=()=>{if(!this.model.reference)return[null,this.doc.id];if(this.doc.getBlock(this.model.reference))return[this.doc.getBlock(this.model.reference).model,this.doc.id];if(this._surfaceModel?.getElementById(this.model.reference))return[this._surfaceModel.getElementById(this.model.reference),this.doc.id];let e=[...this.std.collection.docs.values()].map(e=>e.getDoc()).find(e=>e.getBlock(this.model.reference)||e.getBlocksByFlavour("affine:surface")[0].model.getElementById(this.model.reference));return(e&&(this._surfaceModel=e.getBlocksByFlavour("affine:surface")[0].model),e&&e.getBlock(this.model.reference))?[e.getBlock(this.model.reference).model,e.id]:e&&e.getBlocksByFlavour("affine:surface")[0]?[e.getBlocksByFlavour("affine:surface")[0].model.getElementById(this.model.reference),e.id]:[null,this.doc.id]},i=()=>{let[e,i]=t();this._referencedModel=e&&e.xywh?e:null,this._previewDoc=this.doc.collection.getDoc(i,{readonly:!0}),this._referenceXYWH=this._referencedModel?.xywh??null};i(),this._disposables.add(this.model.propsUpdated.on(e=>{"reference"===e.key&&this.model.reference!==this._referencedModel?.id&&i()})),e&&this._referencedModel instanceof v.nz&&this._disposables.add(e.elementRemoved.on(({id:e})=>{this.model.reference===e&&i()})),this._referencedModel instanceof b9.ug&&this._disposables.add(this.doc.slots.blockUpdated.on(({type:e,id:t})=>{"delete"===e&&t===this.model.reference&&i()}))}_initSelection(){let e=this.host.selection;this._disposables.add(e.slots.changed.on(e=>{this._focused=e.some(e=>e.blockId===this.blockId&&e.is("block"))}))}_initSpec(){this._previewSpec.setup("affine:page",({viewConnected:e})=>{e.once(({component:e})=>{e.editorViewportSelector="ref-viewport",e.service.viewport.sizeUpdated.once(()=>{this._refreshViewport()})})}),this._previewSpec.setup("affine:frame",({viewConnected:e})=>{e.once(({component:e})=>{e.showBorder=!1})})}_refreshViewport(){if(!this._referenceXYWH)return;let e=this.previewEditor;e&&e.spec.getService("affine:page").viewport.setViewportByBound(p.z.deserialize(this._referenceXYWH))}_renderMask(e,t){let i="title"in e?e.title:"";return(0,L.qy)`
    ${wi[t??"DEFAULT"]??wi.DEFAULT} ${i}
    from edgeless mode
    `}_renderRefContent(e){let[,,t,i]=(0,h.W)(e.xywh),s="flavour"in e?e.flavour:e.type,o=this._previewSpec.value;return(0,L.qy)`
    ${this.host.renderSpecPortal(this._previewDoc,o)}
    ${this._renderMask(e,s)}
    `}_renderRefPlaceholder(e){return(0,L.qy)`
    ${gL.A}
    No Such ${ws[e.refFlavour??"DEFAULT"]??ws.DEFAULT}
    ${wo[e.refFlavour??"DEFAULT"]??wo.DEFAULT}
    `}get _shouldRender(){return this.isConnected&&!this.parentBlock.closest("affine-surface-ref")}connectedCallback(){if(super.connectedCallback(),oB(this),this.contentEditable="false",!this._shouldRender)return;let e=this.service;(0,H.Z1)(e,"Surface ref block must run with its service."),this._initHotkey(),this._initSpec(),this._initReferencedModel(),this._initSelection()}render(){if(!this._shouldRender)return L.s6;let{_surfaceModel:e,_referencedModel:t,model:i}=this,s=e&&t&&t.xywh?this._renderRefContent(t):this._renderRefPlaceholder(i);return(0,L.qy)`
    ${s}
    ${Object.values(this.widgets)} `}viewInEdgeless(){if(!this._referenceXYWH)return;let e={xywh:this._referenceXYWH,padding:[60,20,20,20]},t=this.std.spec.getService("affine:page");t.editPropsStore.setStorage("viewport",e),t.docModeService.setMode("edgeless")}willUpdate(e){e.has("_referencedModel")&&this._refreshViewport()}get referenceModel(){return this._referencedModel}#l7;get _focused(){return this.#l7}set _focused(e){this.#l7=e}#lI;get _surfaceModel(){return this.#lI}set _surfaceModel(e){this.#lI=e}#l3;get captionElement(){return this.#l3}set captionElement(e){this.#l3=e}#l4;get previewEditor(){return this.#l4}set previewEditor(e){this.#l4=e}constructor(){super(...arguments),this._previewDoc=null,this._previewSpec=iU.f.getInstance().getSpec("edgeless:preview"),this._referenceXYWH=null,this._referencedModel=null,this.#l7=wt(this,c,!1),this.#lI=(wt(this,d),wt(this,u,null)),this.#l3=(wt(this,f),wt(this,g,void 0)),this.#l4=(wt(this,m),wt(this,y,void 0)),wt(this,b)}static{wt(t,n)}})})();var wr=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},wa=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-edgeless-surface-ref")],s=[],o=P.p_;(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;wr(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),wa(t,s)}render(){return L.s6}})})();var wn=i(49318);i(53401);let wl=(0,L.AH)` .affine-attachment-rename-container { ${sU}; position: relative; display: flex; align-items: center; width: 320px; gap: 12px; padding: 12px; z-index: var(--affine-z-index-popover); } .affine-attachment-rename-input-wrapper { display: flex; min-width: 280px; height: 30px; box-sizing: border-box; padding: 4px 10px; background: var(--affine-white-10); border-radius: 4px; border: 1px solid var(--affine-border-color); } .affine-attachment-rename-input-wrapper:focus-within { border-color: var(--affine-blue-700); box-shadow: var(--affine-active-shadow); } .affine-attachment-rename-input-wrapper input { flex: 1; border: none; outline: none; background: transparent; color: var(--affine-text-primary-color); ${sN}; } .affine-attachment-rename-input-wrapper input::placeholder { color: var(--affine-placeholder-color); } .affine-attachment-rename-extension { font-size: var(--affine-font-xs); color: var(--affine-text-secondary-color); } .affine-attachment-rename-overlay-mask { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: var(--affine-z-index-popover); } `;(0,L.AH)` .affine-attachment-options-more { box-sizing: border-box; padding-bottom: 4px; } .affine-attachment-options-more-container { display: flex; flex-direction: column; align-items: center; color: var(--affine-text-primary-color); border-radius: 8px; padding: 8px; background: var(--affine-background-overlay-panel-color); box-shadow: var(--affine-shadow-2); } .affine-attachment-options-more-container > icon-button { display: flex; align-items: center; padding: 8px; gap: 8px; } .affine-attachment-options-more-container > icon-button[hidden] { display: none; } .affine-attachment-options-more-container > icon-button:hover.danger { background: var(--affine-background-error-color); color: var(--affine-error-color); } .affine-attachment-options-more-container > icon-button:hover.danger > svg { color: var(--affine-error-color); } `;let wc=(0,L.AH)` :host { z-index: 1; } `,wd=({editorHost:e,model:t,abortController:i})=>{let s=(0,a_._)();setTimeout(()=>s.value?.focus());let o=t.name,r=o.slice(0,o.lastIndexOf(".")),a=o.slice(o.lastIndexOf(".")),n=a.includes(".")&&a.length<=7&&o.length>a.length,l=n?r:o,c=n?a:"",d=()=>{let s=l+c;if(!s){(0,e5.o)(e,"File name cannot be empty");return}t.doc.updateBlock(t,{name:s}),i.abort()};return(0,L.qy)`
    {l=e.target.value}} @keydown=${e=>{if(e.stopPropagation(),"Escape"===e.key&&!e.isComposing){i.abort();return}if("Enter"===e.key&&!e.isComposing){d();return}}} /> ${c}
    ${G.Mwl}
    `},wh=(0,L.AH)` .affine-attachment-card { margin: 0 auto; box-sizing: border-box; display: flex; gap: 12px; width: 100%; height: ${eh.Hn.horizontalThin}px; padding: 12px; border-radius: 8px; border: 1px solid var(--affine-background-tertiary-color); opacity: var(--add, 1); background: var(--affine-background-primary-color); user-select: none; } .affine-attachment-content { height: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; flex: 1 0 0; border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-attachment-content-title { display: flex; flex-direction: row; gap: 8px; align-items: center; align-self: stretch; padding: var(--1, 0px); border-radius: var(--1, 0px); opacity: var(--add, 1); } .affine-attachment-content-title-icon { display: flex; width: 16px; height: 16px; align-items: center; justify-content: center; } .affine-attachment-content-title-icon svg { width: 16px; height: 16px; fill: var(--affine-background-primary-color); } .affine-attachment-content-title-text { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; word-break: break-all; overflow: hidden; text-overflow: ellipsis; color: var(--affine-text-primary-color); font-family: var(--affine-font-family); font-size: var(--affine-font-sm); font-style: normal; font-weight: 600; line-height: 22px; } .affine-attachment-content-info { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; flex: 1 0 0; word-break: break-all; overflow: hidden; color: var(--affine-text-secondary-color); text-overflow: ellipsis; font-family: var(--affine-font-family); font-size: var(--affine-font-xs); font-style: normal; font-weight: 400; line-height: 20px; } .affine-attachment-banner { display: flex; align-items: center; justify-content: center; } .affine-attachment-banner svg { width: 40px; height: 40px; } .affine-attachment-card.loading { background: var(--affine-background-secondary-color); .affine-attachment-content-title-text { color: var(--affine-placeholder-color); } } .affine-attachment-card.error, .affine-attachment-card.unsynced { background: var(--affine-background-secondary-color); } .affine-attachment-card.cubeThick { width: ${eh.Cd.cubeThick}px; height: ${eh.Hn.cubeThick}px; flex-direction: column-reverse; .affine-attachment-content { width: 100%; flex-direction: column; align-items: flex-start; justify-content: space-between; } .affine-attachment-banner { justify-content: flex-start; } } .affine-attachment-embed-container { position: relative; width: 100%; height: 100%; } .affine-attachment-iframe-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .affine-attachment-iframe-overlay.hide { display: none; } `;var wu=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},wp=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,s,o,r,a,n,l=[(0,D.EM)("affine-attachment")],c=[],d=U.wN,h=[],u=[],g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[];(class extends d{static{t=this}constructor(){super(...arguments),this._isDragging=!1,this._isInSurface=!1,this._isResizing=!1,this._isSelected=!1,this._whenHover=new U.n9(this,({abortController:e})=>{let t=this.host.selection,i=t.find("text");if(i&&(i.to||i.from.length))return null;let s=t.filter("block");return s.length>1||1===s.length&&s[0].blockId!==this.blockId?null:{template:function({anchor:e,model:t,showCaption:i,copy:s,download:o,refresh:r,abortController:a}){let n=!l_(t,e.service.maxFileSize),l=t.doc.readonly,c=t.embed?"embed":"card",d=[{type:"card",name:"Card view",disabled:l||!t.embed,handler:()=>{t.doc.updateBlock(t,{embed:!1}),a.abort()}},{type:"embed",name:"Embed view",disabled:l||n,handler:()=>{(function(e,t=10485760){let i=lx.find(i=>i.check(e,t));if(!i||!i.action){e.doc.updateBlock(e,{embed:!0});return}i.action(e)?.catch(console.error)})(t,e.service.maxFileSize),a.abort()}}],h=ad([[{type:"copy",name:"Copy",icon:G.TdU,disabled:l,handler:s},{type:"duplicate",name:"Duplicate",icon:G.jaP,disabled:l,handler:()=>{let e={flavour:"affine:attachment",...function(e){let t={};for(let i in ly.z_)t[i]=e[i];return t}(t)};t.doc.addSiblingBlocks(t,[e])}},{type:"reload",name:"Reload",icon:G.fNY,disabled:l,handler:r},{type:"download",name:"Download",icon:G.s3U,disabled:l,handler:o}],[{type:"delete",name:"Delete",icon:G.d7y,disabled:l,handler:()=>{t.doc.deleteBlock(t),a.abort()}}]]),u=[l?L.s6:(0,L.qy)` {a.abort();let i=new AbortController;(0,sB.cl)({template:wd({editorHost:e.host,model:t,abortController:i}),computePosition:{referenceElement:e,placement:"top-start",middleware:[(0,sI.UU)(),(0,sI.cY)(4)]},abortController:i})}} > ${G.qUP} `,(0,L.qy)`
    ${c} view
    ${G.eoI} `} >
    ${(0,t$.u)(d,e=>e.type,({type:e,name:t,handler:i})=>(0,L.qy)` ${t} `)}
    `,l?L.s6:(0,L.qy)` ${G.s3U} `,l?L.s6:(0,L.qy)` ${G.ITz} `,(0,L.qy)` ${G.FHP} `} >
    ${h}
    `];return(0,L.qy)` ${(0,sj.f)(u.filter(e=>e!==L.s6),an)} `}({anchor:this,model:this.model,showCaption:()=>this.captionEditor?.show(),copy:this.copy,download:this.download,refresh:this.refreshData,abortController:e}),computePosition:{referenceElement:this,placement:"top-start",middleware:[(0,sI.UU)(),(0,sI.cY)(4)],autoUpdate:!0}}}),this.copy=()=>{let e=f.Ji.fromModels(this.doc,[this.model]);this.std.clipboard.copySlice(e).catch(console.error),(0,U.oR)(this.host,"Copied to clipboard")},this.download=()=>{lE(this)},this.open=()=>{this.blobUrl&&window.open(this.blobUrl,"_blank")},this.refreshData=()=>{lM(this).catch(console.error)},this.#sr=wp(this,h,!0),this.#l6=(wp(this,u),wp(this,g,!1)),this.#lK=(wp(this,m),wp(this,v,void 0)),this.#lX=(wp(this,y),wp(this,b,!1)),this.#st=(wp(this,w),wp(this,x,!1)),this.#si=(wp(this,_),wp(this,C,!1)),this.#$=(wp(this,k),!0)}static{let p="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,D.wk)()],s=[(0,D.MZ)({attribute:!1})],o=[(0,D.MZ)({attribute:!1})],r=[(0,D.MZ)({attribute:!1})],a=[(0,D.MZ)({attribute:!1})],n=[(0,D.MZ)({attribute:!1})],wu(this,null,i,{kind:"accessor",name:"_showOverlay",static:!1,private:!1,access:{has:e=>"_showOverlay"in e,get:e=>e._showOverlay,set:(e,t)=>{e._showOverlay=t}},metadata:p},h,u),wu(this,null,s,{kind:"accessor",name:"allowEmbed",static:!1,private:!1,access:{has:e=>"allowEmbed"in e,get:e=>e.allowEmbed,set:(e,t)=>{e.allowEmbed=t}},metadata:p},g,m),wu(this,null,o,{kind:"accessor",name:"blobUrl",static:!1,private:!1,access:{has:e=>"blobUrl"in e,get:e=>e.blobUrl,set:(e,t)=>{e.blobUrl=t}},metadata:p},v,y),wu(this,null,r,{kind:"accessor",name:"downloading",static:!1,private:!1,access:{has:e=>"downloading"in e,get:e=>e.downloading,set:(e,t)=>{e.downloading=t}},metadata:p},b,w),wu(this,null,a,{kind:"accessor",name:"error",static:!1,private:!1,access:{has:e=>"error"in e,get:e=>e.error,set:(e,t)=>{e.error=t}},metadata:p},x,_),wu(this,null,n,{kind:"accessor",name:"loading",static:!1,private:!1,access:{has:e=>"loading"in e,get:e=>e.loading,set:(e,t)=>{e.loading=t}},metadata:p},C,k),wu(null,e={value:t},l,{kind:"class",name:t.name,metadata:p},null,c),t=e.value,p&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:p})}static{this.styles=wh}get _embedView(){if(!this.isInSurface&&this.model.embed&&this.blobUrl)return function(e,t,i=10485760){let s=lx.find(t=>t.check(e,i));return s&&s.template?s.template(e,t):(console.error("No embed view template found!",e,lx),null)}(this.model,this.blobUrl,this.service.maxFileSize)}_handleClick(e){e.stopPropagation(),this.isInSurface||this._selectBlock()}_handleDoubleClick(e){e.stopPropagation(),this.allowEmbed?this.open():this.download()}_selectBlock(){let e=this.host.selection,t=e.create("block",{blockId:this.blockId});e.setGroup("note",[t])}connectedCallback(){super.connectedCallback(),oB(this),this.refreshData(),this.contentEditable="false";let e=this.host.doc.getParent(this.model);this._isInSurface=e?.flavour==="affine:surface",this.model.style||this.doc.withoutTransact(()=>{this.doc.updateBlock(this.model,{style:ly.Fl[1]})}),this.model.propsUpdated.on(({key:e})=>{"sourceId"===e&&(this.blobUrl&&(URL.revokeObjectURL(this.blobUrl),this.blobUrl=void 0),this.refreshData())}),this.disposables.add(j.Q.subscribe(()=>this.requestUpdate())),this.disposables.add(this.std.selection.slots.changed.on(()=>{this._isSelected=!!this.selected?.is("block")||!!this.selected?.is("surface"),this._showOverlay=this._isResizing||this._isDragging||!this._isSelected})),this.handleEvent("dragStart",()=>{this._isDragging=!0,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}),this.handleEvent("dragEnd",()=>{this._isDragging=!1,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}),this.isInSurface&&(this.rootService&&(this._disposables.add(this.rootService?.slots.elementResizeStart.on(()=>{this._isResizing=!0,this._showOverlay=!0})),this._disposables.add(this.rootService.slots.elementResizeEnd.on(()=>{this._isResizing=!1,this._showOverlay=this._isResizing||this._isDragging||!this._isSelected}))),this.style.position="absolute")}disconnectedCallback(){this.blobUrl&&URL.revokeObjectURL(this.blobUrl),super.disconnectedCallback()}renderBlock(){let{name:e,size:t,style:i}=this.model,s=i??ly.Fl[1],{LoadingIcon:o}=(0,oT.Yr)(),r=this.loading?o:G.Ey0,a=this.loading?"Loading...":e,n=this.error?"File loading failed.":(0,tv.bn)(t),l=e.split(".").pop()??"",c=(0,G.UmY)(l),d=(0,Z.W)({position:"relative",width:"100%",margin:"18px 0px"});if(this.isInSurface){let e=eh.Cd[s],t=eh.Hn[s],i=p.z.deserialize((this.rootService?.getElementById(this.model.id)??this.model).xywh),o=i.w/e,r=i.h/t;d=(0,Z.W)({width:`${e}px`,height:`${t}px`,transform:`scale(${o}, ${r})`,transformOrigin:"0 0"}),this.style.width=`${i.w}px`,this.style.height=`${i.h}px`,this.style.left=`${i.x}px`,this.style.top=`${i.y}px`,this.style.zIndex=`${this.toZIndex()}`}let h=this._embedView;return(0,L.qy)`
    ${h?(0,L.qy)`
    ${h}
    `:(0,L.qy)`
    ${r}
    ${a}
    ${c}
    `}
    `}toZIndex(){return this.rootService?.layer.getZIndex(this.model)??1}updateZIndex(){this.style.zIndex=`${this.toZIndex()}`}get isInSurface(){return this._isInSurface}get rootService(){let e=this.host.spec.getService("affine:page");return e.surface?e:null}#sr;get _showOverlay(){return this.#sr}set _showOverlay(e){this.#sr=e}#l6;get allowEmbed(){return this.#l6}set allowEmbed(e){this.#l6=e}#lK;get blobUrl(){return this.#lK}set blobUrl(e){this.#lK=e}#lX;get downloading(){return this.#lX}set downloading(e){this.#lX=e}#st;get error(){return this.#st}set error(e){this.#st=e}#si;get loading(){return this.#si}set loading(e){this.#si=e}#$;get useCaptionEditor(){return this.#$}set useCaptionEditor(e){this.#$=e}static{wp(t,c)}})})();class wf{constructor(e){this._disposables=new eg.K,this._init=()=>{this._clipboard.registerAdapter("text/plain",eY,90),this._clipboard.registerAdapter("text/html",eR,80);let e=tn(this._std);this._clipboard.use(e),this._disposables.add({dispose:()=>{this._clipboard.unregisterAdapter("text/plain"),this._clipboard.unregisterAdapter("text/html"),this._clipboard.unuse(e)}})},this.onPagePaste=e=>{let t=e.get("clipboardState").raw;return t.preventDefault(),this._std.doc.captureSync(),this._std.command.chain().try(e=>[e.getTextSelection().inline((e,t)=>{let i=e.currentTextSelection;(0,H.Z1)(i),t({currentSelectionPath:(i.to??i.from).blockId})}),e.getBlockSelections().inline((e,t)=>{let i=e.currentBlockSelections;(0,H.Z1)(i);let s=i.at(-1);s&&t({currentSelectionPath:s.blockId})})]).getBlockIndex().inline((e,i)=>((0,H.Z1)(e.parentBlock),this._clipboard.paste(t,this._std.doc,e.parentBlock.model.id,e.blockIndex?e.blockIndex+1:void 0).catch(console.error),i())).run(),!0},this.host=e}get _std(){return this.host.std}hostConnected(){this._disposables.disposed&&(this._disposables=new eg.K),this._clipboard=new P.B0(this._std),this.host.handleEvent("paste",this.onPagePaste),this._init()}hostDisconnected(){this._disposables.dispose()}}let wg=(0,L.AH)` affine-code { position: relative; } .affine-code-block-container { font-size: var(--affine-font-sm); line-height: var(--affine-line-height); position: relative; padding: 32px 24px; margin-bottom: 4px; background: var(--affine-background-code-block); border-radius: 10px; box-sizing: border-box; } .affine-code-block-container .inline-editor { font-family: var(--affine-font-code-family); font-variant-ligatures: none; } .affine-code-block-container v-line { position: relative; display: inline-grid !important; grid-template-columns: auto minmax(0, 1fr); } .affine-code-block-container div:has(> v-line) { display: grid; } .affine-code-block-container .line-number { position: sticky; padding: 0 10px; left: -0.5px; z-index: 1; background: var(--affine-background-code-block); font-size: var(--affine-font-sm); line-height: var(--affine-line-height); color: var(--affine-text-secondary); box-sizing: border-box; user-select: none; } `,wm=e=>t=>(0,L.qy)``;var wv=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},wy=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-code")],s=[],o=s0.w,r=[],a=[];return class extends o{static{t=this}constructor(){super(...arguments),this._highlighter=null,this._inlineRangeProvider=null,this._previousLanguage=V.XR,this.attributesSchema=a7.z.object({}),this.clipboardController=new wf(this),this.getAttributeRenderer=()=>wm(()=>({lang:eM(this.model.language.toLowerCase())?.id??"plaintext",highlighter:this._highlighter})),this.highlightOptionsGetter=null,this.#eL=wy(this,r,null),this.#I=(wy(this,a),{margin:"24px 0"}),this.#$=!0}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;wv(this,null,[(0,D.P)("rich-text")],{kind:"accessor",name:"_richTextElement",static:!1,private:!1,access:{has:e=>"_richTextElement"in e,get:e=>e._richTextElement,set:(e,t)=>{e._richTextElement=t}},metadata:n},r,a),wv(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=wg}async _startHighlight(e){if(this._highlighter){let t=this._highlighter.getLoadedLanguages();eS(e.id)||t.includes(e.id)||this._highlighter.loadLanguage(e.id).then(()=>{let e=this.querySelector("rich-text"),t=e?.inlineEditor;t&&t.requestUpdate()}).catch(console.error);return}this._highlighter=await eB({themes:[V.dA,V.n0],langs:[e.id]});let t=this.querySelector("rich-text"),i=t?.inlineEditor;if(!i)return;i.requestUpdate();let s=i.getInlineRange();s&&i.setInlineRange(s)}connectedCallback(){super.connectedCallback(),this.clipboardController.hostConnected(),this.setHighlightOptionsGetter(()=>({lang:this._previousLanguage.id,highlighter:this._highlighter})),this.disposables.add(j.Q.subscribe(()=>{if(!this._highlighter)return;let e=this.querySelector("rich-text"),t=e?.inlineEditor;t&&setTimeout(()=>{t.requestUpdate()})})),oB(this);let e=this.host.selection,t=(e,t,i=0,s=e.length)=>{let o=[],r=i;for(;rs)break;o.push(i),r=i+1}return o};this.bindHotKey({Backspace:t=>{let i=t.get("keyboardState"),s=e.find("text");if(!s){i.raw.preventDefault();return}let o=s.from;if(0===o.index&&0===o.length)return i.raw.preventDefault(),e.setGroup("note",[e.create("block",{blockId:this.blockId})]),!0},Tab:e=>{if(this.doc.readonly)return;let i=e.get("keyboardState").raw,s=this.inlineEditor;if(!s)return;let o=s.getInlineRange();if(o){i.stopPropagation(),i.preventDefault();let e=this.inlineEditor.yText.toString(),s=e.lastIndexOf("\n",o.index-1),r=t(e,"\n",o.index,o.index+o.length).map(e=>e+1).reverse();return -1!==s?r.push(s+1):r.push(0),r.forEach(e=>{this.inlineEditor&&this.inlineEditor.insertText({index:e,length:0}," ")}),this.inlineEditor.setInlineRange({index:o.index+2,length:o.length+(r.length-1)*2}),!0}},"Shift-Tab":e=>{let i=e.get("keyboardState").raw,s=this.inlineEditor;if(!s)return;let o=s.getInlineRange();if(o){i.stopPropagation(),i.preventDefault();let e=this.inlineEditor.yText.toString(),s=e.lastIndexOf("\n",o.index-1),r=t(e,"\n",o.index,o.index+o.length).map(e=>e+1).reverse();return -1!==s?r.push(s+1):r.push(0),(r=r.filter(t=>" "===e.slice(t,t+2))).forEach(e=>{this.inlineEditor&&this.inlineEditor.deleteText({index:e,length:2})}),r.length>0&&this.inlineEditor.setInlineRange({index:o.index-(r[r.length-1]{(0,e5.o)(this.host,"Copied to clipboard")}).catch(e=>{(0,e5.o)(this.host,"Copied failed, something went wrong"),console.error(e)})}disconnectedCallback(){super.disconnectedCallback(),this.clipboardController.hostDisconnected()}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this._richTextElement?.updateComplete,e}renderBlock(){return(0,L.qy)`
    (0,of.dV)(this.host)} .vLineRenderer=${e=>(0,L.qy)` ${e.index+1} ${e.renderVElements()} `} > ${this.renderChildren(this.model)} ${Object.values(this.widgets)}
    `}setHighlightOptionsGetter(e){this.highlightOptionsGetter=e}setLang(e){let t=e?eM(e):null,i=t?.id??V.Kc;this.doc.updateBlock(this.model,{language:i})}setWrap(e){this.doc.updateBlock(this.model,{wrap:e})}updated(){if(this.model.language!==this._previousLanguage.id){let e=eM(this.model.language);this._previousLanguage=e??V.XR,e?this._startHighlight(e).catch(console.error):this._highlighter=null;let t=this.querySelector("rich-text"),i=t?.inlineEditor;i&&i.requestUpdate()}}get inlineEditor(){let e=this.querySelector(`[${A.jN}]`);return e?.inlineEditor}get readonly(){return this.doc.readonly}get topContenteditableElement(){return this.rootComponent instanceof fG?this.closest(W.Tk):this.rootComponent}#eL;get _richTextElement(){return this.#eL}set _richTextElement(e){this.#eL=e}#I;get blockContainerStyles(){return this.#I}set blockContainerStyles(e){this.#I=e}#$;get useCaptionEditor(){return this.#$}set useCaptionEditor(e){this.#$=e}static{wy(t,s)}},t})();var ww=i(61575),wx=i(70008),w_=i(65967),wC=i(51704),wk=i(99023);let wS=(0,wC.D)("rich-text").modelConfig({name:"Text",type:()=>wk.Gt.create(),defaultData:()=>({}),cellToString:e=>e?.toString()??"",cellFromString:e=>({value:e}),cellToJson:e=>e?.toString()??null,isEmpty:e=>null==e||0===e.length});wS.addConvert("select",(e,t)=>{let i={},s=e=>{if(i[e])return i[e];let t={id:(0,f.Ak)(),value:e,color:(0,eU.y)()};return i[e]=t,t};return{cells:t.map(e=>{let t=e?.toString().split(","),i=t?.[0]?.trim();if(i)return s(i).id}),column:{options:Object.values(i)}}}),wS.addConvert("multi-select",(e,t)=>{let i={},s=e=>{if(i[e])return i[e];let t={id:(0,f.Ak)(),value:e,color:(0,eU.y)()};return i[e]=t,t};return{cells:t.map(e=>{let t=[],i=e?.toString().split(",");return i?.forEach(e=>{(e=e.trim())&&t.push(s(e).id)}),t}),column:{options:Object.values(i)}}});var wM=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},wE=function(e,t,i){for(var s=arguments.length>2,o=0;o"boolean"==typeof t&&t===r[e]?[e,!t]:[e,t]));e.formatText(i,a,{mode:"merge"}),s.blur(),e.syncInlineRange()}let wB=(()=>{let e,t,i=[(0,D.EM)("affine-data-view-rich-text-cell")],s=[],o=ww.v,r=[],a=[];return class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;wM(this,null,[(0,D.P)("rich-text")],{kind:"accessor",name:"_richTextElement",static:!1,private:!1,access:{has:e=>"_richTextElement"in e,get:e=>e._richTextElement,set:(e,t)=>{e._richTextElement=t}},metadata:n},r,a),wM(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` affine-data-view-rich-text-cell { display: flex; align-items: center; width: 100%; user-select: none; } .affine-data-view-rich-text { display: flex; flex-direction: column; justify-content: center; width: 100%; height: 100%; outline: none; font-size: var(--data-view-cell-text-size); line-height: var(--data-view-cell-text-line-height); word-break: break-all; } .affine-data-view-rich-text v-line { display: flex !important; align-items: center; height: 100%; width: 100%; } .affine-data-view-rich-text v-line > div { flex-grow: 1; } `}connectedCallback(){super.connectedCallback(),"string"==typeof this.value&&this._initYText(this.value)}render(){return this.service?this.value?(0,th.qy)``:(0,th.qy)`
    `:L.s6}get attributeRenderer(){return this.inlineManager?.getRenderer()}get attributesSchema(){return this.inlineManager?.getSchema()}get inlineEditor(){(0,H.Z1)(this._richTextElement);let e=this._richTextElement.inlineEditor;return(0,H.Z1)(e),e}get inlineManager(){return this.service?.inlineManager}get service(){let e=this.closest("affine-data-view");return e?.service}get topContenteditableElement(){let e=this.closest("affine-data-view");return e?.topContenteditableElement}#eL;get _richTextElement(){return this.#eL}set _richTextElement(e){this.#eL=e}constructor(){super(...arguments),this._initYText=e=>{let t=new f.rl.Y.Text(e);this.onChange(t)},this.#eL=wE(this,r,null),wE(this,a)}static{wE(t,s)}},t})(),w$=(()=>{let e,t,i=[(0,D.EM)("affine-data-view-rich-text-cell-editing")],s=[],o=ww.v,r=[],a=[];return class extends o{static{t=this}static{let n="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;wM(this,null,[(0,D.P)("rich-text")],{kind:"accessor",name:"_richTextElement",static:!1,private:!1,access:{has:e=>"_richTextElement"in e,get:e=>e._richTextElement,set:(e,t)=>{e._richTextElement=t}},metadata:n},r,a),wM(null,e={value:t},i,{kind:"class",name:t.name,metadata:n},null,s),t=e.value,n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})}static{this.styles=(0,L.AH)` affine-data-view-rich-text-cell-editing { display: flex; align-items: center; width: 100%; min-width: 1px; cursor: text; } .affine-data-view-rich-text { display: flex; flex-direction: column; justify-content: center; width: 100%; height: 100%; outline: none; } .affine-data-view-rich-text v-line { display: flex !important; align-items: center; height: 100%; width: 100%; } .affine-data-view-rich-text v-line > div { flex-grow: 1; } `}connectedCallback(){super.connectedCallback(),this.value&&"string"!=typeof this.value||this._initYText(this.value),this.disposables.addFromEvent(this,"keydown",e=>{"a"===e.key&&(ij.vL?e.metaKey:e.ctrlKey)&&(e.stopPropagation(),e.preventDefault(),this.inlineEditor.selectAll())})}firstUpdated(){this._richTextElement?.updateComplete.then(()=>{this.disposables.add(this.inlineEditor.slots.keydown.on(this._handleKeyDown)),this.inlineEditor.focusEnd()}).catch(console.error)}render(){return this.service?(0,th.qy)`this.topContenteditableElement?.host?(0,of.dV)(this.topContenteditableElement.host):null} class="affine-data-view-rich-text inline-editor" >`:L.s6}get attributeRenderer(){return this.inlineManager?.getRenderer()}get attributesSchema(){return this.inlineManager?.getSchema()}get inlineEditor(){(0,H.Z1)(this._richTextElement);let e=this._richTextElement.inlineEditor;return(0,H.Z1)(e),e}get inlineManager(){return this.service?.inlineManager}get service(){let e=this.closest("affine-data-view");return e?.service}get topContenteditableElement(){let e=this.closest("affine-data-view");return e?.topContenteditableElement}#eL;get _richTextElement(){return this.#eL}set _richTextElement(e){this.#eL=e}constructor(){super(...arguments),this._handleKeyDown=e=>{if("Escape"!==e.key){if("Tab"===e.key){e.preventDefault();return}e.stopPropagation()}if("Enter"===e.key&&!e.isComposing){e.shiftKey?this._onSoftEnter():this.selectCurrentCell(!1),e.preventDefault();return}let t=this.inlineEditor;switch(e.key){case"B":case"b":(e.metaKey||e.ctrlKey)&&(e.preventDefault(),wI(this.inlineEditor,{bold:!0}));break;case"I":case"i":(e.metaKey||e.ctrlKey)&&(e.preventDefault(),wI(this.inlineEditor,{italic:!0}));break;case"U":case"u":(e.metaKey||e.ctrlKey)&&(e.preventDefault(),wI(this.inlineEditor,{underline:!0}));break;case"S":case"s":(e.metaKey||e.ctrlKey)&&e.shiftKey&&(e.preventDefault(),wI(t,{strike:!0}));break;case"E":case"e":(e.metaKey||e.ctrlKey)&&e.shiftKey&&(e.preventDefault(),wI(t,{code:!0}))}},this._initYText=e=>{let t=new f.EY(e);this.onChange(t)},this._onSoftEnter=()=>{if(this.value&&this.inlineEditor){let e=this.inlineEditor.getInlineRange();(0,H.Z1)(e),new f.EY(this.inlineEditor.yText).replace(e.index,e.length,"\n"),this.inlineEditor.setInlineRange({index:e.index+1,length:0})}},this.#eL=wE(this,r,null),wE(this,a)}static{wE(t,s)}},t})(),wT=wS.renderConfig({icon:(0,w_.w)("TextIcon"),cellRenderer:{view:(0,wx.d)(wB),edit:(0,wx.d)(w$)}}),wO=(e=>{let t={...e,properties:[]};return{...t,addProperty:e=>{t.properties.push(e)}}})({selector:e=>e.flavour===v8.z.model.flavour&&"todo"===e.model.type});wO.addProperty({name:"Content",key:"todo-title",columnMeta:wT,get:e=>e.text.yText,set:(e,t)=>{},updated:(e,t)=>(e.text?.yText.observe(t),{dispose:()=>{e.text?.yText.unobserve(t)}})}),wO.addProperty({name:"Checked",key:"todo-checked",columnMeta:N.Xx.checkboxColumnConfig,get:e=>e.checked,set:(e,t)=>{e.checked=t},updated:(e,t)=>e.propsUpdated.on(({key:e})=>{"checked"===e&&t()})}),wO.addProperty({name:"Source",key:"todo-source",columnMeta:N.Xx.textColumnConfig,get:e=>e.doc.meta?.title??"",updated:(e,t)=>e.doc.collection.meta.docMetaUpdated.on(()=>{t()})});let wP={todo:wO},wH=[N.Xx.dateColumnConfig,N.Xx.numberColumnConfig,N.Xx.progressColumnConfig,N.Xx.selectColumnConfig,N.Xx.multiSelectColumnConfig,N.Xx.linkColumnConfig,N.Xx.checkboxColumnConfig],wA=Object.fromEntries([...wH,wT].map(e=>[e.type,e]));class wL extends N.PL{constructor(e,t,i){for(let s of(super(),this.host=e,this.block=t,this.columnMetaMap=new Map,this.blockMap=new Map,this.docDisposeMap=new Map,this.slots={update:new a2.D},this.meta=wP[i.type],this.meta.properties))this.columnMetaMap.set(s.columnMeta.type,s.columnMeta);for(let e of this.workspace.docs.values())for(let t of Object.values(e.getDoc().blocks.peek()))this.meta.selector(t)&&this.blockMap.set(t.id,t);this.workspace.docs.forEach(e=>{this.listenToDoc(e.getDoc())}),this.workspace.slots.docAdded.on(e=>{let t=this.workspace.getDoc(e);t&&this.listenToDoc(t)}),this.workspace.slots.docRemoved.on(e=>{this.docDisposeMap.get(e)?.()})}get blocks(){return[...this.blockMap.values()]}getProperty(e){let t=this.meta.properties.find(t=>t.key===e);return(0,H.Z1)(t,`property ${e} not found`),t}newColumnName(){let e=1;for(;this.block.columns.some(t=>t.name===`Column ${e}`);)e++;return`Column ${e}`}cellChangeValue(e,t,i){if(this.getViewColumn(t)){this.block.cells[e]={...this.block.cells[e],[t]:i};return}let s=this.blockMap.get(e);s&&this.meta.properties.find(e=>e.key===t)?.set?.(s.model,i)}cellGetValue(e,t){if(this.getViewColumn(t))return this.block.cells[e]?.[t];let i=this.blockMap.get(e);if(i)return this.getProperty(t)?.get(i.model)}getPropertyMeta(e){return this.columnMetaMap.get(e)||wA[e]}getViewColumn(e){return this.block.columns.find(t=>t.id===e)}listenToDoc(e){this.docDisposeMap.set(e.id,e.slots.blockUpdated.on(t=>{if("add"===t.type){let i=e.getBlock(t.id);i&&this.meta.selector(i)&&this.blockMap.set(t.id,i)}else"delete"===t.type&&this.blockMap.delete(t.id);this.slots.update.emit()}).dispose)}propertyAdd(e,t){let i=this.block.doc;i.captureSync();let s=bh.GA[t??N.Xx.multiSelectColumnConfig.type].model.create(this.newColumnName()),o=i.generateBlockId();return this.block.columns.some(e=>e.id===o)||i.transact(()=>{let t={...s,id:o};this.block.columns.splice((0,N.qf)(e,this.block.columns),0,t)}),o}propertyChangeData(e,t){let i=this.getViewColumn(e);i&&(i.data=t)}propertyChangeName(e,t){let i=this.getViewColumn(e);i&&(i.name=t)}propertyChangeType(e,t){let i=this.getViewColumn(e);if(i){let s=i.type,o=i.data,r=this.rows$.value,a=r.map(t=>this.cellGetValue(t,e)),n=bh.GA[s].model?.convertCell(t,o,a)??{column:bh.GA[t].model.defaultData(),cells:a.map(()=>void 0)};this.block.doc.captureSync(),i.type=t,i.data=n.column,a.forEach((t,i)=>{(null!=t||null!=n.cells[i])&&(this.block.cells[r[i]]={...this.block.cells[r[i]],[e]:n.cells[i]})})}}propertyDelete(e){let t=this.block.columns.findIndex(t=>t.id===e);t>=0&&this.block.columns.splice(t,1)}propertyDuplicate(e){throw Error("Method not implemented.")}propertyGetData(e){let t=this.getViewColumn(e);if(t)return t.data;let i=this.getProperty(e);return i.getColumnData?.(this.blocks[0].model)??i.columnMeta.model.defaultData()}propertyGetDefaultWidth(e){return"title"===this.propertyGetType(e)?260:super.propertyGetDefaultWidth(e)}propertyGetName(e){let t=this.getViewColumn(e);return t?t.name:"type"===e?"Block Type":this.getProperty(e)?.name??""}propertyGetReadonly(e){return!this.getViewColumn(e)&&("type"===e||this.getProperty(e)?.set==null)}propertyGetType(e){let t=this.getViewColumn(e);return t?t.type:"type"===e?"image":this.getProperty(e).columnMeta.type}rowAdd(e){throw Error("Method not implemented.")}rowDelete(e){throw Error("Method not implemented.")}rowMove(e,t){}get addPropertyConfigList(){return wH.map(e=>e.model)}get detailSlots(){return{...super.detailSlots,header:(0,N.Z4)(bv)}}get properties(){return[...this.meta.properties.map(e=>e.key),...this.block.columns.map(e=>e.id)]}get rows(){return this.blocks.map(e=>e.id)}get workspace(){return this.host.doc.collection}}var wD=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},wZ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,D.EM)("affine-data-view")],s=[],o=U.wN;(class extends o{static{t=this}constructor(){super(...arguments),this._bindHotkey=e=>({dispose:this.host.event.bindHotkey(e,{path:this.topContenteditableElement?.path??this.path})}),this._clickDatabaseOps=e=>{(0,U.zs)(e.currentTarget,{options:{input:{initValue:this.model.title,placeholder:"Untitled",onComplete:e=>{this.model.title=e}},items:[{type:"action",icon:G.TdU,name:"Copy",select:()=>{let e=f.Ji.fromModels(this.doc,[this.model]);this.std.clipboard.copySlice(e).catch(console.error)}},{type:"group",name:"",children:()=>[{type:"action",icon:G.d7y,class:"delete-item",name:"Delete Database",select:()=>{this.model.children.slice().forEach(e=>{this.doc.deleteBlock(e)}),this.doc.deleteBlock(this.model)}}]}]}})},this._handleEvent=(e,t)=>({dispose:this.host.event.add(e,t,{path:this.path})}),this.dataView=new N.U$,this.getRootService=()=>this.std.spec.getService("affine:page"),this.headerWidget=(0,N.F5)(e=>(0,th.qy)`
    ${this.model.title}
    ${this.renderDatabaseOps()}
    ${(0,N.ep)(N.tB.viewBar,e)}
    ${(0,N.ep)(this.toolsWidget,e)}
    ${(0,N.ep)(N.tB.filterBar,e)}
    `),this.selection$=(0,q.EW)(()=>{let e=this.selection.value.find(e=>e.blockId===this.blockId&&e instanceof N.Gl);return e?.viewSelection}),this.setSelection=e=>{this.selection.setGroup("note",e?[new N.Gl({blockId:this.blockId,viewSelection:e})]:[])},this.toolsWidget=N.tB.createTools({table:[N.tB.tools.filter,N.tB.tools.expand,N.tB.tools.search,N.tB.tools.viewOptions,N.tB.tools.tableAddRow],kanban:[N.tB.tools.filter,N.tB.tools.expand,N.tB.tools.search,N.tB.tools.viewOptions]})}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;wD(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.styles=(0,L.AH)` ${(0,L.iz)((0,bk.S)("affine-database"))} affine-database { display: block; border-radius: 8px; background-color: var(--affine-background-primary-color); padding: 8px; margin: 8px -8px -8px; } .database-block-selected { background-color: var(--affine-hover-color); border-radius: 4px; } .database-ops { margin-top: 4px; padding: 2px; border-radius: 4px; display: flex; cursor: pointer; } .database-ops svg { width: 16px; height: 16px; color: var(--affine-icon-color); } .database-ops:hover { background-color: var(--affine-hover-color); } `}renderDatabaseOps(){return this.doc.readonly?L.s6:(0,th.qy)`
    ${G.jNK}
    `}connectedCallback(){super.connectedCallback(),this.setAttribute(P.vz.rangeSyncExcludeAttr,"true")}renderBlock(){let e=this.getRootService().peekViewService;return(0,th.qy)`
    ${this.dataView.render({bindHotkey:this._bindHotkey,handleEvent:this._handleEvent,selection$:this.selection$,setSelection:this.setSelection,dataSource:this.dataSource,headerWidget:this.headerWidget,std:this.std,detailPanelConfig:{openDetailPanel:e?(t,i)=>e.peek(t,i):void 0,target:()=>this.innerModalWidget.target}})}
    `}get dataSource(){return this._dataSource||(this._dataSource=new wL(this.host,this.model,{type:"todo"})),this._dataSource}get innerModalWidget(){return this.rootComponent?.widgetComponents[hu]}get topContenteditableElement(){return this.rootComponent instanceof fG?this.closest("affine-note"):this.rootComponent}get view(){return this.dataView.expose}static{wZ(t,s)}})})();var wj=i(64051),wV=i(62652);(0,td.lQ)(rJ),i(77955);var wz=i(86172);let wR={splitElements:e=>{let{notes:t,frames:i,shapes:s,images:o,edgelessTexts:r,embedSyncedDocs:a}=(0,sk.$z)((0,dq.l)(e),e=>(0,tE._h)(e)?"notes":(0,tE.X8)(e)?"frames":(0,tE.TW)(e)?"images":(0,tE.dT)(e)?"edgelessTexts":(0,tE.v8)(e)?"embedSyncedDocs":"shapes");return{notes:t??[],shapes:s??[],frames:i??[],images:o??[],edgelessTexts:r??[],embedSyncedDocs:a??[]}},matchFlavours:O.op,mindMap:{layout:M,createNode:(e,t,i)=>{let s=t.addElement(v.J9.SHAPE,{...E,xywh:"[0,0,0,0]",text:new f.rl.Y.Text(e)}),o=t.getElementById(s),r=Math.max(...e.split("\n").map(e=>(0,v.Lu)(e,(0,g.Dy)(o))))+2*m.OL,a=(0,v.dN)(o,new p.z(0,0,Math.max(148,Math.min(600,r)),78));if(t.updateElement(s,{xywh:a.serialize()}),i){let e=B[i.direction];t.addElement(v.J9.CONNECTOR,{...I,source:{id:i.parentId,position:e.from},target:{id:s,position:e.to}})}return s},changeText:(e,t,i)=>{i.updateElement(e,{text:new f.rl.Y.Text(t)});let s=i.getElementById(e),o=Math.max(...t.split("\n").map(e=>(0,v.Lu)(e,(0,g.Dy)(s))))+2*m.OL,r=(0,v.dN)(s,new p.z(0,0,Math.max(148,Math.min(600,o)),78));i.updateElement(e,{xywh:r.serialize()})},drawInEdgeless:function(e,t,i){let{shapeIds:s,connectorIds:o}=$(t,e,i);e.selection.set({elements:[...s,...o],editing:!1}),e.createGroupFromSelected()},layoutInEdgeless:function(e,t,i){T(t,e,i)}},deserializeXYWH:h.W,isCanvasElement:tE.r0,Point:u.b},wF="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},wN="__ $BLOCKSUITE_BLOCKS$ __";if(!0===wF[wN]&&console.error("@blocksuite/blocks was already imported. This breaks constructor checks and will lead to issues!"),"undefined"==typeof window)throw new c.Ss(d.O.NoneSupportedSSRError,"Seems like you are importing @blocksuite/blocks in SSR mode. Which is not supported for now.");wF[wN]=!0},47982:(e,t,i)=>{i.d(t,{z:()=>s});let s=(0,i(73711).A9)({flavour:"affine:list",props:e=>({type:"bulleted",text:e.Text(),checked:!1,collapsed:!1,order:null}),metadata:{version:1,role:"content",parent:["affine:note","affine:database","affine:list","affine:paragraph","affine:edgeless-text"]}})},80796:(e,t,i)=>{i.d(t,{R2:()=>f,RY:()=>p,fp:()=>c,l_:()=>d,wb:()=>u,xY:()=>h});var s=i(91449);let o=(0,s.qy)` `,r=(0,s.qy)` `,a=(0,s.qy)` `,n=(0,s.qy)` `,l=(0,s.JW)` `,c=(0,s.qy)` ${l} `,d=(0,s.qy)` ${l} `,h=()=>(0,s.qy)` `,u=()=>(0,s.qy)` `,p=async(e,{left:t=0,size:i=20}={})=>{let s=document.createElement("div");s.classList.add("affine-check-animation"),i<20&&console.warn("If the size is less than 20, the animation may be abnormal."),s.style.cssText=` position: absolute; width: ${i}px; height: ${i}px; border-radius: 50%; `,s.style.left=`${t}px`,e.append(s),await s.animate([{boxShadow:"0 -18px 0 -8px #1e96eb, 16px -8px 0 -8px #1e96eb, 16px 8px 0 -8px #1e96eb, 0 18px 0 -8px #1e96eb, -16px 8px 0 -8px #1e96eb, -16px -8px 0 -8px #1e96eb"}],{duration:240,easing:"ease",fill:"forwards"}).finished,await s.animate([{boxShadow:"0 -36px 0 -10px transparent, 32px -16px 0 -10px transparent, 32px 16px 0 -10px transparent, 0 36px 0 -10px transparent, -32px 16px 0 -10px transparent, -32px -16px 0 -10px transparent"}],{duration:360,easing:"ease",fill:"forwards"}).finished,s.remove()},f=[o,r,a,n]},14086:(e,t,i)=>{i.d(t,{N:()=>h,h:()=>d});var s=i(94098),o=i(73711),r=i(93574),a=i(31971),n=i(35632),l=i(38509),c=i(16019);let d=(0,o.A9)({flavour:"affine:note",props:()=>({xywh:`[0,0,${r.mh},95]`,background:n.KI,index:"a0",hidden:!1,displayMode:l.ko.DocAndEdgeless,edgeless:{style:{borderRadius:0,borderSize:4,borderStyle:c.u1.None,shadowType:n.If}}}),metadata:{version:1,role:"hub",parent:["affine:page"],children:["affine:paragraph","affine:list","affine:code","affine:divider","affine:database","affine:data-view","affine:image","affine:bookmark","affine:attachment","affine:surface-ref","affine:embed-*"]},toModel:()=>new h});class h extends(0,a.S)(o.zg){_isSelectable(){return this.displayMode!==l.ko.DocOnly}containsBound(e){return!!this._isSelectable()&&super.containsBound(e)}includesPoint(e,t){return!!this._isSelectable()&&s.z.deserialize(this.xywh).isPointInBound([e,t],0)}intersectsBound(e){return!!this._isSelectable()&&super.intersectsBound(e)}}},98452:(e,t,i)=>{i.d(t,{x:()=>s});let s=(0,i(73711).A9)({flavour:"affine:paragraph",props:e=>({type:"text",text:e.Text()}),metadata:{version:1,role:"content",parent:["affine:note","affine:database","affine:paragraph","affine:list","affine:edgeless-text"]}})},96448:(e,t,i)=>{i.d(t,{y:()=>s.ug});var s=i(1126)},17742:(e,t,i)=>{i.d(t,{Nt:()=>d,TB:()=>u,Z2:()=>function e(t,i){let s=new Set;return t.forEach(t=>{s.add(t),(0,l.X8)(t)?i.getElementsInFrame(t).forEach(e=>s.add(e)):t instanceof r.$b&&e(t.childElements,i).forEach(e=>s.add(e))}),Array.from(s)},xc:()=>c,ym:()=>h});var s=i(73711),o=i(62602),r=i(31999),a=i(12194),n=i(96448),l=i(35739);async function c(e,t){let i=new s._O({collection:t.collection});return(await Promise.all(e.map(async t=>await d(t,e,i)))).filter(e=>!!e)}async function d(e,t,i){if(e instanceof n.y){let t=await i.blockToSnapshot(e);if(!t)return;return{...t}}return e instanceof a.lw?function(e,t){let i=e.source?.id,s=e.target?.id,o=e.serialize();return i&&t.every(e=>e.id!==i)&&(o.source={position:e.absolutePath[0]}),s&&t.every(e=>e.id!==s)&&(o.target={position:e.absolutePath[e.absolutePath.length-1]}),o}(e,t):e.serialize()}function h(e){let t=(0,o.$z)(e,e=>e instanceof a.lw?"connector":e instanceof a.$f?"group":e instanceof a.AR?"mindmap":"default");return[...t.default??[],...t.connector??[],...t.group??[],...t.mindmap??[]]}function u(e,t){if(e instanceof a.lw){var i;return(i=e.serialize()).source.id&&(i.source.id=t.get(i.source.id)),i.target.id&&(i.target.id=t.get(i.target.id)),i}return e instanceof a.$f?function(e,t){if(e.children){let i={};for(let[s,o]of Object.entries(e.children)){let e=t.get(s);e&&(i[e]=o)}e.children=i}return e}(e.serialize(),t):e instanceof a.AR?function(e,t){if(e.children){let i={};for(let[s,o]of Object.entries(e.children)){let e=t.get(s);if(o.parent){let e=t.get(o.parent);o.parent=e}e&&(i[e]=o)}e.children=i}return e}(e.serialize(),t):e.serialize()}},43264:(e,t,i)=>{i.d(t,{l:()=>o});var s=i(12194);function o(e){let t=new Set;return e.forEach(e=>{e instanceof s.$f?e.descendants().forEach(e=>t.add(e)):t.add(e)}),Array.from(t)}},35739:(e,t,i)=>{i.d(t,{Aq:()=>$,BG:()=>u,C8:()=>x,Cv:()=>p,EG:()=>v,Ej:()=>b,JC:()=>M,MT:()=>C,Ql:()=>B,RT:()=>w,TW:()=>h,Te:()=>n,Wq:()=>f,X8:()=>d,_h:()=>l,_y:()=>y,dT:()=>c,or:()=>S,p1:()=>I,qX:()=>E,qo:()=>m,r0:()=>k,v8:()=>_,wI:()=>g});var s=i(43228),o=i(94098),r=i(12194),a=i(43264);function n(e){return!!e&&"flavour"in e}function l(e){return!!e&&"flavour"in e&&"affine:note"===e.flavour}function c(e){return!!e&&"flavour"in e&&"affine:edgeless-text"===e.flavour}function d(e){return!!e&&"flavour"in e&&"affine:frame"===e.flavour}function h(e){return!!e&&"flavour"in e&&"affine:image"===e.flavour}function u(e){return!!e&&"flavour"in e&&"affine:attachment"===e.flavour}function p(e){return!!e&&"flavour"in e&&"affine:bookmark"===e.flavour}function f(e){return!!e&&"flavour"in e&&/affine:embed-*/.test(e.flavour)}function g(e){return!!e&&"flavour"in e&&"affine:embed-ai-chat"===e.flavour}function m(e){return f(e)&&!_(e)&&!x(e)}function v(e){return!!e&&"flavour"in e&&"affine:embed-github"===e.flavour}function y(e){return!!e&&"flavour"in e&&"affine:embed-youtube"===e.flavour}function b(e){return!!e&&"flavour"in e&&"affine:embed-loom"===e.flavour}function w(e){return!!e&&"flavour"in e&&"affine:embed-figma"===e.flavour}function x(e){return!!e&&"flavour"in e&&"affine:embed-linked-doc"===e.flavour}function _(e){return!!e&&"flavour"in e&&"affine:embed-synced-doc"===e.flavour}function C(e){return!!e&&"flavour"in e&&"affine:embed-html"===e.flavour}function k(e){return!n(e)}function S(e){return e instanceof r.n6||e instanceof r.B5}function M(e){return!!e&&e.connectable}function E(e){switch(e.type){case"default":default:return"default";case"pan":return e.panning?"grabbing":"grab";case"brush":case"eraser":case"shape":case"connector":case"frame":case"lasso":return"crosshair";case"text":return"text"}}function I(e,t){let i=e<.5?2:1/(Math.floor(e)||1);return{gap:(0,r.qE)(20*i*e,r.P1,r.TA),grid:t?"radial-gradient(var(--affine-edgeless-grid-color) 1px, var(--affine-background-primary-color) 1px)":"unset"}}function B(e){if(0===e.length)return new DOMRect;if(1===e.length){let[t,i,o,r]=(0,s.W)(e[0].xywh);return new DOMRect(t,i,o,r)}return(0,a.l)(e).reduce((e,t,i)=>{let o=n(t)?0:t.rotate,[a,l,c,d]=(0,s.W)(t.xywh),{left:h,top:u,right:p,bottom:f}=(0,r.R$)({x:a,y:l,w:c,h:d,rotate:o});return 0!==i&&(h=Math.min(h,e.left),u=Math.min(u,e.top),p=Math.max(p,e.right),f=Math.max(f,e.bottom)),e.x=h,e.y=u,e.width=p-h,e.height=f-u,e},new DOMRect)}function $(e){let t=new Map;return(0,a.l)(e).forEach(e=>{let i={bound:o.z.deserialize(e.xywh),rotate:e.rotate};k(e)&&e instanceof r.lw&&(i.path=e.absolutePath.map(e=>e.clone())),t.set(e.id,i)}),t}},99621:(e,t,i)=>{i.d(t,{DH:()=>c,LM:()=>u,ZV:()=>l,bL:()=>d,rL:()=>h});var s=i(94098),o=i(31716),r=i(73711),a=i(82750);function n(e,t,i){return i>0&&e>t||i<0&&e{this._rafId&&cancelAnimationFrame(this._rafId),this._rafId=requestAnimationFrame(()=>{let i={x:s.x/10,y:s.y/10},r={x:this.centerX+i.x,y:this.centerY+i.y},a=s.x>0?1:-1,l=s.y>0?1:-1;r.x=n(r.x,e,a),r.y=n(r.y,t,l),this.setCenter(r.x,r.y),(r.x!=e||r.y!=t)&&o()})};o()}smoothZoom(e,t){let i=e-this.zoom;this._rafId&&cancelAnimationFrame(this._rafId);let s=()=>{this._rafId=requestAnimationFrame(()=>{let o=n(this.zoom+i/10,e,i>0?1:-1);this.setZoom(o,t),o!=e&&s()})};s()}sync(e){let t=(e,t)=>{t._syncFlag=!0,t.setZoom(e.zoom),t.setCenter(e.centerX,e.centerY),t._syncFlag=!1},i=(e,t)=>{t._syncFlag=!0,t.setRect(e.left,e.top,e.width,e.height),t._syncFlag=!1},s=[e.viewportUpdated.on(()=>{e._syncFlag||t(e,this)}),this.viewportUpdated.on(()=>{this._syncFlag||t(this,e)}),e.sizeUpdated.on(()=>{e._syncFlag||i(e,this)}),this.sizeUpdated.on(()=>{this._syncFlag||i(this,e)})];return t(e,this),()=>{s.forEach(e=>e.dispose())}}toModelBound(e){let{w:t,h:i}=e,[o,r]=this.toModelCoord(e.x,e.y);return new s.z(o,r,t/this.zoom,i/this.zoom)}toModelCoord(e,t){let{viewportX:i,viewportY:s,zoom:o,scale:r}=this;return[i+e/o/r,s+t/o/r]}toModelCoordFromClientCoord([e,t]){let{left:i,top:s}=this;return this.toModelCoord(e-i,t-s)}toViewBound(e){let{w:t,h:i}=e,[o,r]=this.toViewCoord(e.x,e.y);return new s.z(o,r,t*this.zoom,i*this.zoom)}toViewCoord(e,t){let{viewportX:i,viewportY:s,zoom:o,scale:r}=this;return[(e-i)*o*r,(t-s)*o*r]}toViewCoordFromClientCoord([e,t]){let{left:i,top:s}=this;return[e-i,t-s]}get boundingClientRect(){return this._el.getBoundingClientRect()}get center(){return this._center}get centerX(){return this._center.x}get centerY(){return this._center.y}get cumulativeParentScale(){return this._cumulativeParentScale}get height(){return this._height}get left(){return this._left}get locked(){return this._locked}set locked(e){this._locked=e}get scale(){return this.boundingClientRect.width/this._el.offsetWidth}get top(){return this._top}get translateX(){return-this.viewportX*this.zoom}get translateY(){return-this.viewportY*this.zoom}get viewportBounds(){let{viewportMinXY:e,viewportMaxXY:t}=this;return s.z.from({...e,w:(t.x-e.x)/this._cumulativeParentScale,h:(t.y-e.y)/this._cumulativeParentScale})}get viewportMaxXY(){let{centerX:e,centerY:t,width:i,height:s,zoom:o}=this;return{x:e+i/2/o,y:t+s/2/o}}get viewportMinXY(){let{centerX:e,centerY:t,width:i,height:s,zoom:o}=this;return{x:e-i/2/o,y:t-s/2/o}}get viewportX(){let{centerX:e,width:t,zoom:i}=this;return e-t/2/i}get viewportY(){let{centerY:e,height:t,zoom:i}=this;return e-t/2/i}get width(){return this._width}get zoom(){return this._zoom}}},7770:(e,t,i)=>{i.d(t,{x:()=>r});var s=i(73711);class o extends s.zg{constructor(){super(),this.created.once(()=>{this.doc.slots.rootAdded.on(e=>{let t=this.doc.getBlockById(e);if(t instanceof o){let e=this.doc.collection.meta.getDocMeta(t.doc.id);e&&e.title===t.title.toString()||this.doc.collection.setDocMeta(t.doc.id,{title:t.title.toString()})}})})}}let r=(0,s.A9)({flavour:"affine:page",props:e=>({title:e.Text()}),metadata:{version:2,role:"root"},toModel:()=>new o})},77955:(e,t,i)=>{i.d(t,{g:()=>S});var s=i(49077),o=i(22366),r=i(65828),a=i(87196),n=i(94108),l=i(82192),c=i(19860),d=i(45170),h=i(23746),u=i(22042),p=i(55012),f=i(61082),g=i(29838),m=i(58542),v=i(33096),y=i(14558),b=i(47982),w=i(14086),x=i(98452),_=i(7770),C=i(72674),k=i(14512);let S=[r.c,x.x,_.x,b.z,w.h,l.C,y.e,C.Y,o.DD,v.o,n.A,k.H,a.S,s.OH,m.X,d.S,h.f,u.D,p.V,g.O,f.L,c.C]},59242:(e,t,i)=>{i.d(t,{f:()=>n});var s=i(71006),o=i(68419),r=i(73134);class a{constructor(e){this._value=[...e]}setup(e,t){let i=this._value.findIndex(t=>t.schema.model.flavour===e);if(-1===i)throw new o.Ss(r.O.ValueNotExists,`BlockSpec not found for ${e}`);this._value[i]={...this._value[i]};let s=this._value[i],a=s.setup;s.setup=(e,i)=>{a?.(e,i),t(e,i)}}get value(){return this._value}}class n{constructor(){this.specMap=new Map}static getInstance(){return n.instance||(n.instance=new n),n.instance}addSpec(e,t){this.specMap.has(e)||this.specMap.set(e,t)}clearSpec(e){this.specMap.delete(e)}extendSpec(e,t){let i=this.specMap.get(e);if(!i){console.error(`Spec not found for ${e}`);return}this.specMap.set(e,[...i,...t])}getSpec(e){let t=this.specMap.get(e);return(0,s.Z1)(t,`Spec not found for ${e}`),new a(t)}hasSpec(e){return this.specMap.has(e)}}},70174:(e,t,i)=>{i.d(t,{H:()=>w,d:()=>y.dN});var s=i(68192),o=i(75510),r=i(48520),a=i(31716);function n(e,t=10,i,s,o="Rear",r=Math.PI/4){let c=l(e,i,o,s),d=a.l.mul(c.tangent,-1),h="Front"===o?Math.PI:0;return{points:[a.l.add(a.l.mul(a.l.rot(d,h+r),t),c),c,a.l.add(a.l.mul(a.l.rot(d,h-r),t),c)]}}function l(e,t,i,r){let n;let l="Rear"===i?e.length-1:0,c=e[l],d=e["Rear"===i?l-1:l+1],h=c.clone();return n=t!==s.B1.Curve?"Rear"===i?a.l.tangent(c,d):a.l.tangent(d,c):"Rear"===i?(0,o.rL)(r,1):(0,o.rL)(r,0),h.tangent=n??[0,0],h}function c(e){let{seed:t,roughness:i,strokeWidth:s,strokeColor:o,fillColor:r}=e;return{seed:t,roughness:i,stroke:o,strokeWidth:s,fill:r,fillStyle:"solid"}}function d(e,t,i,s,o=!0){e.fillStyle=i,e.strokeStyle=i,e.lineWidth=s,e.lineJoin="round",e.lineCap="round",e.save(),e.beginPath();for(let i=0;i{if(0===i)t.moveTo(e[0],e[1]);else{let o=s[i-1];t.bezierCurveTo(o.absOut[0],o.absOut[1],e.absIn[0],e.absIn[1],e[0],e[1])}}):s.forEach((e,i)=>{0===i?t.moveTo(e[0],e[1]):t.lineTo(e[0],e[1])}),t.stroke(),t.closePath(),t.restore()})(e,t,n,c,"dash"===d,l===s.B1.Curve,y),u(e,c,t,n,"Front",h,y),u(e,c,t,n,"Rear",p,y),g&&(t.restore(),function(e,t,i,s){let{text:o,labelXYWH:a,labelStyle:{color:n,fontSize:l,fontWeight:c,fontStyle:d,fontFamily:h,textAlign:u},labelConstraints:{hasMaxWidth:p,maxWidth:f}}=e,g=(0,r.Dy)({fontStyle:d,fontWeight:c,fontSize:l,fontFamily:h}),[,,m,v]=a,y=m/2,b=v/2,w=(0,r.ZW)(o,g,m),x=(0,r.s4)(w),_=(0,r.ks)(h,l,c),C=(x.length-1)*_*.5;t.setTransform(i),t.font=g,t.textAlign=u,t.textBaseline="middle",t.fillStyle=s.getColorValue(n,"#000000",!0);let k="center"===u?0:Math.max(...x.flatMap(e=>e.map(e=>(0,r.q_)(e.insert,g))));for(let[e,i]of(p&&f>0&&(k=Math.min(k,k)),x.entries()))for(let s of i){let i=s.insert,o=(0,r.V8)(i),a=o&&!t.canvas.isConnected;a&&document.body.append(t.canvas),t.canvas.setAttribute("dir",o?"rtl":"ltr");let n=k*("center"===u?1:"right"===u?o?-.5:.5:o?.5:-.5);t.fillText(i,n+y,e*_-C+b),a&&t.canvas.remove()}}(e,t,i.translate(m,v),a))}function u(e,t,i,s,r,h,u){let p=function(e,t,i){let{seed:s,mode:r,rough:a,roughness:n,strokeWidth:l,path:c}=t;return{end:e,seed:s,mode:r,rough:a,roughness:n,strokeWidth:l,strokeColor:i,fillColor:i,fillStyle:"solid",bezierParameters:(0,o.UV)(c)}}(r,e,u);switch(h){case"Arrow":!function(e,t,i,s){let{mode:o,end:r,bezierParameters:a,rough:l,strokeColor:h,strokeWidth:u}=s,{points:p}=n(e,u/2*15,o,a,r,Math.PI/4);l?i.linearPath(p,c(s)):d(t,p,h,u,!1)}(t,i,s,p);break;case"Triangle":!function(e,t,i,s){let{mode:o,end:r,bezierParameters:a,rough:l,strokeColor:h,strokeWidth:u}=s,{points:p}=n(e,u/2*15,o,a,r,Math.PI/6);l?i.polygon([[p[0][0],p[0][1]],[p[1][0],p[1][1]],[p[2][0],p[2][1]]],c(s)):d(t,p,h,u)}(t,i,s,p);break;case"Circle":!function(e,t,i,s){let{bezierParameters:o,mode:r,end:n,fillColor:d,strokeColor:h,strokeWidth:u,rough:p}=s,f=u/2*5,g=function(e,t=5,i,s,o="Rear"){let r=l(e,i,o,s),n=a.l.mul(r.tangent,-1),c="Front"===o?Math.PI:0;return a.l.add(a.l.mul(a.l.rot(n,c),t),r)}(e,f,r,o,n),m=g[0],v=g[1];p?i.circle(m,v,f+2,c(s)):(t.fillStyle=d,t.strokeStyle=h,t.lineWidth=u,t.save(),t.beginPath(),t.ellipse(m,v,f,f,0,0,2*Math.PI),t.closePath(),t.fill(),t.stroke(),t.restore())}(t,i,s,p);break;case"Diamond":!function(e,t,i,s){let{mode:o,end:r,rough:n,bezierParameters:h,strokeColor:u,strokeWidth:p}=s,{points:f}=function(e,t=10,i="Rear"){let s=a.l.mul(e.tangent,-1),o="Front"===i?Math.PI:0;return{points:[a.l.add(a.l.mul(a.l.rot(s,o+.25*Math.PI),t),e),e,a.l.add(a.l.mul(a.l.rot(s,o-.25*Math.PI),t),e),a.l.add(a.l.mul(a.l.rot(s,o),t*Math.sqrt(2)),e)]}}(l(e,o,r,h),p/2*10,r);n?i.polygon([[f[0][0],f[0][1]],[f[1][0],f[1][1]],[f[2][0],f[2][1]],[f[3][0],f[3][1]]],c(s)):d(t,f,u,p)}(t,i,s,p)}}var p=i(94098),f=i(16019);let g=f.ay.Inter;function m(e,t,i){let{titleWidth:s,text:o,lineHeight:a,font:n,padding:l,offset:c,radius:d,titleBound:h}=function(e,t){let i=e.title.toJSON(),s=(0,r.Dy)({fontSize:16/t,fontFamily:g,fontWeight:f.IT.Regular,fontStyle:"normal"}),o=(0,r.Lu)(i,s),a=(0,r.ks)(g,16/t,"normal"),n=e.elementBound,l=[Math.min(10/t,10),Math.min(4/t,4)],c=Math.max(4/t,2),d=Math.min(4,a/2),h=o+2*l[0],u=a+2*l[1]+c;return h>n.w&&(i=(i=(0,r.zA)(i,s,n.w-10)).slice(0,i.length-1)+"..",h=n.w),{radius:d,font:s,bound:n,text:i,titleWidth:h,titleHeight:u,lineHeight:a,padding:l,offset:c,titleBound:new p.z(n.x,n.y-u,h,u)}}(e,i.viewport.zoom);e.showTitle&&(e.externalXYWH=h.serialize(),t.translate(0,-c),t.beginPath(),t.roundRect(0,-a-2*l[1],s,a+2*l[1],d),t.fillStyle="#E3E2E4",t.fill(),t.font=n,t.fillStyle="#424149",t.textAlign="left",t.textBaseline="middle",t.fillText(o,l[0],-a/2-l[1]))}var v=i(39099),y=i(49210);let b={diamond:function(e,t,i,s,o,r){let{seed:a,strokeWidth:n,filled:l,strokeStyle:c,roughness:d,rotate:h,shapeStyle:u}=e,[,,p,f]=e.deserializedXYWH,g=Math.max(n,0)/2,m=p-2*g,v=f-2*g,b=m/2,w=v/2,{fillColor:x,strokeColor:_}=r;t.setTransform(i.translateSelf(g,g).translateSelf(b,w).rotateSelf(h).translateSelf(-b,-w)),"General"===u?(0,y.S7)(t,e,s,l,x,_):o.polygon([[m/2,0],[m,v/2],[m/2,v],[0,v/2]],{seed:a,roughness:"Scribbled"===u?d:0,strokeLineDash:"dash"===c?[12,12]:void 0,stroke:"none"===c?"none":_,strokeWidth:n,fill:l?x:void 0})},rect:function(e,t,i,s,o,r){let{filled:a,radius:n,rotate:l,roughness:c,seed:d,shapeStyle:h,strokeStyle:u,strokeWidth:p}=e,[,,f,g]=e.deserializedXYWH,m=Math.max(p,0)/2,v=f-2*m,b=g-2*m,w=n<1?Math.min(v*n,b*n):n,x=v/2,_=b/2,{fillColor:C,strokeColor:k}=r;t.setTransform(i.translateSelf(m,m).translateSelf(x,_).rotateSelf(l).translateSelf(-x,-_)),"General"===h?(0,y.S7)(t,e,s,a,C,k):o.path(` M ${w} 0 L ${v-w} 0 C ${v-.4477152502*w} 0 ${v} ${.4477152502*w} ${v} ${w} L ${v} ${b-w} C ${v} ${b-.4477152502*w} ${v-.4477152502*w} ${b} ${v-w} ${b} L ${w} ${b} C ${.4477152502*w} ${b} 0 ${b-.4477152502*w} 0 ${b-w} L 0 ${w} C 0 ${.4477152502*w} ${.4477152502*w} 0 ${w} 0 Z `,{seed:d,roughness:c,strokeLineDash:"dash"===u?[12,12]:void 0,stroke:"none"===u?"none":k,strokeWidth:p,fill:a?C:void 0}),t.setTransform(t.getTransform().translateSelf(x,_).rotateSelf(-l).translateSelf(-x,-_).translateSelf(-m,-m).translateSelf(x,_).rotateSelf(l).translateSelf(-x,-_))},triangle:function(e,t,i,s,o,r){let{seed:a,strokeWidth:n,filled:l,strokeStyle:c,roughness:d,rotate:h,shapeStyle:u}=e,[,,p,f]=e.deserializedXYWH,g=Math.max(n,0)/2,m=p-2*g,v=f-2*g,b=m/2,w=v/2,{fillColor:x,strokeColor:_}=r;t.setTransform(i.translateSelf(g,g).translateSelf(b,w).rotateSelf(h).translateSelf(-b,-w)),"General"===u?(0,y.S7)(t,e,s,l,x,_):o.polygon([[m/2,0],[m,v],[0,v]],{seed:a,roughness:"Scribbled"===u?d:0,strokeLineDash:"dash"===c?[12,12]:void 0,stroke:"none"===c?"none":_,strokeWidth:n,fill:l?x:void 0})},ellipse:function(e,t,i,s,o,r){let{seed:a,strokeWidth:n,filled:l,strokeStyle:c,roughness:d,rotate:h,shapeStyle:u}=e,[,,p,f]=e.deserializedXYWH,g=Math.max(n,0)/2,m=Math.max(1,p-2*g),v=Math.max(1,f-2*g),b=m/2,w=v/2,{fillColor:x,strokeColor:_}=r;t.setTransform(i.translateSelf(g,g).translateSelf(b,w).rotateSelf(h).translateSelf(-b,-w)),"General"===u?(0,y.S7)(t,e,s,l,x,_):o.ellipse(b,w,m,v,{seed:a,roughness:"Scribbled"===u?d:0,strokeLineDash:"dash"===c?[12,12]:void 0,stroke:"none"===c?"none":_,strokeWidth:n,fill:l?x:void 0,curveFitting:1})}},w={brush:function(e,t,i,s){let{rotate:o}=e,[,,r,a]=e.deserializedXYWH,n=r/2,l=a/2;t.setTransform(i.translateSelf(n,l).rotateSelf(o).translateSelf(-n,-l));let c=s.getColorValue(e.color,"#000000",!0);t.fillStyle=c,t.fill(new Path2D(e.commands))},connector:h,group:function(e,t,i,s){let{xywh:o}=e,r=s.provider.selectedElements?.()||[];if(t.setTransform(i),r.includes(e.id))m(e,t,s);else if(e.childElements.some(e=>r.includes(e.id))){let i=p.z.deserialize(o);t.setLineDash([2,2]),t.strokeStyle=s.getPropertyValue("--affine-blue"),t.lineWidth=1,t.strokeRect(0,0,i.w,i.h),m(e,t,s)}},shape:function(e,t,i,s,o){let a={color:s.getColorValue(e.color,v.qV,!0),fillColor:s.getColorValue(e.fillColor,v.SO,!0),strokeColor:s.getColorValue(e.strokeColor,v.vt,!0)};b[e.shapeType](e,t,i,s,o,a),e.textDisplay&&function(e,t,{color:i}){let{x:s,y:o,text:a,fontSize:n,fontFamily:l,fontWeight:c,textAlign:d,w:h,h:u,textVerticalAlign:g,padding:m}=e;if(!a)return;let[v,b]=m,w=(0,r.Dy)(e),{lineGap:x,lineHeight:_}=(0,r.L7)(l,n,c),C=(0,r.zS)(l,n,c),k=(0,r.s4)((0,r.ZW)(a,w,h-2*b)),S=(0,y.gc)(e.w,e.textAlign,b),M=(0,y.kf)(k,_+x,u,g,v)+C.fontBoundingBoxAscent+x/2,E=0;for(let[e,s]of(t.font=w,t.fillStyle=i,t.textAlign=d,t.textBaseline="alphabetic",k.entries()))for(let i of s){let s=i.insert,o=(0,r.V8)(s),a=o&&!t.canvas.isConnected;a&&document.body.append(t.canvas),t.canvas.dir!==(o?"rtl":"ltr")&&t.canvas.setAttribute("dir",o?"rtl":"ltr"),t.fillText(s,S+.5,e*_+M),E=Math.max(E,(0,r.Lu)(s,w)),a&&t.canvas.remove()}let I=e.textAlign===f.nO.Center?(h-E)/2:e.textAlign===f.nO.Left?S:S-E,B=M-_+v/2,$=new p.z(s+I,o+B,E,_*k.length);$.rotate=e.rotate??0,e.textBound=$}(e,t,a)},text:function(e,t,i,s){let{fontSize:o,fontWeight:a,fontStyle:n,fontFamily:l,textAlign:c,rotate:d}=e,[,,h,u]=e.deserializedXYWH,p=h/2,f=u/2;t.setTransform(i.translateSelf(p,f).rotateSelf(d).translateSelf(-p,-f));let g=(0,r.Dy)({fontStyle:n,fontWeight:a,fontSize:o,fontFamily:l}),m=(0,r.ZW)(e.text,g,h),v=(0,r.s4)(m),y=(0,r.ks)(l,o,a),b="center"===c?h/2:"right"===c?h:0,w=s.getColorValue(e.color,"#000000",!0);for(let[e,i]of(t.font=g,t.fillStyle=w,t.textAlign=c,t.textBaseline="ideographic",v.entries())){let s=0;for(let o of i){let i=o.insert,a=(0,r.V8)(i),n=a&&!t.canvas.isConnected;n&&document.body.append(t.canvas),t.canvas.setAttribute("dir",a?"rtl":"ltr");let l="center"===c?0:"right"===c?-.5:.5;t.fillText(i,b+s+l,(e+1)*y),s+=(0,r.q_)(i,g),n&&t.canvas.remove()}}},mindmap:function(e,t,i,s,o,r){let a=e.x-r.x,n=e.y-r.y;i=i.translate(-a,-n),e.traverse((a,n)=>{if(n){let l=e.getConnector(n,a);if(l){let e=l.x-r.x,a=l.y-r.y,n=t.globalAlpha,c=n!==l.opacity;c&&(t.globalAlpha=l.opacity),h(l,t,i.translate(e,a),s,o),c&&(t.globalAlpha=n)}}}),e.extraConnectors.forEach(e=>{let a=e.x-r.x,n=e.y-r.y;h(e,t,i.translate(a,n),s,o)})}}},49210:(e,t,i)=>{i.d(t,{S7:()=>o,dN:()=>n,gc:()=>r,hw:()=>l,kf:()=>a});var s=i(48520);function o(e,t,i,s,o,r){let a=Math.max(t.strokeWidth,0),n=Math.max(t.w-a,0),l=Math.max(t.h-a,0);switch(t.shapeType){case"rect":!function(e,t,i,s,o,r){let a=r<1?Math.max(Math.min(s*r,o*r),0):r;e.beginPath(),e.moveTo(0+a,0),e.lineTo(0+s-a,0),e.arcTo(t+s,i,t+s,i+a,a),e.lineTo(t+s,i+o-a),e.arcTo(t+s,i+o,t+s-a,i+o,a),e.lineTo(t+a,i+o),e.arcTo(t,i+o,t,i+o-a,a),e.lineTo(t,i+a),e.arcTo(t,i,t+a,i,a),e.closePath()}(e,0,0,n,l,t.radius??0);break;case"diamond":e.beginPath(),e.moveTo(n/2,0),e.lineTo(n,l/2),e.lineTo(n/2,l),e.lineTo(0,l/2),e.closePath();break;case"ellipse":e.beginPath(),e.ellipse(n/2,l/2,n/2,l/2,0,0,2*Math.PI),e.closePath();break;case"triangle":e.beginPath(),e.moveTo(n/2,0),e.lineTo(n,l),e.lineTo(0,l),e.closePath()}switch(e.lineWidth=t.strokeWidth,e.strokeStyle=r,e.fillStyle=s?o:"transparent",t.strokeStyle){case"none":e.strokeStyle="transparent";break;case"dash":e.setLineDash([12,12])}if(t.shadow){let{blur:s,offsetX:o,offsetY:r,color:a}=t.shadow,n=e.getTransform().a;e.shadowBlur=s*n,e.shadowOffsetX=o*n,e.shadowOffsetY=r*n,e.shadowColor=i.getPropertyValue(a)}e.stroke(),e.fill(),t.shadow&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.fill(),e.stroke()}function r(e,t,i){return"center"===t?e/2:"right"===t?e-i:i}function a(e,t,i,s,o){return"center"===s?Math.max((i-t*e.length)/2,o):"top"===s?o:i-t*e.length-o}function n(e,t){if(!e.text)return t;let[i,o]=e.padding,r=e.text,{fontFamily:a,fontSize:n,fontStyle:l,fontWeight:c}=e,d=(0,s.ks)(a,n,c),h=(0,s.Dy)({fontStyle:l,fontWeight:c,fontSize:n,fontFamily:a}),u=[...r.toString()].map(e=>(0,s.q_)(e,h)).sort((e,t)=>e-t).pop()??(0,s.q_)("W",h);t.w({insert:(0,s.C1)(e.insert,h,t.w-2*o),attributes:e.attributes})),f=(0,s.s4)(p);return t.h{for(let i of e){let e=i.insert;l=Math.max(l,(0,s.Lu)(e,t)),c+=a+n}}),c=Math.max(a+n,c),l+=2*o,c+=2*i;let d=`[${e.x},${e.y},${l},${c}]`;e.xywh!==d&&(e.xywh=d)}},48520:(e,t,i)=>{i.d(t,{C1:()=>w,Dy:()=>l,I:()=>k,JO:()=>C,L7:()=>n,Lu:()=>m,V8:()=>g,ZW:()=>y,ks:()=>c,q_:()=>v,r$:()=>S,s4:()=>p,tI:()=>_,zA:()=>x,zS:()=>h});var s=i(21320),o=i(11559);let r=function(){let e=null,t=null;return()=>(t||(e=(t=document.createElement("canvas")).getContext("2d")),e)}(),a=new Map;function n(e,t,i){let o=`${(0,s.s9)(e)}-${i}`;if(a.has(o)){let{fontSize:e,lineGap:i,lineHeight:s}=a.get(o);return{lineHeight:t/e*s,lineGap:t/e*i}}let r=document.createElement("div"),n=document.createElement("span");r.append(n),n.innerText="x",r.style.position="absolute",r.style.top="0px",r.style.left="0px",r.style.visibility="hidden",r.style.fontFamily=(0,s.s9)(e),r.style.fontWeight=i,r.style.fontSize=`${t}px`,r.style.pointerEvents="none",document.body.append(r);let l=n.getBoundingClientRect().height,c={lineHeight:l,lineGap:r.getBoundingClientRect().height-l};return r.remove(),a.set(o,{...c,fontSize:t}),c}function l({fontStyle:e,fontWeight:t,fontSize:i,fontFamily:o}){let r=c(o,i,t);return`${e} ${t} ${i}px/${r}px ${(0,s.s9)(o)}, sans-serif`.trim()}function c(e,t,i){let{lineHeight:s}=n(e,t,i);return s}let d=new Map;function h(e,t,i){let o=r(),a=`${(0,s.s9)(e)}-${i}`;if(d.has(a)){let{fontSize:e,metrics:i}=d.get(a);return Object.keys(Object.getPrototypeOf(i)).reduce((s,o)=>(s[o]=i[o]*(t/e),s),{})}let n=`${i} ${t}px ${(0,s.s9)(e)}`;o.font=n;let l=o.measureText("x");return o.font===n&&d.set(a,{fontSize:t,metrics:l}),l}function u(e){let t=[],i=e.insert;for(;i.length>0;){let s=i.indexOf("\n");if(-1===s){t.push({insert:i,attributes:e.attributes});break}i.slice(0,s).length>0&&t.push({insert:i.slice(0,s),attributes:e.attributes}),t.push("\n"),i=i.slice(s+1)}return t}function p(e){return 0===e.length?[[]]:Array.from(function*(e){let t=0;for(let i=0;i{s=Math.max(s,m(e,t))}),s}function y(e,t,i){return e.toDelta().flatMap(e=>({insert:w(e.insert,t,i),attributes:e.attributes}))}let b=(()=>{let e={};return{calculate:(t,i)=>{let s=t.charCodeAt(0);if(e[i]||(e[i]=[]),!e[i][s]){let o=m(t,i);e[i][s]=o}return e[i][s]},getCache:t=>e[t]}})();function w(e,t,i){if(!Number.isFinite(i)||i<0)return e;let s=[],o=e.split("\n"),r=m(" ",t),a="",n=0,l=e=>{e.trim()&&s.push(e)},c=()=>{a="",n=0};return o.forEach(e=>{if(v(e,t)<=i){s.push(e);return}let o=function(e){let t=e.split("-");return t.length>1&&t.forEach((e,i)=>{i!==t.length-1&&(t[i]=e+="-")}),t.join(" ").split(" ")}(e);c();let d=0;for(;di){for(l(a),c();o[d].length>0;){let e=String.fromCodePoint(o[d].codePointAt(0)),s=b.calculate(e,t);n+=s,o[d]=o[d].slice(e.length),n>=i?(l(a),a=e,n=s):a+=e}n+r>=i?(l(a),c()):a.endsWith("-")||(a+=" ",n+=r),d++}else for(;ni){l(a),c();break}d++;let h=!e.endsWith("-");if(a+=e,h&&(a+=" "),n+r>=i){h?s.push(a.slice(0,-1)):s.push(a),c();break}}}" "===a.slice(-1)&&l(a=a.slice(0,-1))}),s.join("\n")}let x=(e,t,i)=>{let s=0,o=0;for(;oi)break}return e.slice(0,o)};function _(e,t){let[i,s]=function(e,t){let i=(0,o.Bn)(e)[0],s=(0,o.Hb)([[t.x,t.y]],i,-e.rotate)[0];return[Math.floor((s[1]-i[1])/c(e.fontFamily,e.fontSize,e.fontWeight)),s[0]-i[0]]}(e,t),r=l(e),a=p(y(e.text,r,e.w)).map(e=>e.map(e=>e.insert).join("")),n=a[i],d=a.slice(0,i).join("").length-1,h=0,u=0;for(;hv(e,u)).sort((e,t)=>e-t).pop()??v("W",u);n.w({insert:w(e.insert,u,b),attributes:e.attributes}))),!d){f=p(g);let e=Math.max(...m.split("\n").map(e=>v(e,u)));n.w=e,r&&a&&a>0&&(n.w=Math.min(n.w,a))}return n.h=h*f.length,n}function k(e,t){return!!(0,s.e4)(e).find(e=>e.weight===t)}function S(e,t){return!!(0,s.e4)(e).find(e=>e.style===t)}},64369:(e,t,i)=>{i.d(t,{A:()=>u,h:()=>h});var s=i(69050),o=i(50620),r=i(66050),a=i(8834),n=i(62602),l=i(11623),c=i(11559),d=i(70174);class h{constructor(){this._renderer=null}setRenderer(e){this._renderer=e}}class u{constructor(e){this._disposables=new s.K,this._overlays=new Set,this._shouldUpdate=!1,this._stackingCanvas=[],this.stackingCanvasUpdated=new o.D;let t=document.createElement("canvas");this.canvas=t,this.ctx=this.canvas.getContext("2d"),this.viewport=e.viewport,this.layerManager=e.layerManager,this.provider=e.provider??{},this._initViewport(),e.enableStackingCanvas=e.enableStackingCanvas??!1,e.enableStackingCanvas&&this._initStackingCanvas(e.onStackingCanvasCreated)}_canvasSizeUpdater(e=window.devicePixelRatio){let{width:t,height:i}=this.viewport,s=Math.ceil(t*e),o=Math.ceil(i*e);return{filter:({width:e,height:t})=>e!==s||t!==o,update(e){e.style.width=`${t}px`,e.style.height=`${i}px`,e.width=s,e.height=o}}}_initStackingCanvas(e){let t=this.layerManager,i=e=>{this._stackingCanvas=e;let t=this._canvasSizeUpdater();e.filter(t.filter).forEach(t.update)},s=()=>{let s=t.getCanvasLayers().slice(0,-1),o=[],r=this._stackingCanvas,a=(0,n.HV)(this.layerManager.layers),l=a?a.zIndex+a.elements.length+1:1;this.canvas.style.zIndex=l.toString();for(let t=0;t0?t.added=o.slice(-e):t.removed=r.slice(e),this.stackingCanvasUpdated.emit(t)}this.refresh()};this._disposables.add(this.layerManager.slots.layerUpdated.on(()=>{s()})),s()}_initViewport(){let e=null;this._disposables.add(this.viewport.viewportUpdated.on(()=>{this._shouldUpdate=!0})),this._disposables.add(this.viewport.sizeUpdated.on(()=>{e||(e=(0,a.Ak)(()=>{e=null,this._resetSize(),this._render(),this._shouldUpdate=!1},this._container))}))}_loop(){(0,a.Ak)(()=>{this._shouldUpdate&&(this._shouldUpdate=!1,this._render()),this._loop()},this._container)}_render(){let{viewportBounds:e,zoom:t,cumulativeParentScale:i}=this.viewport,{ctx:s}=this,o=window.devicePixelRatio,r=new DOMMatrix().scaleSelf(t*o).scaleSelf(i),a=[];this.layerManager.getCanvasLayers().forEach((t,i)=>{if(!this._stackingCanvas[i]){a=a.concat(t.elements);return}let s=this._stackingCanvas[i],o=s.getContext("2d"),n=new l.Q(o.canvas);o.clearRect(0,0,s.width,s.height),o.save(),o.setTransform(r),this._renderByBound(o,r,n,e,t.elements)}),s.clearRect(0,0,this.canvas.width,this.canvas.height),s.save(),s.setTransform(r),this._renderByBound(s,r,new l.Q(s.canvas),e,a,!0)}_renderByBound(e,t,i,s,o,r=!1){if(e){for(let r of o??this.layerManager.canvasGrid.search(s)){if(e.save(),(r.display??!0)&&(0,c.HY)((0,c.e0)(r),s)){let o=d.H[r.type];if(!o){console.warn(`Cannot find renderer for ${r.type}`),e.restore();continue}e.globalAlpha=r.opacity??1;let a=r.x-s.x,n=r.y-s.y;o(r,e,t.translate(a,n),this,i,s)}e.restore()}if(r)for(let t of this._overlays)e.save(),e.translate(-s.x,-s.y),t.render(e,i),e.restore();e.restore()}}_resetSize(){let e=this._canvasSizeUpdater();e.update(this.canvas),this._stackingCanvas.forEach(e.update),this._shouldUpdate=!0}addOverlay(e){e.setRenderer(this),this._overlays.add(e),this._shouldUpdate=!0}attach(e){this._container=e,e.append(this.canvas),this._resetSize(),this._loop()}dispose(){this._disposables.dispose()}generateColorProperty(e,t){return this.provider.generateColorProperty?.(e,t)??(t.startsWith("--")?`var(${t})`:t)}getCanvasByBound(e=this.viewport.viewportBounds,t,i,s,o){i=i||document.createElement("canvas");let r=window.devicePixelRatio||1;i.width!==e.w*r&&(i.width=e.w*r),i.height!==e.h*r&&(i.height=e.h*r),i.style.width=`${e.w}px`,i.style.height=`${e.h}px`;let a=i.getContext("2d"),n=new DOMMatrix().scaleSelf(o?r*this.viewport.zoom:r),c=new l.Q(i);return s&&a.clearRect(0,0,i.width,i.height),a.setTransform(n),this._renderByBound(a,n,c,e,t),i}getColorScheme(){return this.provider.getColorScheme?.()??r.z.Light}getColorValue(e,t,i){return this.provider.getColorValue?.(e,t,i)??"transparent"}getPropertyValue(e){return this.provider.getPropertyValue?.(e)??""}refresh(){this._shouldUpdate=!0}removeOverlay(e){this._overlays.has(e)&&(e.setRenderer(null),this._overlays.delete(e),this._shouldUpdate=!0)}get stackingCanvas(){return this._stackingCanvas}}},16019:(e,t,i)=>{var s,o,r,a,n,l,c,d;i.d(t,{$F:()=>w,IT:()=>l,P1:()=>p,TA:()=>f,VF:()=>u,_9:()=>v,ay:()=>d,bn:()=>n,cT:()=>m,f1:()=>a,fv:()=>h,i:()=>y,js:()=>g,lH:()=>s,nO:()=>r,rj:()=>b,u1:()=>o,zz:()=>c});let h=.1,u=3e3,p=10,f=50,g=1.4,m=.3;!function(e){e.General="General",e.Scribbled="Scribbled"}(s||(s={})),function(e){e.Dash="dash",e.None="none",e.Solid="solid"}(o||(o={})),function(e){e.Center="center",e.Left="left",e.Right="right"}(r||(r={})),function(e){e.Bottom="bottom",e.Center="center",e.Top="top"}(a||(a={})),function(e){e[e.AUTO_WIDTH=0]="AUTO_WIDTH",e[e.AUTO_HEIGHT=1]="AUTO_HEIGHT"}(n||(n={})),function(e){e.Bold="700",e.Light="300",e.Medium="500",e.Regular="400",e.SemiBold="600"}(l||(l={})),function(e){e.Italic="italic",e.Normal="normal"}(c||(c={})),function(e){e.BebasNeue="blocksuite:surface:BebasNeue",e.Inter="blocksuite:surface:Inter",e.Kalam="blocksuite:surface:Kalam",e.Lora="blocksuite:surface:Lora",e.OrelegaOne="blocksuite:surface:OrelegaOne",e.Poppins="blocksuite:surface:Poppins",e.Satoshi="blocksuite:surface:Satoshi"}(d||(d={}));let v={[d.Inter]:"Inter",[d.Kalam]:"Kalam",[d.Satoshi]:"Satoshi",[d.Poppins]:"Poppins",[d.Lora]:"Lora",[d.BebasNeue]:"Bebas Neue",[d.OrelegaOne]:"Orelega One"},y=Object.entries(v),b=[{font:d.Inter,url:"https://cdn.affine.pro/fonts/Inter-Light-BETA.woff",weight:l.Light,style:c.Normal},{font:d.Inter,url:"https://cdn.affine.pro/fonts/Inter-Regular.woff",weight:l.Regular,style:c.Normal},{font:d.Inter,url:"https://cdn.affine.pro/fonts/Inter-SemiBold.woff",weight:l.SemiBold,style:c.Normal},{font:d.Inter,url:"https://cdn.affine.pro/fonts/Inter-LightItalic-BETA.woff",weight:l.Light,style:c.Italic},{font:d.Inter,url:"https://cdn.affine.pro/fonts/Inter-Italic.woff",weight:l.Regular,style:c.Italic},{font:d.Inter,url:"https://cdn.affine.pro/fonts/Inter-SemiBoldItalic.woff",weight:l.SemiBold,style:c.Italic},{font:d.Kalam,url:"https://cdn.affine.pro/fonts/Kalam-Light.woff",weight:l.Light,style:c.Normal},{font:d.Kalam,url:"https://cdn.affine.pro/fonts/Kalam-Regular.woff",weight:l.Regular,style:c.Normal},{font:d.Kalam,url:"https://cdn.affine.pro/fonts/Kalam-Bold.woff",weight:l.SemiBold,style:c.Normal},{font:d.Satoshi,url:"https://cdn.affine.pro/fonts/Satoshi-Light.woff",weight:l.Light,style:c.Normal},{font:d.Satoshi,url:"https://cdn.affine.pro/fonts/Satoshi-Regular.woff",weight:l.Regular,style:c.Normal},{font:d.Satoshi,url:"https://cdn.affine.pro/fonts/Satoshi-Bold.woff",weight:l.SemiBold,style:c.Normal},{font:d.Satoshi,url:"https://cdn.affine.pro/fonts/Satoshi-LightItalic.woff",weight:l.Light,style:c.Italic},{font:d.Satoshi,url:"https://cdn.affine.pro/fonts/Satoshi-Italic.woff",weight:l.Regular,style:c.Italic},{font:d.Satoshi,url:"https://cdn.affine.pro/fonts/Satoshi-BoldItalic.woff",weight:l.SemiBold,style:c.Italic},{font:d.Poppins,url:"https://cdn.affine.pro/fonts/Poppins-Light.woff",weight:l.Light,style:c.Normal},{font:d.Poppins,url:"https://cdn.affine.pro/fonts/Poppins-Regular.woff",weight:l.Regular,style:c.Normal},{font:d.Poppins,url:"https://cdn.affine.pro/fonts/Poppins-Medium.woff",weight:l.Medium,style:c.Normal},{font:d.Poppins,url:"https://cdn.affine.pro/fonts/Poppins-SemiBold.woff",weight:l.SemiBold,style:c.Normal},{font:d.Poppins,url:"https://cdn.affine.pro/fonts/Poppins-LightItalic.woff",weight:l.Light,style:c.Italic},{font:d.Poppins,url:"https://cdn.affine.pro/fonts/Poppins-Italic.woff",weight:l.Regular,style:c.Italic},{font:d.Poppins,url:"https://cdn.affine.pro/fonts/Poppins-SemiBoldItalic.woff",weight:l.SemiBold,style:c.Italic},{font:d.Lora,url:"https://cdn.affine.pro/fonts/Lora-Regular.woff",weight:l.Regular,style:c.Normal},{font:d.Lora,url:"https://cdn.affine.pro/fonts/Lora-Bold.woff",weight:l.SemiBold,style:c.Normal},{font:d.Lora,url:"https://cdn.affine.pro/fonts/Lora-Italic.woff",weight:l.Regular,style:c.Italic},{font:d.Lora,url:"https://cdn.affine.pro/fonts/Lora-BoldItalic.woff",weight:l.SemiBold,style:c.Italic},{font:d.BebasNeue,url:"https://cdn.affine.pro/fonts/BebasNeue-Light.woff",weight:l.Light,style:c.Normal},{font:d.BebasNeue,url:"https://cdn.affine.pro/fonts/BebasNeue-Regular.woff",weight:l.Regular,style:c.Normal},{font:d.OrelegaOne,url:"https://cdn.affine.pro/fonts/OrelegaOne-Regular.woff",weight:l.Regular,style:c.Normal}],w=[{font:d.Inter,url:"https://fonts.cdnfonts.com/s/19795/Inter-Light-BETA.woff",weight:l.Light,style:c.Normal},{font:d.Inter,url:"https://fonts.cdnfonts.com/s/19795/Inter-Regular.woff",weight:l.Regular,style:c.Normal},{font:d.Inter,url:"https://fonts.cdnfonts.com/s/19795/Inter-SemiBold.woff",weight:l.SemiBold,style:c.Normal},{font:d.Inter,url:"https://fonts.cdnfonts.com/s/19795/Inter-LightItalic-BETA.woff",weight:l.Light,style:c.Italic},{font:d.Inter,url:"https://fonts.cdnfonts.com/s/19795/Inter-Italic.woff",weight:l.Regular,style:c.Italic},{font:d.Inter,url:"https://fonts.cdnfonts.com/s/19795/Inter-SemiBoldItalic.woff",weight:l.SemiBold,style:c.Italic},{font:d.Kalam,url:"https://fonts.cdnfonts.com/s/13130/Kalam-Light.woff",weight:l.Light,style:c.Normal},{font:d.Kalam,url:"https://fonts.cdnfonts.com/s/13130/Kalam-Regular.woff",weight:l.Regular,style:c.Normal},{font:d.Kalam,url:"https://fonts.cdnfonts.com/s/13130/Kalam-Bold.woff",weight:l.SemiBold,style:c.Normal},{font:d.Satoshi,url:"https://fonts.cdnfonts.com/s/85546/Satoshi-Light.woff",weight:l.Light,style:c.Normal},{font:d.Satoshi,url:"https://fonts.cdnfonts.com/s/85546/Satoshi-Regular.woff",weight:l.Regular,style:c.Normal},{font:d.Satoshi,url:"https://fonts.cdnfonts.com/s/85546/Satoshi-Bold.woff",weight:l.SemiBold,style:c.Normal},{font:d.Satoshi,url:"https://fonts.cdnfonts.com/s/85546/Satoshi-LightItalic.woff",weight:l.Light,style:c.Italic},{font:d.Satoshi,url:"https://fonts.cdnfonts.com/s/85546/Satoshi-Italic.woff",weight:l.Regular,style:c.Italic},{font:d.Satoshi,url:"https://fonts.cdnfonts.com/s/85546/Satoshi-BoldItalic.woff",weight:l.SemiBold,style:c.Italic},{font:d.Poppins,url:"https://fonts.cdnfonts.com/s/16009/Poppins-Light.woff",weight:l.Light,style:c.Normal},{font:d.Poppins,url:"https://fonts.cdnfonts.com/s/16009/Poppins-Regular.woff",weight:l.Regular,style:c.Normal},{font:d.Poppins,url:"https://fonts.cdnfonts.com/s/16009/Poppins-Medium.woff",weight:l.Medium,style:c.Normal},{font:d.Poppins,url:"https://fonts.cdnfonts.com/s/16009/Poppins-SemiBold.woff",weight:l.SemiBold,style:c.Normal},{font:d.Poppins,url:"https://fonts.cdnfonts.com/s/16009/Poppins-LightItalic.woff",weight:l.Light,style:c.Italic},{font:d.Poppins,url:"https://fonts.cdnfonts.com/s/16009/Poppins-Italic.woff",weight:l.Regular,style:c.Italic},{font:d.Poppins,url:"https://fonts.cdnfonts.com/s/16009/Poppins-SemiBoldItalic.woff",weight:l.SemiBold,style:c.Italic},{font:d.Lora,url:"https://fonts.cdnfonts.com/s/29883/Lora-Regular.woff",weight:l.Regular,style:c.Normal},{font:d.Lora,url:"https://fonts.cdnfonts.com/s/29883/Lora-Bold.woff",weight:l.SemiBold,style:c.Normal},{font:d.Lora,url:"https://fonts.cdnfonts.com/s/29883/Lora-Italic.woff",weight:l.Regular,style:c.Italic},{font:d.Lora,url:"https://fonts.cdnfonts.com/s/29883/Lora-BoldItalic.woff",weight:l.SemiBold,style:c.Italic},{font:d.BebasNeue,url:"https://fonts.cdnfonts.com/s/14902/BebasNeue%20Light.woff",weight:l.Light,style:c.Normal},{font:d.BebasNeue,url:"https://fonts.cdnfonts.com/s/14902/BebasNeue-Regular.woff",weight:l.Regular,style:c.Normal},{font:d.OrelegaOne,url:"https://fonts.cdnfonts.com/s/93179/OrelegaOne-Regular.woff",weight:l.Regular,style:c.Normal}]},31999:(e,t,i)=>{i.d(t,{$b:()=>s.JU,nz:()=>s.iy});var s=i(1126)},24434:(e,t,i)=>{i.d(t,{C:()=>u});var s=i(1126),o=i(94098),r=i(31716),a=i(96458),n=i(4536),l=i(61677),c=i(11559),d=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},h=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,u,p,f=s.iy,g=[],m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[];return class extends f{static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;e=[(0,s.A1)()],t=[(0,s.wB)((e,t)=>{t._local.delete("commands")}),(0,s.CX)((e,t)=>{if(e===t.lineWidth)return{};let i=t.elementBound,s=t.points,o=(0,l.vs)(s.map(([e,t])=>({x:e,y:t})),i,e/2,(0,l.SG)(i,e-t.lineWidth),e/2);return{points:o.points.map((e,t)=>[e.x,e.y,...void 0!==s[t][2]?[s[t][2]]:[]]),xywh:o.bound.serialize()}}),(0,s.A1)()],i=[(0,s.wB)((e,t)=>{t._local.delete("commands")}),(0,s.CX)((e,t)=>{let i=t.lineWidth,s=(0,l.O3)(e);return{xywh:(0,l.SG)(s,i).serialize()}}),(0,s.C6)((e,t)=>{let i=t.lineWidth,s=(0,l.O3)(e),o=(0,l.SG)(s,i);return e.map(([e,t,i])=>[e-o.x,t-o.y,...void 0!==i?[i]:[]])}),(0,s.A1)()],u=[(0,s.A1)(0)],p=[(0,s.CX)((e,t)=>{let i=o.z.deserialize(e);if(i.w===t.w&&i.h===t.h)return{};let{lineWidth:s}=t;return{points:(0,l.vs)(t.points.map(([e,t])=>({x:e,y:t})),t,s/2,i,s/2).points.map((e,i)=>[e.x,e.y,...void 0!==t.points[i][2]?[t.points[i][2]]:[]])}}),(0,s.A1)()],d(this,null,e,{kind:"accessor",name:"color",static:!1,private:!1,access:{has:e=>"color"in e,get:e=>e.color,set:(e,t)=>{e.color=t}},metadata:r},g,m),d(this,null,t,{kind:"accessor",name:"lineWidth",static:!1,private:!1,access:{has:e=>"lineWidth"in e,get:e=>e.lineWidth,set:(e,t)=>{e.lineWidth=t}},metadata:r},v,y),d(this,null,i,{kind:"accessor",name:"points",static:!1,private:!1,access:{has:e=>"points"in e,get:e=>e.points,set:(e,t)=>{e.points=t}},metadata:r},b,w),d(this,null,u,{kind:"accessor",name:"rotate",static:!1,private:!1,access:{has:e=>"rotate"in e,get:e=>e.rotate,set:(e,t)=>{e.rotate=t}},metadata:r},x,_),d(this,null,p,{kind:"accessor",name:"xywh",static:!1,private:!1,access:{has:e=>"xywh"in e,get:e=>e.xywh,set:(e,t)=>{e.xywh=t}},metadata:r},C,k),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static propsToY(e){return e}containsBound(e){return(0,c.Bn)(this).some(t=>e.containsPoint(t))}getLineIntersections(e,t){let i=[this.x,this.y],s=(0,c.Bn)(this,e=>this.points.map(e=>r.l.add(e,i))),n=o.z.fromDOMRect((0,c.R$)(this));if(n.w<8&&n.h<8)return 5>r.l.distanceToLineSegment(e,t,n.center)?[]:null;if(n.intersectLine(e,t,!0)){let i=s.length;for(let o=1;or.l.add(e,[t,i])),e)}getRelativePointLocation(e){let t=o.z.deserialize(this.xywh).getRelativePoint(e);return new a.S(t)}includesPoint(e,t,i){return(0,c.pz)(o.z.deserialize(this.xywh),this.points,this.rotate,[e,t],(i?.expand??10)/Math.min(i?.zoom??1,1))}get commands(){if(!this._local.has("commands")){var e,t;let i=(e=this.points,t=this.lineWidth,(0,n.$)(e,{size:t,thinning:.6,streamline:.5,smoothing:.5,easing:e=>Math.sin(e*Math.PI/2),simulatePressure:e[0]?.length===2})),s=(0,c.op)(i);this._local.set("commands",s)}return this._local.get("commands")}get connectable(){return!1}get type(){return"brush"}#ig=h(this,g,"#000000");get color(){return this.#ig}set color(e){this.#ig=e}#nd=(h(this,m),h(this,v,4));get lineWidth(){return this.#nd}set lineWidth(e){this.#nd=e}#l8=(h(this,y),h(this,b,[]));get points(){return this.#l8}set points(e){this.#l8=e}#l9=(h(this,w),h(this,x,0));get rotate(){return this.#l9}set rotate(e){this.#l9=e}#ce=(h(this,_),h(this,C,"[0,0,0,0]"));get xywh(){return this.#ce}set xywh(e){this.#ce=e}constructor(){super(...arguments),h(this,k)}}})()},68192:(e,t,i)=>{i.d(t,{lw:()=>w,Re:()=>s,B1:()=>o,F7:()=>v,OM:()=>y,oG:()=>x,o:()=>b,yp:()=>_});var s,o,r,a=i(1126),n=i(31716),l=i(94098),c=i(96458),d=i(73711),h=i(16019),u=i(75510),p=i(11559);class f{static len(e){let t;let i=e.length;if(i<2)return 0;let s=0,o=0,r=e[0];for(;++s=1)return e[i-1];let s=f.len(e);return f.pointAtLen(e,s*t)}static pointAtLen(e,t){let i=e.length;if(0===i)return null;if(1===i)return e[0];let s=!0;t<0&&(s=!1,t=-t);let o=0;for(let r=0,a=i-1;r=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},m=function(e,t,i){for(var s=arguments.length>2,o=0;o({[o.Straight]:"Straight",[o.Orthogonal]:"Orthogonal",[o.Curve]:"Curve"})[e];!function(e){e.Bottom="bottom",e.Center="center",e.Top="top"}(r||(r={}));let w=(()=>{let e,t,i,s,v,y,b,w,x,_,C,k,S,M,E,I,B,$,T,O,P,H=a.iy,A=[],L=[],D=[],Z=[],j=[],V=[],z=[],R=[],F=[],N=[],q=[],U=[],W=[],G=[],Y=[],K=[],X=[],Q=[],J=[],ee=[],et=[],ei=[],es=[],eo=[],er=[],ea=[],en=[],el=[],ec=[],ed=[],eh=[],eu=[],ep=[],ef=[],eg=[],em=[],ev=[],ey=[],eb=[],ew=[],ex=[],e_=[];return class extends H{static{let o="function"==typeof Symbol&&Symbol.metadata?Object.create(H[Symbol.metadata]??null):void 0;e=[(0,a.sr)()],t=[(0,a.A1)("None")],i=[(0,a.A1)({hasMaxWidth:!0,maxWidth:280})],s=[(0,a.A1)(!0)],v=[(0,a.A1)({distance:.5,anchor:r.Center})],y=[(0,a.A1)({color:"#000000",fontFamily:h.ay.Inter,fontSize:16,fontStyle:h.zz.Normal,fontWeight:h.IT.Regular,textAlign:h.nO.Center})],b=[(0,a.A1)()],w=[(0,a.sr)()],x=[(0,a.A1)()],_=[(0,a.CX)((e,t)=>{let{x:i,y:s}=t;return{absolutePath:e.map(e=>e.clone().setVec(n.l.add(e,[i,s])))}}),(0,a.sr)()],C=[(0,a.A1)("Arrow")],k=[(0,a.sr)()],S=[(0,a.A1)()],M=[(0,a.A1)()],E=[(0,a.A1)()],I=[(0,a.A1)()],B=[(0,a.A1)()],$=[(0,a.A1)()],T=[(0,a.A1)()],O=[(0,a.A1)()],P=[(0,a.sr)()],g(this,null,e,{kind:"accessor",name:"absolutePath",static:!1,private:!1,access:{has:e=>"absolutePath"in e,get:e=>e.absolutePath,set:(e,t)=>{e.absolutePath=t}},metadata:o},A,L),g(this,null,t,{kind:"accessor",name:"frontEndpointStyle",static:!1,private:!1,access:{has:e=>"frontEndpointStyle"in e,get:e=>e.frontEndpointStyle,set:(e,t)=>{e.frontEndpointStyle=t}},metadata:o},D,Z),g(this,null,i,{kind:"accessor",name:"labelConstraints",static:!1,private:!1,access:{has:e=>"labelConstraints"in e,get:e=>e.labelConstraints,set:(e,t)=>{e.labelConstraints=t}},metadata:o},j,V),g(this,null,s,{kind:"accessor",name:"labelDisplay",static:!1,private:!1,access:{has:e=>"labelDisplay"in e,get:e=>e.labelDisplay,set:(e,t)=>{e.labelDisplay=t}},metadata:o},z,R),g(this,null,v,{kind:"accessor",name:"labelOffset",static:!1,private:!1,access:{has:e=>"labelOffset"in e,get:e=>e.labelOffset,set:(e,t)=>{e.labelOffset=t}},metadata:o},F,N),g(this,null,y,{kind:"accessor",name:"labelStyle",static:!1,private:!1,access:{has:e=>"labelStyle"in e,get:e=>e.labelStyle,set:(e,t)=>{e.labelStyle=t}},metadata:o},q,U),g(this,null,b,{kind:"accessor",name:"labelXYWH",static:!1,private:!1,access:{has:e=>"labelXYWH"in e,get:e=>e.labelXYWH,set:(e,t)=>{e.labelXYWH=t}},metadata:o},W,G),g(this,null,w,{kind:"accessor",name:"lableEditing",static:!1,private:!1,access:{has:e=>"lableEditing"in e,get:e=>e.lableEditing,set:(e,t)=>{e.lableEditing=t}},metadata:o},Y,K),g(this,null,x,{kind:"accessor",name:"mode",static:!1,private:!1,access:{has:e=>"mode"in e,get:e=>e.mode,set:(e,t)=>{e.mode=t}},metadata:o},X,Q),g(this,null,_,{kind:"accessor",name:"path",static:!1,private:!1,access:{has:e=>"path"in e,get:e=>e.path,set:(e,t)=>{e.path=t}},metadata:o},J,ee),g(this,null,C,{kind:"accessor",name:"rearEndpointStyle",static:!1,private:!1,access:{has:e=>"rearEndpointStyle"in e,get:e=>e.rearEndpointStyle,set:(e,t)=>{e.rearEndpointStyle=t}},metadata:o},et,ei),g(this,null,k,{kind:"accessor",name:"rotate",static:!1,private:!1,access:{has:e=>"rotate"in e,get:e=>e.rotate,set:(e,t)=>{e.rotate=t}},metadata:o},es,eo),g(this,null,S,{kind:"accessor",name:"rough",static:!1,private:!1,access:{has:e=>"rough"in e,get:e=>e.rough,set:(e,t)=>{e.rough=t}},metadata:o},er,ea),g(this,null,M,{kind:"accessor",name:"roughness",static:!1,private:!1,access:{has:e=>"roughness"in e,get:e=>e.roughness,set:(e,t)=>{e.roughness=t}},metadata:o},en,el),g(this,null,E,{kind:"accessor",name:"source",static:!1,private:!1,access:{has:e=>"source"in e,get:e=>e.source,set:(e,t)=>{e.source=t}},metadata:o},ec,ed),g(this,null,I,{kind:"accessor",name:"stroke",static:!1,private:!1,access:{has:e=>"stroke"in e,get:e=>e.stroke,set:(e,t)=>{e.stroke=t}},metadata:o},eh,eu),g(this,null,B,{kind:"accessor",name:"strokeStyle",static:!1,private:!1,access:{has:e=>"strokeStyle"in e,get:e=>e.strokeStyle,set:(e,t)=>{e.strokeStyle=t}},metadata:o},ep,ef),g(this,null,$,{kind:"accessor",name:"strokeWidth",static:!1,private:!1,access:{has:e=>"strokeWidth"in e,get:e=>e.strokeWidth,set:(e,t)=>{e.strokeWidth=t}},metadata:o},eg,em),g(this,null,T,{kind:"accessor",name:"target",static:!1,private:!1,access:{has:e=>"target"in e,get:e=>e.target,set:(e,t)=>{e.target=t}},metadata:o},ev,ey),g(this,null,O,{kind:"accessor",name:"text",static:!1,private:!1,access:{has:e=>"text"in e,get:e=>e.text,set:(e,t)=>{e.text=t}},metadata:o},eb,ew),g(this,null,P,{kind:"accessor",name:"xywh",static:!1,private:!1,access:{has:e=>"xywh"in e,get:e=>e.xywh,set:(e,t)=>{e.xywh=t}},metadata:o},ex,e_),o&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static propsToY(e){return!e.text||e.text instanceof d.rl.Y.Text||(e.text=new d.rl.Y.Text(e.text)),e}containsBound(e){return this.absolutePath.some(t=>e.containsPoint(t))||this.hasLabel()&&l.z.fromXYWH(this.labelXYWH).points.some(t=>e.containsPoint(t))}getLineIntersections(e,t){let{mode:i,absolutePath:s}=this,r=null;return!(r=i===o.Curve&&s.length>1?(0,u.HY)(s,[e,t]):(0,p.Rg)(e,t,s))&&this.hasLabel()&&(r=(0,p.Rg)(e,t,l.z.fromXYWH(this.labelXYWH).points)),r}getNearestPoint(e){let{mode:t,absolutePath:i}=this;if(t===o.Straight){let t=i[0],s=i[i.length-1];return n.l.nearestPointOnLineSegment(t,s,e,!0)}if(t===o.Orthogonal){let t=i.map(e=>[e[0],e[1]]);return f.nearestPoint(t,e)}let s=(0,u.UV)(i),r=(0,u.Vr)(s,e),a=(0,u.KV)(s,r);if(a)return a;let{x:l,y:c}=this;return[l,c]}getOffsetDistanceByPoint(e,t){let{mode:i,absolutePath:s}=this,{x:r,y:a,w:l,h:c}=this;if(t&&(r=t.x,a=t.y,l=t.w,c=t.h),e[0]=n.l.clamp(e[0],r,r+l),e[1]=n.l.clamp(e[1],a,a+c),i===o.Straight){let t=s[0],i=s[s.length-1];return n.l.dist(t,e)/n.l.dist(t,i)}if(i===o.Orthogonal){let t=s.map(e=>[e[0],e[1]]),i=f.nearestPoint(t,e);return f.lenAtPoint(t,i)/f.len(t)}let d=(0,u.UV)(s);return(0,u.Vr)(d,e)}getPointByOffsetDistance(e=.5,t){let{mode:i,absolutePath:s}=this;if(i===o.Straight){let t=s[0],i=s[s.length-1];return n.l.lrp(t,i,e)}let{x:r,y:a,w:l,h:c}=this;if(t&&(r=t.x,a=t.y,l=t.w,c=t.h),i===o.Orthogonal){let t=s.map(e=>[e[0],e[1]]);return f.pointAt(t,e)||[r+l/2,a+c/2]}let d=(0,u.UV)(s);return(0,u.KV)(d,e)||[r+l/2,a+c/2]}getRelativePointLocation(e){return new c.S(l.z.deserialize(this.xywh).getRelativePoint(e))}hasLabel(){return!!(!this.lableEditing&&this.labelDisplay&&this.labelXYWH)}includesPoint(e,t,i){let s=[e,t];if(this.labelIncludesPoint(s))return!0;let{mode:r,strokeWidth:a,absolutePath:l}=this,c=r===o.Curve?(0,u.ol)((0,u.UV)(l),s):(0,p.BE)(l,s);return n.l.dist(c,s)<(i?.expand?a/2:0)+8}labelIncludesPoint(e){return this.hasLabel()&&l.z.fromXYWH(this.labelXYWH).isPointInBound(e)}moveTo(e){let t=l.z.deserialize(this.xywh),i=n.l.sub([e.x,e.y],[t.x,t.y]),{source:s,target:o}=this;if(!s.id&&s.position&&(this.source={position:n.l.add(s.position,i)}),!o.id&&o.position&&(this.target={position:n.l.add(o.position,i)}),this.hasLabel()){let[e,t,s,o]=this.labelXYWH;this.labelXYWH=[e+i[0],t+i[1],s,o]}}resize(e,t,i){this.updatingPath=!1;let s=this.resizePath(t,i);this.xywh=e.serialize(),this.path=s.map(t=>t.clone().setVec(n.l.sub(t,e.tl)));let o={};if(this.hasLabel()){let[e,t]=this.getPointByOffsetDistance(this.labelOffset.distance),[,,i,s]=this.labelXYWH;o.labelXYWH=[e-i/2,t-s/2,i,s]}return this.source.id||(o.source={...this.source,position:s[0].toVec()}),this.target.id||(o.target={...this.target,position:s[s.length-1].toVec()}),o}resizePath(e,t){return this.mode===o.Curve?e.map(e=>{let[i,s,o,r]=[e,e.tangent,e.absIn,e.absOut].map(e=>new DOMPoint(...e).matrixTransform(t)).map(e=>[e.x,e.y]),a=n.l.sub(o,i),l=n.l.sub(r,i);return new c.S(i,s,a,l)}):e.map(e=>{let{x:i,y:s}=new DOMPoint(...e).matrixTransform(t);return c.S.fromVec([i,s])})}serialize(){let e=super.serialize();return e.xywh=this.xywh,e}get connectable(){return!1}get connected(){return!!(this.source.id||this.target.id)}get elementBound(){let e=super.elementBound;return this.hasLabel()&&(e=e.unite(l.z.fromXYWH(this.labelXYWH))),e}get type(){return"connector"}#ct;get absolutePath(){return this.#ct}set absolutePath(e){this.#ct=e}#ci;get frontEndpointStyle(){return this.#ci}set frontEndpointStyle(e){this.#ci=e}#cs;get labelConstraints(){return this.#cs}set labelConstraints(e){this.#cs=e}#co;get labelDisplay(){return this.#co}set labelDisplay(e){this.#co=e}#cr;get labelOffset(){return this.#cr}set labelOffset(e){this.#cr=e}#ca;get labelStyle(){return this.#ca}set labelStyle(e){this.#ca=e}#cn;get labelXYWH(){return this.#cn}set labelXYWH(e){this.#cn=e}#cl;get lableEditing(){return this.#cl}set lableEditing(e){this.#cl=e}#is;get mode(){return this.#is}set mode(e){this.#is=e}#cc;get path(){return this.#cc}set path(e){this.#cc=e}#cd;get rearEndpointStyle(){return this.#cd}set rearEndpointStyle(e){this.#cd=e}#l9;get rotate(){return this.#l9}set rotate(e){this.#l9=e}#ch;get rough(){return this.#ch}set rough(e){this.#ch=e}#cu;get roughness(){return this.#cu}set roughness(e){this.#cu=e}#cp;get source(){return this.#cp}set source(e){this.#cp=e}#nu;get stroke(){return this.#nu}set stroke(e){this.#nu=e}#oP;get strokeStyle(){return this.#oP}set strokeStyle(e){this.#oP=e}#oH;get strokeWidth(){return this.#oH}set strokeWidth(e){this.#oH=e}#lg;get target(){return this.#lg}set target(e){this.#lg=e}#ia;get text(){return this.#ia}set text(e){this.#ia=e}#ce;get xywh(){return this.#ce}set xywh(e){this.#ce=e}constructor(){super(...arguments),this.updatingPath=!1,this.#ct=m(this,A,[]),this.#ci=(m(this,L),m(this,D,void 0)),this.#cs=(m(this,Z),m(this,j,void 0)),this.#co=(m(this,V),m(this,z,void 0)),this.#cr=(m(this,R),m(this,F,void 0)),this.#ca=(m(this,N),m(this,q,void 0)),this.#cn=(m(this,U),m(this,W,void 0)),this.#cl=(m(this,G),m(this,Y,!1)),this.#is=(m(this,K),m(this,X,o.Orthogonal)),this.#cc=(m(this,Q),m(this,J,[])),this.#cd=(m(this,ee),m(this,et,void 0)),this.#l9=(m(this,ei),m(this,es,0)),this.#ch=(m(this,eo),m(this,er,void 0)),this.#cu=(m(this,ea),m(this,en,h.js)),this.#cp=(m(this,el),m(this,ec,{position:[0,0]})),this.#nu=(m(this,ed),m(this,eh,"#000000")),this.#oP=(m(this,eu),m(this,ep,h.u1.Solid)),this.#oH=(m(this,ef),m(this,eg,4)),this.#lg=(m(this,em),m(this,ev,{position:[0,0]})),this.#ia=(m(this,ey),m(this,eb,void 0)),this.#ce=(m(this,ew),m(this,ex,"[0,0,0,0]")),m(this,e_)}}})();class x extends a.cI{constructor(){super(...arguments),this._path=[],this.absolutePath=[],this.id="",this.mode=o.Orthogonal,this.rotate=0,this.roughness=h.js,this.seed=Math.random(),this.source={position:[0,0]},this.stroke="#000000",this.strokeStyle=h.u1.Solid,this.strokeWidth=4,this.target={position:[0,0]},this.updatingPath=!1,this.xywh="[0,0,0,0]"}get path(){return this._path}set path(e){let{x:t,y:i}=this;this._path=e,this.absolutePath=e.map(e=>e.clone().setVec([e[0]+t,e[1]+i]))}get type(){return"connector"}}function _(e){return e instanceof w&&e.hasLabel()}},26739:(e,t,i)=>{i.d(t,{$:()=>d});var s=i(1126),o=i(94098),r=i(73711),a=i(62602),n=i(11559),l=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},c=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,d=s.JU,h=[],u=[],p=[],f=[],g=[],m=[];return class extends d{static{let o="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;e=[(0,s.lB)((e,t,i)=>{t.setChildIds(Array.from(t.children.keys()),i?.local??!1)}),(0,s.A1)()],t=[(0,s.sr)()],i=[(0,s.A1)()],l(this,null,e,{kind:"accessor",name:"children",static:!1,private:!1,access:{has:e=>"children"in e,get:e=>e.children,set:(e,t)=>{e.children=t}},metadata:o},h,u),l(this,null,t,{kind:"accessor",name:"showTitle",static:!1,private:!1,access:{has:e=>"showTitle"in e,get:e=>e.showTitle,set:(e,t)=>{e.showTitle=t}},metadata:o},p,f),l(this,null,i,{kind:"accessor",name:"title",static:!1,private:!1,access:{has:e=>"title"in e,get:e=>e.title,set:(e,t)=>{e.title=t}},metadata:o},g,m),o&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static propsToY(e){if(!e.title||e.title instanceof r.rl.Y.Text||(e.title=new r.rl.Y.Text(e.title)),e.children&&!(e.children instanceof r.rl.Y.Map)){let t=new r.rl.Y.Map;(0,a.HP)(e.children).forEach(e=>{t.set(e,!0)}),e.children=t}return e}addChild(e){let t="string"==typeof e?e:e.id;this.children&&this.surface.doc.transact(()=>{this.children.set(t,!0)})}containsBound(e){return e.contains(o.z.deserialize(this.xywh))}getLineIntersections(e,t){let i=o.z.deserialize(this.xywh);return(0,n.Dx)(e,t,i.points)}removeChild(e){let t="string"==typeof e?e:e.id;this.children&&this.surface.doc.transact(()=>{this.children.delete(t)})}serialize(){return super.serialize()}get rotate(){return 0}set rotate(e){}get type(){return"group"}#cf=c(this,h,new r.rl.Y.Map);get children(){return this.#cf}set children(e){this.#cf=e}#cg=(c(this,u),c(this,p,!0));get showTitle(){return this.#cg}set showTitle(e){this.#cg=e}#cm=(c(this,f),c(this,g,new r.rl.Y.Text));get title(){return this.#cm}set title(e){this.#cm=e}constructor(){super(...arguments),c(this,m)}}})()},992:(e,t,i)=>{i.d(t,{$f:()=>a.$,AR:()=>n.AR,B5:()=>l.B5,IN:()=>d,J9:()=>s,lw:()=>r.lw,n6:()=>c.n}),i(31999);var s,o=i(24434),r=i(68192),a=i(26739),n=i(45598),l=i(40942),c=i(9441);let d={group:a.$,connector:r.lw,shape:l.B5,brush:o.C,text:c.n,mindmap:n.AR};!function(e){e.BRUSH="brush",e.CONNECTOR="connector",e.GROUP="group",e.MINDMAP="mindmap",e.SHAPE="shape",e.TEXT="text"}(s||(s={}))},45598:(e,t,i)=>{i.d(t,{AR:()=>y,cy:()=>f.cy});var s=i(1126),o=i(71006),r=i(43228),a=i(73711),n=i(3471),l=i(67448),c=i(62602),d=i(16019),h=i(18513),u=i(68192),p=i(84549),f=i(54074),g=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},m=function(e,t,i){for(var s=arguments.length>2,o=0;ov.array()).optional()}),y=(()=>{let e,t,i,l=s.JU,y=[],b=[],w=[],x=[],_=[],C=[];return class extends l{static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;e=[(0,s.C6)((e,t)=>{if(e instanceof a.rl.Y.Map)return t.requestBuildTree(),t.requestLayout(),e;{v.parse(e),(0,o.j)(e);let i=new a.rl.Y.Map,s=t.surface,r=s.doc,l=(e,t=null,o="a0")=>{let r=s.addElement({type:"shape",text:e.text,xywh:e.xywh?e.xywh:"[0, 0, 100, 30]"});i.set(r,{index:o,parent:t??void 0});let a="a0";e.children?.forEach(e=>{l(e,r,a),a=n.TU(a,null)})};return r.transact(()=>{l(e)}),t.requestBuildTree(),t.requestLayout(),i}}),(0,s.lB)((e,t,i)=>{t.setChildIds(Array.from(t.children.keys()),i?.local??!0),t.buildTree(),t.connectors.clear()}),(0,s.A1)()],t=[(0,s.wB)((e,t,i)=>{i&&(t.surface.doc.transact(()=>{t._tree?.children.forEach(e=>{t.children.has(e.id)&&t.children.set(e.id,{index:e.detail.index,parent:e.detail.parent})})}),t.buildTree())}),(0,s.A1)()],i=[(0,s.wB)((e,t,i)=>{i&&t.layout()}),(0,s.A1)()],g(this,null,e,{kind:"accessor",name:"children",static:!1,private:!1,access:{has:e=>"children"in e,get:e=>e.children,set:(e,t)=>{e.children=t}},metadata:r},y,b),g(this,null,t,{kind:"accessor",name:"layoutType",static:!1,private:!1,access:{has:e=>"layoutType"in e,get:e=>e.layoutType,set:(e,t)=>{e.layoutType=t}},metadata:r},w,x),g(this,null,i,{kind:"accessor",name:"style",static:!1,private:!1,access:{has:e=>"style"in e,get:e=>e.style,set:(e,t)=>{e.style=t}},metadata:r},_,C),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static createFromTree(e,t,i,s){let o=new a.rl.Y.Map,r=(e,t)=>{let i={...e.detail,parent:t};t||delete i.parent,o.set(e.id,i),e.children.forEach(t=>r(t,e.id))};r(e);let n=s.addElement({type:"mindmap",children:o,layoutType:i,style:t}),l=s.getElementById(n);return l.layout(),l}static propsToY(e){var t;if(e.children&&!("string"==typeof(t=e.children).text&&Array.isArray(t.children))&&!(e.children instanceof a.rl.Y.Map)){let t=new a.rl.Y.Map;(0,c.HP)(e.children).forEach(i=>{let s=(0,c.Up)(e.children[i],["index","parent","preferredDir"]);t.set(i,s)}),e.children=t}return e}_cfgBalanceLayoutDir(){if(this.layoutType!==p.p5.BALANCE)return;let e=this._tree,t=e.children.findIndex((e,t)=>e.detail.preferredDir===p.p5.LEFT||e.detail.preferredDir===p.p5.RIGHT&&e.children[t+1]?.detail.preferredDir!==p.p5.RIGHT);if(-1===t){let t=Math.ceil(e.children.length/2);e.right.push(...e.children.slice(0,t)),e.left.push(...e.children.slice(t))}else e.right.push(...e.children.slice(0,t+1)),e.left.push(...e.children.slice(t+1));e.left.reverse()}_isConnectorOutdated(e,t=!0){let{connector:i,from:s,to:o,layout:r}=e,a=`${s.element.xywh}-${o.element.xywh}-${r}-${this.style}`;return i.MINDMAP_CONNECTOR===a?{outdated:!1,cacheKey:a}:(t&&(i.MINDMAP_CONNECTOR=a),{outdated:!0,cacheKey:a})}addConnector(e,t,i,s,o=!1){let r=`#${e.id}-${t.id}`;if(o)this.extraConnectors.set(r,new u.oG);else if(this.connectors.has(r)){let s=this.connectors.get(r),{outdated:o}=this._isConnectorOutdated({connector:s,from:e,to:t,layout:i});if(!o)return s}else{let s=new u.oG;this._isConnectorOutdated({connector:s,from:e,to:t,layout:i}),this.connectors.set(r,s)}let a=o?this.extraConnectors.get(r):this.connectors.get(r);return a.id=r,a.source={id:e.id,position:i===p.p5.RIGHT?[1,.5]:[0,.5]},a.target={id:t.id,position:i===p.p5.RIGHT?[0,.5]:[1,.5]},Object.entries(s).forEach(([e,t])=>{a[e]=t}),this.pathGenerator.updatePath(a),a}addNode(e,t,i="after",s={},r){let l;if(e&&"string"!=typeof e&&(e=e.id),(0,o.j)(e),e&&!this._nodeMap.has(e))throw Error(`Parent node ${e} not found`);s.text=new a.rl.Y.Text(s.text??"New node");let h=s.type??"shape";return this.surface.doc.transact(()=>{let o=e?this._nodeMap.get(e):null;if(o){let a=this.layoutType===p.p5.BALANCE&&this._tree.id===o.id,u=(0,c.HV)(o.children)?(0,n.TU)((0,c.HV)(o.children).detail.index,null):"a0",f="number"==typeof(t=t??c.HV(o.children)?.id)?o.children[t]:t?this._nodeMap.get(t):void 0,g=f?this.getPath(f):this.getPath(o).concat([0]),m=this.styleGetter.getNodeStyle(f??o,g);if(l=this.surface.addElement({type:h,xywh:"[0,0,100,30]",textResizing:d.bn.AUTO_WIDTH,maxWidth:!1,...s,...m.node}),f){let e=o.children.findIndex(e=>e.id===t);u="after"===i?(0,n.TU)(f.detail.index,o.children[e+1]?.detail.index??null):(0,n.TU)(o.children[e-1]?.detail.index??null,f.detail.index)}else if(a&&void 0!==r){let e=r===p.p5.LEFT?this._tree.left[0]:(0,c.HV)(this._tree.right);e&&(u=(0,n.TU)(e.detail.index,null))}let v={index:u,parent:e};void 0!==r&&a&&(v.preferredDir=r),this.children.set(l,v)}else{let e=this.styleGetter.root;l=this.surface.addElement({type:h,xywh:"[0,0,113,41]",textResizing:d.bn.AUTO_WIDTH,maxWidth:400,...s,...e}),this.children.clear(),this.children.set(l,{index:"a0"})}}),this.layout(),l}addTree(e,t,i,s){if(e="string"==typeof e?e:e.id,!this._nodeMap.has(e)||!e)return null;(0,o.j)(e),(s===p.p5.BALANCE||this._nodeMap.get(e)!==this._tree)&&(s=void 0);let r=(e,t,i,s)=>{let o;return"text"in e?o=this.addNode(t,i,"before",{text:e.text},s):(this.children.set(e.id,{...e.detail,parent:t}),o=e.id),e.children?.forEach(e=>{r(e,o)}),o};if(!("text"in t))return this.surface.doc.transact(()=>{r(t,e,i,s)}),this.applyStyle(),this.layout(),this._nodeMap.get(t.id);{let o=r(t,e,i,s);return this.layout(),this._nodeMap.get(o)}}applyStyle(e=!1){this.surface.doc.transact(()=>{let t=this.styleGetter;if(!t)return;(0,f.Yt)(this._tree,t.root,e);let i=(s,o)=>{s.children.forEach((s,r)=>{let a=[...o,r],n=t.getNodeStyle(s,a);(0,f.Yt)(s,n.node,e),i(s,a)})};i(this._tree,[0])})}buildTree(){let e;let t=new Map,i=this.children;if(!i){this._nodeMap=t,this._tree=null;return}i.forEach((i,s)=>{let o=t.has(s)?t.get(s):{id:s,parent:i.parent,index:i.index,detail:i,element:this.surface.getElementById(s),children:[]};if(o.detail||(o.detail=i),t.has(s)||t.set(s,o),i.parent){if(t.has(i.parent)){let e=t.get(i.parent);e.children=e.children??[],e.children.push(o)}else t.set(i.parent,{id:i.parent,children:[o],element:this.surface.getElementById(i.parent)})}else(e=o).left=[],e.right=[]}),t.forEach(e=>{e.children.sort((e,t)=>e.detail.index===t.detail.index?0:e.detail.index>t.detail.index?1:-1)}),e&&(this._nodeMap=t,this._tree=e,this.layoutType===p.p5.BALANCE?this._cfgBalanceLayoutDir():this._tree[this.layoutType===p.p5.RIGHT?"right":"left"]=this._tree.children)}detach(e){if(e="string"==typeof e?this._nodeMap.get(e):e,(0,o.j)(e),!e)return;let t=e=>{this.children.delete(e.id),e.detail={...e.detail},e.children.forEach(e=>t(e))};return this.surface.doc.transact(()=>{t(e)}),this.layout(),delete e.detail.parent,e}getChildNodes(e,t){let i=this._nodeMap.get(e);return i?t&&e===this._tree.id?this._tree[t]:i.children:[]}getConnector(e,t){return this._nodeMap.has(e.id)&&this._nodeMap.has(t.id)?this.addConnector(e,t,this.getLayoutDir(t),this.styleGetter.getNodeStyle(t,this.getPath(t)).connector):null}getLayoutDir(e){e="string"==typeof e?this._nodeMap.get(e):e,(0,o.j)(e);let t=e,i=this._tree;for(;t;){if(void 0!==t.overriddenDir)return t.overriddenDir;let e=t.detail.parent?this._nodeMap.get(t.detail.parent)??null:null;if(e===i)return i.left.includes(t)?p.p5.LEFT:i.right.includes(t)?p.p5.RIGHT:this.layoutType;t=e}return this.layoutType}getNode(e){return this._nodeMap.get(e)??null}getParentNode(e){let t=this.children.get(e);return t?.parent?this._nodeMap.get(t.parent)??null:null}getPath(e){let t=this._nodeMap.get("string"==typeof e?e:e.id);if(!t)throw Error("Node not found");let i=[];for(;t&&t!==this._tree;){let e=this._nodeMap.get(t.detail.parent);i.unshift(e.children.indexOf(t)),t=e}return i.unshift(0),i}getSiblingNode(e,t="next",i){let s=this._nodeMap.get(e);if(!s)return null;let o=this._nodeMap.get(s.detail.parent);if(!o)return null;let r=i&&o.id===this._tree.id?this._tree[i]:o.children,a=r.indexOf(s);return -1===a?null:r["next"===t?a+1:a-1]??null}layout(e=this.tree,t=!0,i){e&&e.element&&(t&&this.applyStyle(!0),this.surface.doc.transact(()=>{let t=this.getPath(e.id);(0,p.Zp)(e,this,i??this.getLayoutDir(e.id),t)}))}moveTo(e){let{x:t,y:i}=this,s="string"==typeof e?(0,r.W)(e):e,o=s[0]-t,a=s[1]-i+s[3];this.surface.doc.transact(()=>{this.childElements.forEach(e=>{let t=(0,r.W)(e.xywh);e.xywh=`[${t[0]+o},${t[1]+a},${t[2]},${t[3]}]`})})}moveTree(e,t,i,s){if(!(t=this._nodeMap.get("string"==typeof t?t:t.id))||!this._nodeMap.has(e.id))return;(0,o.j)(t),(s===p.p5.BALANCE||t!==this._tree)&&(s=void 0);let r=t.children[i],a=t.children[i-1],l=r||a?(0,n.TU)(a?.detail.index??null,r?.detail.index??null):e.detail.index??void 0;return this.surface.doc.transact(()=>{let i=void 0!==s?{...e.detail,index:l,parent:t.id,preferredDir:s}:{...e.detail,index:l,parent:t.id};this.children.set(e.id,i)}),this.layout(),this._nodeMap.get(e.id)}onCreated(){this.requestBuildTree()}removeChild(e){if(!this._nodeMap.has(e))return;let t=this.surface,i=[],s=e=>{e.children?.forEach(e=>{s(e)}),this.children?.delete(e.id),i.push(e.id)};t.doc.transact(()=>{s(this._nodeMap.get(e))}),queueMicrotask(()=>{i.forEach(e=>t.removeElement(e))}),this.buildTree(),this.requestLayout()}requestBuildTree(){this._queueBuildTree||(this._queueBuildTree=!0,queueMicrotask(()=>{this.buildTree(),this._queueBuildTree=!1}))}requestLayout(){this._queued||(this._queued=!0,queueMicrotask(()=>{this.layout(),this._queued=!1}))}serialize(){return super.serialize()}stashTree(e){let t="string"==typeof e?this.getNode(e):e;if(!t)return;let i=new Set,s=(e,t)=>{if(e.element.stash("xywh"),e.element.opacity=.3,i.add(e.element),t){let s=`#${t.element.id}-${e.element.id}`,o=this.connectors.get(s);o&&(o.opacity=.3,i.add(o))}e.children.length&&e.children.forEach(t=>s(t,e))},o=this.getParentNode(t.element.id);return s(t,o?this.getNode(o.id):null),()=>{i.forEach(e=>{"pop"in e&&e.pop("xywh"),e.opacity=1})}}traverse(e){let t=(i,s)=>{e(i,s),i?.children.forEach(e=>{t(e,i)})};this._tree&&t(this._tree,null)}get nodeMap(){return this._nodeMap}get rotate(){return 0}set rotate(e){}get styleGetter(){return f.qj[this.style]}get tree(){return this._tree}get type(){return"mindmap"}#cf;get children(){return this.#cf}set children(e){this.#cf=e}#rZ;get layoutType(){return this.#rZ}set layoutType(e){this.#rZ=e}#cv;get style(){return this.#cv}set style(e){this.#cv=e}constructor(){super(...arguments),this._nodeMap=new Map,this._queueBuildTree=!1,this._queued=!1,this.connectors=new Map,this.extraConnectors=new Map,this.pathGenerator=new h.IV({getElementById:e=>this.surface.getElementById(e)??this.surface.doc.getBlockById(e)}),this.#cf=m(this,y,new a.rl.Y.Map),this.#rZ=(m(this,b),m(this,w,p.p5.RIGHT)),this.#cv=(m(this,x),m(this,_,f.cy.ONE)),m(this,C)}}})()},40942:(e,t,i)=>{i.d(t,{OL:()=>v,B5:()=>y,e2:()=>m});var s,o=i(1126),r=i(73711),a=i(16019),n=i(94098),l=i(96458),c=i(11559);let d={points:({x:e,y:t,w:i,h:s})=>[[e,t+s/2],[e+i/2,t],[e+i,t+s/2],[e+i/2,t+s]],draw(e,{x:t,y:i,w:s,h:o,rotate:r=0}){let a=t+s/2,n=i+o/2;e.save(),e.translate(a,n),e.rotate(r*Math.PI/180),e.translate(-a,-n),e.beginPath(),e.moveTo(t,i+o/2),e.lineTo(t+s/2,i),e.lineTo(t+s,i+o/2),e.lineTo(t+s/2,i+o),e.closePath(),e.restore()},includesPoint(e,t,i){let s=[e,t],o=(0,c.Bn)(this,d.points),r=(0,c.kO)(s,o,(i?.expand??1)/(i.zoom??1));if(!r){if(!i.ignoreTransparent||this.filled)r=(0,c.s3)([e,t],o);else{let e=this.text;if(e&&e.length)this.textBound&&(r=(0,c.s3)(s,(0,c.Bn)(this,()=>n.z.from(this.textBound).points)));else{let e=(0,c.GT)(this,a.cT),t=(0,c.Bn)(e,d.points);r=(0,c.s3)(s,t)}}}return r},containsBound:(e,t)=>(0,c.Bn)(t,d.points).some(t=>e.containsPoint(t)),getNearestPoint(e,t){let i=(0,c.Bn)(t,d.points);return(0,c.$L)(i,e)},getLineIntersections(e,t,i){let s=(0,c.Bn)(i,d.points);return(0,c.Dx)(e,t,s)},getRelativePointLocation(e,t){let i=n.z.deserialize(t.xywh),s=i.getRelativePoint(e),o=d.points(i);o.push(s);let r=(o=(0,c.Hb)(o,i.center,t.rotate)).pop(),a=(0,c.W4)(o,r);return new l.S(r,a)}};var h=i(31716);let u={points:({x:e,y:t,w:i,h:s})=>[[e,t+s/2],[e+i/2,t],[e+i,t+s/2],[e+i/2,t+s]],draw(e,{x:t,y:i,w:s,h:o,rotate:r=0}){let a=t+s/2,n=i+o/2;e.save(),e.translate(a,n),e.rotate(r*Math.PI/180),e.translate(-a,-n),e.beginPath(),e.ellipse(a,n,s/2,o/2,0,0,2*Math.PI),e.restore()},includesPoint(e,t,i){let s=[e,t],o=(i?.expand??1)/(i?.zoom??1),r=this.w/2,l=this.h/2,d=[this.x+r,this.y+l],h=this.rotate*Math.PI/180,u=(0,c.a0)(s,d,r+o,l+o,h)&&!(0,c.a0)(s,d,r-o,l-o,h);if(!u){if(!i.ignoreTransparent||this.filled)u=(0,c.a0)(s,d,r,l,h);else{let e=this.text;if(e&&e.length)this.textBound&&(u=(0,c.s3)(s,(0,c.Bn)(this,()=>n.z.from(this.textBound).points)));else{let e=r*a.cT,t=l*a.cT;u=(0,c.a0)(s,d,e,t,h)}}}return u},containsBound:(e,t)=>(0,c.Bn)(t,u.points).some(t=>e.containsPoint(t)),getNearestPoint(e,{rotate:t,xywh:i}){let{center:s,w:o,h:r}=n.z.deserialize(i),a=(0,c.DF)(t),l=o/2,d=r/2,[u,p]=h.l.rot(h.l.sub(e,s),-a),f=Math.abs(u),g=Math.abs(p),m=Math.SQRT1_2,v=Math.SQRT1_2,y=0;for(;y<3;y++){let e=l*m,t=d*v,i=(l*l-d*d)*m**3/l,s=(d*d-l*l)*v**3/d,o=e-i,r=t-s,a=f-i,n=g-s,h=Math.hypot(r,o),u=Math.hypot(n,a);m=(0,c.qE)((a*h/u+i)/l,0,1);let p=Math.hypot(v=(0,c.qE)((n*h/u+s)/d,0,1),m);m/=p,v/=p}return h.l.add(h.l.rot([l*m*Math.sign(u),d*v*Math.sign(p)],a),s)},getLineIntersections(e,t,{rotate:i,xywh:s}){let o=(0,c.DF)(i),r=n.z.deserialize(s);return(0,c.Vk)(e,t,r.center,r.w/2,r.h/2,o)},getRelativePointLocation(e,{rotate:t,xywh:i}){let s=n.z.deserialize(i),o=s.getRelativePoint(e),{x:r,y:a,w:d,h:u,center:p}=s,f=(0,c.Hb)([[r,a],[r+d/2,a],[r+d,a],[r+d,a+u/2],[r+d,a+u],[r+d/2,a+u],[r,a+u],[r,a+u/2],o],p,t),g=f.pop(),m=f.length,v=[0,.5],y=0;for(;y[[e,t+s],[e+i/2,t],[e+i,t+s]],draw(e,{x:t,y:i,w:s,h:o,rotate:r=0}){let a=t+s/2,n=i+o/2;e.save(),e.translate(a,n),e.rotate(r*Math.PI/180),e.translate(-a,-n),e.beginPath(),e.moveTo(t,i+o),e.lineTo(t+s/2,i),e.lineTo(t+s,i+o),e.closePath(),e.restore()},includesPoint(e,t,i){let s=[e,t],o=(0,c.Bn)(this,p.points),r=(0,c.kO)(s,o,(i?.expand??1)/(i?.zoom??1));if(!r){if(!i.ignoreTransparent||this.filled)r=(0,c.s3)([e,t],o);else{let i=this.text;if(i&&i.length)this.textBound&&(r=(0,c.s3)(s,(0,c.Bn)(this,()=>n.z.from(this.textBound).points)));else{let i=(0,c.GT)(this,a.cT),s=(0,c.Bn)(i,p.points);r=(0,c.s3)([e,t],s)}}}return r},containsBound:(e,t)=>(0,c.Bn)(t,p.points).some(t=>e.containsPoint(t)),getNearestPoint(e,t){let i=(0,c.Bn)(t,p.points);return(0,c.$L)(i,e)},getLineIntersections(e,t,i){let s=(0,c.Bn)(i,p.points);return(0,c.Dx)(e,t,s)},getRelativePointLocation(e,t){let i=n.z.deserialize(t.xywh),s=i.getRelativePoint(e),o=p.points(i);o.push(s);let r=(o=(0,c.Hb)(o,i.center,t.rotate)).pop(),a=(0,c.W4)(o,r);return new l.S(r,a)}};var f=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},g=function(e,t,i){for(var s=arguments.length>2,o=0;o[[e,t],[e+i,t],[e+i,t+s],[e,t+s]],draw(e,{x:t,y:i,w:s,h:o,rotate:r=0}){e.save(),e.translate(t+s/2,i+o/2),e.rotate(r*Math.PI/180),e.translate(-t-s/2,-i-o/2),e.rect(t,i,s,o),e.restore()},includesPoint(e,t,i){let s=[e,t],o=(0,c.Bn)(this),r=(0,c.kO)(s,o,(i?.expand??1)/(i.zoom??1));if(!r){if(!i.ignoreTransparent||this.filled)r=(0,c.s3)([e,t],o);else{let i=this.text;if(i&&i.length)this.textBound&&(r=(0,c.s3)(s,(0,c.Bn)(this,()=>n.z.from(this.textBound).points)));else{let i=(0,c.GT)(this,a.cT),s=(0,c.Bn)(i);r=(0,c.s3)([e,t],s)}}}return r},containsBound:(e,t)=>(0,c.Bn)(t).some(t=>e.containsPoint(t)),getNearestPoint(e,t){let i=(0,c.Bn)(t);return(0,c.$L)(i,e)},getLineIntersections(e,t,i){let s=(0,c.Bn)(i);return(0,c.Dx)(e,t,s)},getRelativePointLocation(e,t){let i=n.z.deserialize(t.xywh),s=i.getRelativePoint(e),o=(0,c.Hb)([s],i.center,t.rotate??0)[0],r=(0,c.Hb)(i.points,i.center,t.rotate??0),a=(0,c.W4)(r,o);return new l.S(o,a)}},triangle:p,ellipse:u,diamond:d};!function(e){e[e.LARGE=28]="LARGE",e[e.MEDIUM=20]="MEDIUM",e[e.SMALL=12]="SMALL",e[e.XLARGE=36]="XLARGE"}(s||(s={}));let v=20,y=(()=>{let e,t,i,n,l,c,d,h,u,p,y,b,w,x,_,C,k,S,M,E,I,B,$,T,O,P=o.iy,H=[],A=[],L=[],D=[],Z=[],j=[],V=[],z=[],R=[],F=[],N=[],q=[],U=[],W=[],G=[],Y=[],K=[],X=[],Q=[],J=[],ee=[],et=[],ei=[],es=[],eo=[],er=[],ea=[],en=[],el=[],ec=[],ed=[],eh=[],eu=[],ep=[],ef=[],eg=[],em=[],ev=[],ey=[],eb=[],ew=[],ex=[],e_=[],eC=[],ek=[],eS=[],eM=[],eE=[],eI=[],eB=[];return class extends P{static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(P[Symbol.metadata]??null):void 0;e=[(0,o.A1)("#000000")],t=[(0,o.A1)()],i=[(0,o.A1)()],n=[(0,o.A1)(a.ay.Inter)],l=[(0,o.A1)(s.MEDIUM)],c=[(0,o.A1)(a.zz.Normal)],d=[(0,o.A1)(a.IT.Regular)],h=[(0,o.A1)(!1)],u=[(0,o.A1)([10,v])],p=[(0,o.A1)()],y=[(0,o.A1)(0)],b=[(0,o.A1)(a.js)],w=[(0,o.A1)()],x=[(0,o.A1)("General")],_=[(0,o.A1)()],C=[(0,o.A1)()],k=[(0,o.A1)()],S=[(0,o.A1)()],M=[(0,o.A1)()],E=[(0,o.A1)(a.nO.Center)],I=[(0,o.sr)()],B=[(0,o.A1)(a.nO.Center)],$=[(0,o.A1)(a.bn.AUTO_HEIGHT)],T=[(0,o.A1)(a.f1.Center)],O=[(0,o.A1)()],f(this,null,e,{kind:"accessor",name:"color",static:!1,private:!1,access:{has:e=>"color"in e,get:e=>e.color,set:(e,t)=>{e.color=t}},metadata:r},H,A),f(this,null,t,{kind:"accessor",name:"fillColor",static:!1,private:!1,access:{has:e=>"fillColor"in e,get:e=>e.fillColor,set:(e,t)=>{e.fillColor=t}},metadata:r},L,D),f(this,null,i,{kind:"accessor",name:"filled",static:!1,private:!1,access:{has:e=>"filled"in e,get:e=>e.filled,set:(e,t)=>{e.filled=t}},metadata:r},Z,j),f(this,null,n,{kind:"accessor",name:"fontFamily",static:!1,private:!1,access:{has:e=>"fontFamily"in e,get:e=>e.fontFamily,set:(e,t)=>{e.fontFamily=t}},metadata:r},V,z),f(this,null,l,{kind:"accessor",name:"fontSize",static:!1,private:!1,access:{has:e=>"fontSize"in e,get:e=>e.fontSize,set:(e,t)=>{e.fontSize=t}},metadata:r},R,F),f(this,null,c,{kind:"accessor",name:"fontStyle",static:!1,private:!1,access:{has:e=>"fontStyle"in e,get:e=>e.fontStyle,set:(e,t)=>{e.fontStyle=t}},metadata:r},N,q),f(this,null,d,{kind:"accessor",name:"fontWeight",static:!1,private:!1,access:{has:e=>"fontWeight"in e,get:e=>e.fontWeight,set:(e,t)=>{e.fontWeight=t}},metadata:r},U,W),f(this,null,h,{kind:"accessor",name:"maxWidth",static:!1,private:!1,access:{has:e=>"maxWidth"in e,get:e=>e.maxWidth,set:(e,t)=>{e.maxWidth=t}},metadata:r},G,Y),f(this,null,u,{kind:"accessor",name:"padding",static:!1,private:!1,access:{has:e=>"padding"in e,get:e=>e.padding,set:(e,t)=>{e.padding=t}},metadata:r},K,X),f(this,null,p,{kind:"accessor",name:"radius",static:!1,private:!1,access:{has:e=>"radius"in e,get:e=>e.radius,set:(e,t)=>{e.radius=t}},metadata:r},Q,J),f(this,null,y,{kind:"accessor",name:"rotate",static:!1,private:!1,access:{has:e=>"rotate"in e,get:e=>e.rotate,set:(e,t)=>{e.rotate=t}},metadata:r},ee,et),f(this,null,b,{kind:"accessor",name:"roughness",static:!1,private:!1,access:{has:e=>"roughness"in e,get:e=>e.roughness,set:(e,t)=>{e.roughness=t}},metadata:r},ei,es),f(this,null,w,{kind:"accessor",name:"shadow",static:!1,private:!1,access:{has:e=>"shadow"in e,get:e=>e.shadow,set:(e,t)=>{e.shadow=t}},metadata:r},eo,er),f(this,null,x,{kind:"accessor",name:"shapeStyle",static:!1,private:!1,access:{has:e=>"shapeStyle"in e,get:e=>e.shapeStyle,set:(e,t)=>{e.shapeStyle=t}},metadata:r},ea,en),f(this,null,_,{kind:"accessor",name:"shapeType",static:!1,private:!1,access:{has:e=>"shapeType"in e,get:e=>e.shapeType,set:(e,t)=>{e.shapeType=t}},metadata:r},el,ec),f(this,null,C,{kind:"accessor",name:"strokeColor",static:!1,private:!1,access:{has:e=>"strokeColor"in e,get:e=>e.strokeColor,set:(e,t)=>{e.strokeColor=t}},metadata:r},ed,eh),f(this,null,k,{kind:"accessor",name:"strokeStyle",static:!1,private:!1,access:{has:e=>"strokeStyle"in e,get:e=>e.strokeStyle,set:(e,t)=>{e.strokeStyle=t}},metadata:r},eu,ep),f(this,null,S,{kind:"accessor",name:"strokeWidth",static:!1,private:!1,access:{has:e=>"strokeWidth"in e,get:e=>e.strokeWidth,set:(e,t)=>{e.strokeWidth=t}},metadata:r},ef,eg),f(this,null,M,{kind:"accessor",name:"text",static:!1,private:!1,access:{has:e=>"text"in e,get:e=>e.text,set:(e,t)=>{e.text=t}},metadata:r},em,ev),f(this,null,E,{kind:"accessor",name:"textAlign",static:!1,private:!1,access:{has:e=>"textAlign"in e,get:e=>e.textAlign,set:(e,t)=>{e.textAlign=t}},metadata:r},ey,eb),f(this,null,I,{kind:"accessor",name:"textDisplay",static:!1,private:!1,access:{has:e=>"textDisplay"in e,get:e=>e.textDisplay,set:(e,t)=>{e.textDisplay=t}},metadata:r},ew,ex),f(this,null,B,{kind:"accessor",name:"textHorizontalAlign",static:!1,private:!1,access:{has:e=>"textHorizontalAlign"in e,get:e=>e.textHorizontalAlign,set:(e,t)=>{e.textHorizontalAlign=t}},metadata:r},e_,eC),f(this,null,$,{kind:"accessor",name:"textResizing",static:!1,private:!1,access:{has:e=>"textResizing"in e,get:e=>e.textResizing,set:(e,t)=>{e.textResizing=t}},metadata:r},ek,eS),f(this,null,T,{kind:"accessor",name:"textVerticalAlign",static:!1,private:!1,access:{has:e=>"textVerticalAlign"in e,get:e=>e.textVerticalAlign,set:(e,t)=>{e.textVerticalAlign=t}},metadata:r},eM,eE),f(this,null,O,{kind:"accessor",name:"xywh",static:!1,private:!1,access:{has:e=>"xywh"in e,get:e=>e.xywh,set:(e,t)=>{e.xywh=t}},metadata:r},eI,eB),r&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static propsToY(e){return!e.text||e.text instanceof r.rl.Y.Text||(e.text=new r.rl.Y.Text(e.text)),e}containsBound(e){return m[this.shapeType].containsBound(e,this)}getLineIntersections(e,t){return m[this.shapeType].getLineIntersections(e,t,this)}getNearestPoint(e){return m[this.shapeType].getNearestPoint(e,this)}getRelativePointLocation(e){return m[this.shapeType].getRelativePointLocation(e,this)}includesPoint(e,t,i){return m[this.shapeType].includesPoint.call(this,e,t,{...i,ignoreTransparent:i.ignoreTransparent??!0})}get type(){return"shape"}#ig;get color(){return this.#ig}set color(e){this.#ig=e}#r5;get fillColor(){return this.#r5}set fillColor(e){this.#r5=e}#cy;get filled(){return this.#cy}set filled(e){this.#cy=e}#r_;get fontFamily(){return this.#r_}set fontFamily(e){this.#r_=e}#cb;get fontSize(){return this.#cb}set fontSize(e){this.#cb=e}#rC;get fontStyle(){return this.#rC}set fontStyle(e){this.#rC=e}#rk;get fontWeight(){return this.#rk}set fontWeight(e){this.#rk=e}#cw;get maxWidth(){return this.#cw}set maxWidth(e){this.#cw=e}#eX;get padding(){return this.#eX}set padding(e){this.#eX=e}#i2;get radius(){return this.#i2}set radius(e){this.#i2=e}#l9;get rotate(){return this.#l9}set rotate(e){this.#l9=e}#cu;get roughness(){return this.#cu}set roughness(e){this.#cu=e}#tT;get shadow(){return this.#tT}set shadow(e){this.#tT=e}#rQ;get shapeStyle(){return this.#rQ}set shapeStyle(e){this.#rQ=e}#r7;get shapeType(){return this.#r7}set shapeType(e){this.#r7=e}#oO;get strokeColor(){return this.#oO}set strokeColor(e){this.#oO=e}#oP;get strokeStyle(){return this.#oP}set strokeStyle(e){this.#oP=e}#oH;get strokeWidth(){return this.#oH}set strokeWidth(e){this.#oH=e}#ia;get text(){return this.#ia}set text(e){this.#ia=e}#cx;get textAlign(){return this.#cx}set textAlign(e){this.#cx=e}#c_;get textDisplay(){return this.#c_}set textDisplay(e){this.#c_=e}#cC;get textHorizontalAlign(){return this.#cC}set textHorizontalAlign(e){this.#cC=e}#ck;get textResizing(){return this.#ck}set textResizing(e){this.#ck=e}#cS;get textVerticalAlign(){return this.#cS}set textVerticalAlign(e){this.#cS=e}#ce;get xywh(){return this.#ce}set xywh(e){this.#ce=e}constructor(){super(...arguments),this.textBound=null,this.#ig=g(this,H,void 0),this.#r5=(g(this,A),g(this,L,"--affine-palette-shape-yellow")),this.#cy=(g(this,D),g(this,Z,!1)),this.#r_=(g(this,j),g(this,V,void 0)),this.#cb=(g(this,z),g(this,R,void 0)),this.#rC=(g(this,F),g(this,N,void 0)),this.#rk=(g(this,q),g(this,U,void 0)),this.#cw=(g(this,W),g(this,G,!1)),this.#eX=(g(this,Y),g(this,K,[10,v])),this.#i2=(g(this,X),g(this,Q,0)),this.#l9=(g(this,J),g(this,ee,0)),this.#cu=(g(this,et),g(this,ei,a.js)),this.#tT=(g(this,es),g(this,eo,null)),this.#rQ=(g(this,er),g(this,ea,"General")),this.#r7=(g(this,en),g(this,el,"rect")),this.#oO=(g(this,ec),g(this,ed,"--affine-palette-line-yellow")),this.#oP=(g(this,eh),g(this,eu,a.u1.Solid)),this.#oH=(g(this,ep),g(this,ef,4)),this.#ia=(g(this,eg),g(this,em,void 0)),this.#cx=(g(this,ev),g(this,ey,void 0)),this.#c_=(g(this,eb),g(this,ew,!0)),this.#cC=(g(this,ex),g(this,e_,void 0)),this.#ck=(g(this,eC),g(this,ek,a.bn.AUTO_HEIGHT)),this.#cS=(g(this,eS),g(this,eM,void 0)),this.#ce=(g(this,eE),g(this,eI,"[0,0,100,100]")),g(this,eB)}}})()},9441:(e,t,i)=>{i.d(t,{n:()=>h});var s=i(1126),o=i(94098),r=i(73711),a=i(16019),n=i(11559),l=i(31999),c=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},d=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,h,u,p,f,g,m,v,y=l.nz,b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],P=[],H=[],A=[],L=[],D=[],Z=[];return class extends y{static{let o="function"==typeof Symbol&&Symbol.metadata?Object.create(y[Symbol.metadata]??null):void 0;e=[(0,s.A1)()],t=[(0,s.A1)()],i=[(0,s.A1)()],h=[(0,s.A1)(a.zz.Normal)],u=[(0,s.A1)(a.IT.Regular)],p=[(0,s.A1)(!1)],f=[(0,s.A1)(0)],g=[(0,s.A1)()],m=[(0,s.A1)()],v=[(0,s.A1)()],c(this,null,e,{kind:"accessor",name:"color",static:!1,private:!1,access:{has:e=>"color"in e,get:e=>e.color,set:(e,t)=>{e.color=t}},metadata:o},b,w),c(this,null,t,{kind:"accessor",name:"fontFamily",static:!1,private:!1,access:{has:e=>"fontFamily"in e,get:e=>e.fontFamily,set:(e,t)=>{e.fontFamily=t}},metadata:o},x,_),c(this,null,i,{kind:"accessor",name:"fontSize",static:!1,private:!1,access:{has:e=>"fontSize"in e,get:e=>e.fontSize,set:(e,t)=>{e.fontSize=t}},metadata:o},C,k),c(this,null,h,{kind:"accessor",name:"fontStyle",static:!1,private:!1,access:{has:e=>"fontStyle"in e,get:e=>e.fontStyle,set:(e,t)=>{e.fontStyle=t}},metadata:o},S,M),c(this,null,u,{kind:"accessor",name:"fontWeight",static:!1,private:!1,access:{has:e=>"fontWeight"in e,get:e=>e.fontWeight,set:(e,t)=>{e.fontWeight=t}},metadata:o},E,I),c(this,null,p,{kind:"accessor",name:"hasMaxWidth",static:!1,private:!1,access:{has:e=>"hasMaxWidth"in e,get:e=>e.hasMaxWidth,set:(e,t)=>{e.hasMaxWidth=t}},metadata:o},B,$),c(this,null,f,{kind:"accessor",name:"rotate",static:!1,private:!1,access:{has:e=>"rotate"in e,get:e=>e.rotate,set:(e,t)=>{e.rotate=t}},metadata:o},T,O),c(this,null,g,{kind:"accessor",name:"text",static:!1,private:!1,access:{has:e=>"text"in e,get:e=>e.text,set:(e,t)=>{e.text=t}},metadata:o},P,H),c(this,null,m,{kind:"accessor",name:"textAlign",static:!1,private:!1,access:{has:e=>"textAlign"in e,get:e=>e.textAlign,set:(e,t)=>{e.textAlign=t}},metadata:o},A,L),c(this,null,v,{kind:"accessor",name:"xywh",static:!1,private:!1,access:{has:e=>"xywh"in e,get:e=>e.xywh,set:(e,t)=>{e.xywh=t}},metadata:o},D,Z),o&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:o})}static propsToY(e){return!e.text||e.text instanceof r.rl.Y.Text||(e.text=new r.rl.Y.Text(e.text)),e}containsBound(e){return(0,n.Bn)(this).some(t=>e.containsPoint(t))}getLineIntersections(e,t){let i=(0,n.Bn)(this);return(0,n.Dx)(e,t,i)}getNearestPoint(e){return(0,n.$L)(o.z.deserialize(this.xywh).points,e)}includesPoint(e,t){let i=(0,n.Bn)(this);return(0,n.s3)([e,t],i)}get type(){return"text"}#ig=d(this,b,"#000000");get color(){return this.#ig}set color(e){this.#ig=e}#r_=(d(this,w),d(this,x,a.ay.Inter));get fontFamily(){return this.#r_}set fontFamily(e){this.#r_=e}#cb=(d(this,_),d(this,C,16));get fontSize(){return this.#cb}set fontSize(e){this.#cb=e}#rC=(d(this,k),d(this,S,a.zz.Normal));get fontStyle(){return this.#rC}set fontStyle(e){this.#rC=e}#rk=(d(this,M),d(this,E,a.IT.Regular));get fontWeight(){return this.#rk}set fontWeight(e){this.#rk=e}#cM=(d(this,I),d(this,B,!1));get hasMaxWidth(){return this.#cM}set hasMaxWidth(e){this.#cM=e}#l9=(d(this,$),d(this,T,0));get rotate(){return this.#l9}set rotate(e){this.#l9=e}#ia=(d(this,O),d(this,P,new r.rl.Y.Text));get text(){return this.#ia}set text(e){this.#ia=e}#cx=(d(this,H),d(this,A,a.nO.Center));get textAlign(){return this.#cx}set textAlign(e){this.#cx=e}#ce=(d(this,L),d(this,D,"[0,0,16,16]"));get xywh(){return this.#ce}set xywh(e){this.#ce=e}constructor(){super(...arguments),d(this,Z)}}})()},84549:(e,t,i)=>{i.d(t,{Zp:()=>d,p5:()=>s});var s,o=i(94098);!function(e){e[e.BALANCE=2]="BALANCE",e[e.LEFT=1]="LEFT",e[e.RIGHT=0]="RIGHT"}(s||(s={}));let r=(e,t=!1,i)=>{let s=e.element.elementBound,a=[];if(i=i??e.children){let e=i.reduce((e,t)=>{let i=r(t);return a.push(i),e.w=Math.max(e.w,i.bound.w),e.h+=e.h>0?45+i.bound.h:i.bound.h,e},new o.z(0,0,0,0));s.w+=e.w+(t?200:110),s.h=Math.max(s.h,e.h)}return{root:e,bound:s,children:a}},a=(e,t,i,o=[0],r)=>{let n=1===o.length,l=e.bound.h,c=t===s.RIGHT?e.root.element.x+e.root.element.w+(n?200:110):e.root.element.x-(n?200:110),d=e.root.element.y+(e.root.element.h-l)/2;if(e.root.element.h>=l&&e.children.length){let t=e.children[0];d+=(e.root.element.h-t.root.element.h)/2}e.children.forEach((e,n)=>{let l=e.root.element,h=e.bound.h,u=`[${t===s.RIGHT?c:c-l.w},${d+(h-l.h)/2},${l.w},${l.h}]`,p=[...o,n=r?r.indexOf(e):n];l.xywh=u,a(e,t,i,p),d+=h+45})},n=(e,t,i=[0])=>{a(r(e,!0),s.RIGHT,t,i)},l=(e,t,i=[0])=>{a(r(e,!0),s.LEFT,t,i)},c=(e,t,i=[0])=>{let o=r(e,!0),n=e.left,l=e.right;{let l=r(e,!0,n),c={root:o.root,bound:l.bound,children:l.children};a(c,s.LEFT,t,i,c.children)}{let i=r(e,!0,l),n={root:o.root,bound:i.bound,children:i.children};a(n,s.RIGHT,t,[0],n.children)}},d=(e,t,i,o)=>{switch(i=i??t.layoutType){case s.RIGHT:return n(e,t,o);case s.LEFT:return l(e,t,o);case s.BALANCE:return c(e,t,o)}}},54074:(e,t,i)=>{i.d(t,{Yt:()=>f,cy:()=>s,qj:()=>p});var s,o=i(62602),r=i(49210),a=i(16019),n=i(68192);class l{}let c=new class extends l{constructor(){super(...arguments),this._colorOrders=["--affine-palette-line-purple","--affine-palette-line-magenta","--affine-palette-line-orange","--affine-palette-line-yellow","--affine-palette-line-green","#7ae2d5"],this.root={radius:8,strokeWidth:4,strokeColor:"#84CFFF",fontFamily:a.ay.Poppins,fontSize:20,fontWeight:a.IT.SemiBold,color:"--affine-black",filled:!0,fillColor:"--affine-white",padding:[11,22],shadow:{offsetX:0,offsetY:6,blur:12,color:"rgba(0, 0, 0, 0.14)"}}}_getColor(e){return this._colorOrders[e%this._colorOrders.length]}getNodeStyle(e,t){let i=this._getColor(t[1]??0);return{connector:{strokeStyle:a.u1.Solid,stroke:i,strokeWidth:3,mode:n.B1.Curve},node:{radius:8,strokeWidth:3,strokeColor:i,fontFamily:a.ay.Poppins,fontSize:16,fontWeight:a.IT.Medium,color:"--affine-black",filled:!0,fillColor:"--affine-white",padding:[6,22],shadow:{offsetX:0,offsetY:6,blur:12,color:"rgba(0, 0, 0, 0.14)"}}}}},d=new class extends l{constructor(){super(...arguments),this._colorOrders=["--affine-palette-shape-blue","#7ae2d5","--affine-palette-shape-yellow"],this.root={radius:3,strokeWidth:3,strokeColor:"--affine-black",fontFamily:a.ay.Poppins,fontSize:18,fontWeight:a.IT.SemiBold,color:"--affine-palette-shape-black",filled:!0,fillColor:"--affine-palette-shape-orange",padding:[11,22],shadow:{blur:0,offsetX:3,offsetY:3,color:"--affine-black"}}}_getColor(e){return e>=this._colorOrders.length?(0,o.HV)(this._colorOrders):this._colorOrders[e]}getNodeStyle(e,t){let i=this._getColor(t.length-2);return{connector:{strokeStyle:a.u1.Solid,stroke:"--affine-black",strokeWidth:3,mode:n.B1.Orthogonal},node:{radius:3,strokeWidth:3,strokeColor:"--affine-black",fontFamily:a.ay.Poppins,fontSize:16,fontWeight:a.IT.SemiBold,color:"--affine-palette-shape-black",filled:!0,fillColor:i,padding:[6,22],shadow:{blur:0,offsetX:3,offsetY:3,color:"--affine-black"}}}}},h=new class extends l{constructor(){super(...arguments),this._strokeColor=["--affine-palette-line-yellow","--affine-palette-line-green","--affine-palette-line-teal"],this.root={radius:10,strokeWidth:0,strokeColor:"transparent",fontFamily:a.ay.Poppins,fontSize:16,fontWeight:a.IT.Medium,color:"--affine-palette-shape-black",filled:!0,fillColor:"--affine-palette-shape-yellow",padding:[10,22],shadow:{blur:12,offsetX:0,offsetY:0,color:"rgba(66, 65, 73, 0.18)"}}}_getColor(e){return this._strokeColor[e%this._strokeColor.length]}getNodeStyle(e,t){let i=this._getColor(t.length-2);return{node:{radius:10,strokeWidth:0,strokeColor:"transparent",fontFamily:a.ay.Poppins,fontSize:16,fontWeight:a.IT.Medium,color:"--affine-palette-shape-black",filled:!0,fillColor:"--affine-palette-shape-white",padding:[6,22],shadow:{blur:12,offsetX:0,offsetY:0,color:"rgba(66, 65, 73, 0.18)"}},connector:{strokeStyle:a.u1.Solid,stroke:i,strokeWidth:2,mode:n.B1.Curve}}}},u=new class extends l{constructor(){super(...arguments),this._colors=["--affine-palette-shape-purple","--affine-palette-shape-magenta","--affine-palette-shape-orange","--affine-palette-shape-yellow","--affine-palette-shape-green","--affine-palette-shape-blue"],this.root={radius:0,strokeWidth:0,strokeColor:"transparent",fontFamily:a.ay.Kalam,fontSize:22,fontWeight:a.IT.Bold,color:"--affine-black",filled:!0,fillColor:"transparent",padding:[0,10]}}_getColor(e){return this._colors[e%this._colors.length]}getNodeStyle(e,t){let i=this._getColor(t[1]??0);return{connector:{strokeStyle:a.u1.Solid,stroke:i,strokeWidth:3,mode:n.B1.Curve},node:{...this.root,fontSize:18,padding:[1.5,10]}}}};!function(e){e[e.FOUR=4]="FOUR",e[e.ONE=1]="ONE",e[e.THREE=3]="THREE",e[e.TWO=2]="TWO"}(s||(s={}));let p={[s.ONE]:c,[s.TWO]:d,[s.THREE]:h,[s.FOUR]:u},f=(e,t,i=!1)=>{Object.entries(t).forEach(([t,i])=>{e.element[t]!==i&&(e.element[t]=i)}),i&&(0,r.hw)(e.element)}},39099:(e,t,i)=>{i.d(t,{IO:()=>s,PU:()=>l,S5:()=>c,SO:()=>n,_6:()=>o,d:()=>a,qV:()=>h,qj:()=>u,vt:()=>d});var s,o,r=i(60019);!function(e){e.Diamond="diamond",e.Ellipse="ellipse",e.Rect="rect",e.Triangle="triangle"}(s||(s={})),function(e){e[e.LARGE=28]="LARGE",e[e.MEDIUM=20]="MEDIUM",e[e.SMALL=12]="SMALL",e[e.XLARGE=36]="XLARGE"}(o||(o={}));let a=["--affine-palette-shape-yellow","--affine-palette-shape-orange","--affine-palette-shape-red","--affine-palette-shape-magenta","--affine-palette-shape-purple","--affine-palette-shape-blue","--affine-palette-shape-teal","--affine-palette-shape-green","--affine-palette-shape-black","--affine-palette-shape-grey","--affine-palette-shape-white"],n=a[0],l=(0,r.xK)(a),c=["--affine-palette-line-yellow","--affine-palette-line-orange","--affine-palette-line-red","--affine-palette-line-magenta","--affine-palette-line-purple","--affine-palette-line-blue","--affine-palette-line-teal","--affine-palette-line-green","--affine-palette-line-black","--affine-palette-line-grey","--affine-palette-line-white"],d=c[0],h=c[8],u=(0,r.xK)(c)},82936:(e,t,i)=>{i.d(t,{I9:()=>o,Lu:()=>r}),RegExp(`^[^A-Za-z\xc0-\xd6\xd8-\xf6\xf8-ʸ̀-֐ࠀ-῿Ⰰ-﬜﷾-﹯﻽-￿]*[\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]`);let s=function(){let e=null,t=null;return()=>(t||(e=(t=document.createElement("canvas")).getContext("2d")),e)}();function o(e){return e.replace(/\t/g," ").replace(/\r?\n|\r/g,"\n").split("\n")}function r(e,t){let i=s();return t!==i.font&&(i.font=t),i.measureText(e).width}},12194:(e,t,i)=>{i.d(t,{rj:()=>a.rj,J9:()=>d.J9,lw:()=>l.lw,Re:()=>l.Re,B1:()=>l.B1,F7:()=>l.F7,OM:()=>l.OM,TA:()=>a.TA,P1:()=>a.P1,$f:()=>c.$,AR:()=>h.AR,cy:()=>h.cy,hJ:()=>r.h,A4:()=>r.A,B5:()=>u.B5,lH:()=>a.lH,IO:()=>g.IO,u1:()=>a.u1,nz:()=>n.nz,n6:()=>p.n,qE:()=>w.qE,hw:()=>o.hw,TU:()=>b.TU,O3:()=>y.O3,e0:()=>w.e0,ql:()=>y.ql,qZ:()=>y.qZ,Lu:()=>f.Lu,R$:()=>w.R$,$4:()=>v.$,op:()=>w.op,Dx:()=>w.Dx,fp:()=>m.f,z:()=>w.z,dN:()=>s.d,_z:()=>b._z,Hb:()=>w.Hb,ct:()=>w.ct,DF:()=>w.DF});var s=i(70174),o=i(49210),r=i(64369),a=i(16019),n=i(31999);i(24434);var l=i(68192),c=i(26739),d=i(992),h=i(45598),u=i(40942),p=i(9441),f=i(82936),g=i(39099),m=i(86172);i(33503),i(60267),i(85755);var v=i(4536);i(11623),i(72674),i(40907);var y=i(61677),b=i(19057),w=i(11559)},18513:(e,t,i)=>{i.d(t,{BP:()=>b,IV:()=>T,ML:()=>v,SP:()=>m,TG:()=>$,Zv:()=>g});var s=i(31716),o=i(94098),r=i(96458),a=i(71006),n=i(62602),l=i(64369),c=i(68192),d=i(26739),h=i(40907),u=i(61677),p=i(75510),f=i(11559);let g=[[.5,0],[1,.5],[.5,1],[0,.5]],m=[[.5,0],[.75,.5],[.5,1],[.25,.5]];function v(e,t,i=g,o=Number.POSITIVE_INFINITY){let{x:r,y:a,w:n,h:l}=t;return i.map(e=>[r+e[0]*n,a+e[1]*l]).map(e=>(0,f.Cs)(t,e)).reduce((t,r,a)=>{let n=s.l.dist(e,r);if(nt.id===e.id))return!1;let{source:i,target:s}=e,o=t.find(e=>e.id===i?.id),r=t.find(e=>e.id===s?.id);return!i.id&&!s.id||!i.id&&!!r||!s.id&&!!o||!!o&&!!r}function w(e){let t=o.z.deserialize(e.xywh),i=[],s=e.rotate;return[[t.center[0],t.y-10],[t.center[0],t.maxY+10],[t.x-10,t.center[1]],[t.maxX+10,t.center[1]]].map(e=>(0,f.Cs)({...t,rotate:s},e)).forEach(o=>{let r=e.getLineIntersections(t.center,o);(0,a.Z1)(r);let n=(0,f.Cs)({...t,rotate:-s},r[0]);i.push({point:r[0],coord:t.toRelative(n)})}),i}function x(e,t){return function(e,t){let i=e.map(e=>({p:e,d:s.l.dist(e,t)}));return i.sort((e,t)=>e.d-t.d),i[0].p}(w(e).map(e=>e.point),t)}function _(e){return[Number(e[0].toFixed(2)),Number(e[1].toFixed(2)),e[2]??0]}function C(e,t){return e.filter(e=>!t||!t.isPointInBound(e))}function k(e,t,i=0){e.push(...t.map(e=>[...e,i]))}function S(e,t,i,s=0){let o=(0,f.$B)(t[0],t[1],i[0],i[1],!0);o&&k(e,[o],s)}function M(e,t,i,s,o){if(t.maxX{S(e,t,[[r,0],[r,1]],0===i||1===i?6:3)})}if(t.maxY{S(e,t,[[0,r],[1,r]],0===i||1===i?6:3)})}}function E(e,t,i,o,r,a){if((0,f.f3)(t[1],i.y,.02)||(0,f.f3)(t[1],i.maxY,.02)){let n=[i.upperLine,i.lowerLine,o.upperLine,o.lowerLine].map(e=>(0,f.$B)(t,[t[0],t[1]+1],e[0],e[1],!0));n.sort((e,t)=>e[1]-t[1]);let l=s.l.lrp(n[1],n[2],.5);k(e,[l],6),[r.leftLine,r.rightLine,a.leftLine,a.rightLine].forEach(t=>{S(e,[l,[l[0]+1,l[1]]],t,0)})}else{let n=[i.leftLine,i.rightLine,o.leftLine,o.rightLine].map(e=>(0,f.$B)(t,[t[0]+1,t[1]],e[0],e[1],!0));n.sort((e,t)=>e[0]-t[0]);let l=s.l.lrp(n[1],n[2],.5);k(e,[l],6),[r.upperLine,r.lowerLine,a.upperLine,a.lowerLine].forEach(t=>{S(e,[l,[l[0],l[1]+1]],t,0)})}}function I(e,t,i=10,o=10,r=10,n=10){let l=Array.from(t);if((0,f.f3)(e.x,l[0]))l[0]-=i;else if((0,f.f3)(e.y,l[1]))l[1]-=o;else if((0,f.f3)(e.maxX,l[0]))l[0]+=r;else if((0,f.f3)(e.maxY,l[1]))l[1]+=n;else{let r=s.l.normalize(s.l.sub(l,e.center)),n=r[0]>0?1:-1,c=r[1]>0?1:-1;if(0==(Math.abs(t.tangent[0])0){let t=(0,f.$B)(e.rightLine[0],e.rightLine[1],l,[e.maxX+10,l[1]]);(0,a.Z1)(t),l[0]=t[0]+i}else{let t=(0,f.$B)(e.leftLine[0],e.leftLine[1],l,[e.x-10,l[1]]);(0,a.Z1)(t),l[0]=t[0]-i}}else if(c>0){let t=(0,f.$B)(e.lowerLine[0],e.lowerLine[1],l,[l[0],e.maxY+10]);(0,a.Z1)(t),l[1]=t[1]+o}else{let t=(0,f.$B)(e.upperLine[0],e.upperLine[1],l,[l[0],e.y-10]);(0,a.Z1)(t),l[1]=t[1]-o}}return l}function B(e,t,i,s){let{x:o,y:r,w:a,h:n}=t;e.save(),e.beginPath(),e.strokeStyle=i,e.lineWidth=s,e.setLineDash([2*s,2*s]),e.strokeRect(o,r,a,n),e.closePath(),e.restore()}class $ extends l.h{constructor(e){super(),this._service=e,this.highlightPoint=null,this.points=[],this.sourceBounds=null,this.targetBounds=null}_clearRect(){this.points=[],this.highlightPoint=null,this._renderer?.refresh()}_findConnectablesInViews(){let e=this._service,t=this._service.viewport.viewportBounds;return e.pickElementsByBound(t).filter(e=>e.connectable)}clear(){this.sourceBounds=null,this.targetBounds=null,this._clearRect()}render(e){let t=this._service.viewport.zoom,i=5/t,s=getComputedStyle(this._service.host).getPropertyValue("--affine-text-emphasis-color");e.globalAlpha=.6;let o=1/t;this.sourceBounds&&B(e,this.sourceBounds,s,o),this.targetBounds&&B(e,this.targetBounds,s,o),o=2/t,this.points.forEach(t=>{e.beginPath(),e.arc(t[0],t[1],i,0,f.uA),e.fillStyle="white",e.strokeStyle=s,e.lineWidth=o,e.fill(),e.stroke(),e.closePath()}),e.globalAlpha=1,this.highlightPoint&&(e.beginPath(),e.arc(this.highlightPoint[0],this.highlightPoint[1],i,0,f.uA),e.fillStyle=s,e.strokeStyle=s,e.lineWidth=o,e.fill(),e.stroke(),e.closePath())}renderConnector(e,t=[]){let i;let r=this._findConnectablesInViews(),a=this._service;this._clearRect();let n=null;for(let l=0;le.point);ms.l.dist(v,e)){this.highlightPoint=v;let e=(0,f.Cs)(y(c,!0),v);this._renderer?.refresh(),i=c,n={id:c.id,position:d.toRelative(e).map(e=>(0,f.qE)(e,0,1))}}if(n)break;c.includesPoint(e[0],e[1],{ignoreTransparent:!1},this._service.host)&&(i=c,n={id:c.id})}return i instanceof d.$?this.targetBounds=o.z.deserialize(i.xywh):this.targetBounds=null,n||(n={position:e}),this._renderer?.refresh(),n}}class T{constructor(e){this.options=e,this._aStarRunner=null}_computeStartEndPoint(e){let t,i;let{source:o,target:n}=e,l=this._getConnectorEndElement(e,"source"),c=this._getConnectorEndElement(e,"target");if(o.id&&!o.position&&n.id&&!n.position){(0,a.Z1)(l),(0,a.Z1)(c);let e=w(l),o=w(c),n=1/0,d=new r.S,h=new r.S;for(let t of e)for(let e of o){let i=s.l.dist(t.point,e.point);i+.1new r.S(e))}if(t===c.B1.Curve)return this._generateCurveConnectorPath(e);throw Error("unknown connector mode")}_generateCurveConnectorPath(e){let{source:t,target:i}=e;if(t.id||i.id){let r,a;if(t.position||i.position)r=this._getConnectionPoint(e,"source"),a=this._getConnectionPoint(e,"target");else{let t=this._getConnectorEndElement(e,"source"),i=this._getConnectorEndElement(e,"target"),s=o.z.deserialize(t.xywh);r=x(t,o.z.deserialize(i.xywh).center),a=x(i,s.center)}if(t.id){let e=s.l.rot(r.tangent,-Math.PI/2);r.out=s.l.mul(e,Math.max(100,Math.abs(s.l.pry(s.l.sub(a,r),e))/3))}if(i.id){let e=s.l.rot(a.tangent,-Math.PI/2);a.in=s.l.mul(e,Math.max(100,Math.abs(s.l.pry(s.l.sub(r,a),e))/3))}return[r,a]}{let t=this._getConnectionPoint(e,"target"),i=this._getConnectionPoint(e,"source");return Math.abs(t[0]-i[0])>Math.abs(t[1]-i[1])?(i.out=[s.l.mul(s.l.sub(t,i),2/3)[0],0],t.in=[s.l.mul(s.l.sub(i,t),2/3)[0],0]):(i.out=[0,s.l.mul(s.l.sub(t,i),2/3)[1]],t.in=[0,s.l.mul(s.l.sub(i,t),2/3)[1]]),[i,t]}}_generateStraightConnectorPath(e){let{source:t,target:i}=e;if(t.id&&!t.position&&i.id&&!i.position){let t=this._getConnectorEndElement(e,"source"),i=this._getConnectorEndElement(e,"target"),s=o.z.deserialize(t.xywh);return[x(t,o.z.deserialize(i.xywh).center),x(i,s.center)]}{let t=this._getConnectionPoint(e,"target"),i=this._getConnectionPoint(e,"source");return(i&&t&&[i,t])??[]}}_getConnectionPoint(e,t){let i=e[t];if(!i.id)return(0,a.Z1)(i.position),r.S.fromVec(i.position);{let o=this._getConnectorEndElement(e,t);return((0,a.Z1)(o),i.position)?function(e,t){let i=e.getRelativePointLocation(t);return(0,f.Lo)(s.l.sub(t,[0,.5]))?i.tangent=s.l.rot([0,-1],(0,f.DF)(e.rotate)):(0,f.Lo)(s.l.sub(t,[1,.5]))?i.tangent=s.l.rot([0,1],(0,f.DF)(e.rotate)):(0,f.Lo)(s.l.sub(t,[.5,0]))?i.tangent=s.l.rot([1,0],(0,f.DF)(e.rotate)):(0,f.Lo)(s.l.sub(t,[.5,1]))&&(i.tangent=s.l.rot([-1,0],(0,f.DF)(e.rotate))),i}(o,i.position):x(o,this._getConnectionPoint(e,"source"===t?"target":"source"))}}_getConnectorEndElement(e,t){let i=e[t].id;return i?this.options.getElementById(i):null}_prepareOrthogonalConnectorInfo(e){let{startBound:t,endBound:i,startPoint:o,endPoint:r}=e,[a,n]=function(e,t){let i;let o=[20,20,20,20],r=[20,20,20,20];if(!(e&&t))return[o,r];let a=(0,f.s5)(e.upperLine,t.lowerLine,0,!1);return a&&e.upperLine[0][1]>t.lowerLine[0][1]&&(i=s.l.distanceToLineSegment(e.upperLine[0],e.upperLine[1],t.lowerLine[0],!1),o[1]=Math.max(Math.min(i/2,o[1]),0)),(a=(0,f.s5)(e.rightLine,t.leftLine,1,!1))&&e.rightLine[0][0]{S(p,e,h.leftLine,0),S(p,e,h.rightLine,0)}),[l.leftLine,l.verticalLine,l.rightLine,c.leftLine,c.verticalLine,c.rightLine].forEach(e=>{S(p,e,h.upperLine,0),S(p,e,h.lowerLine,0)}))}r&&n&&((0,a.Z1)(l),(0,a.Z1)(c),E(u,e,r,n,l,c),E(u,t,n,r,c,l),M(u,r,n,l,c),M(u,n,r,c,l)),l&&(k(u,l.getVerticesAndMidpoints()),k(u,l.include(s).points)),c&&(k(u,c.getVerticesAndMidpoints()),k(u,c.include(i).points));let g=(u=function(e){(e=e.map(_)).sort((e,t)=>e[0]-t[0]),(0,a.j)(e);for(let t=1;te[1]-t[1]);for(let t=1;te[0]t[0]?1:e[1]t[1]?1:0);for(let t=1;te[0]+","+e[1]).sort();g.forEach((e,t)=>{if(0!==t&&e===g[t-1])throw Error("duplicate point")});let m=[i,s].map(e=>u.find(t=>(0,f.f3)(t[0],e[0],.02)&&(0,f.f3)(t[1],e[1],.02)));return(0,a.Z1)(m[0]),(0,a.Z1)(m[1]),{points:u,nextStartPoint:m[0],lastEndPoint:m[1]}}(d,h,u,p,r,n,l,c),m=g.points;return u=g.nextStartPoint,p=g.lastEndPoint,[C(C(m,l?.expand(-1)??null),c?.expand(-1)??null),d,h,u,p]}(i,r,l,c,d,u,p,g),b=y[0],[,w,x,I,B]=y;!function(e,t,i=null,s=null){s||(Math.abs(t[0]-e[0])>Math.abs(t[1]-e[1])?t[0]+=20*(0,f._S)(t[0]-e[0]):t[1]+=20*(0,f._S)(t[1]-e[1])),i||(Math.abs(t[0]-e[0])>Math.abs(t[1]-e[1])?e[0]-=20*(0,f._S)(t[0]-e[0]):e[1]-=20*(0,f._S)(t[1]-e[1]))}(w,x,d,u),this._aStarRunner=new h.w(b,I,B,w,x,m,v),this._aStarRunner.run();let $=this._aStarRunner.path;return u||$.pop(),d||$.shift(),function(e){if(0===e.length)return[];let t=[[e[0][0],e[0][1]]];for(let i=1;ie.setVec(s.l.sub(e,[o.x,o.y])));if(e.updatingPath=!0,e.xywh=o.serialize(),e.path=r,(0,c.yp)(e)){let[t,i]=e.getPointByOffsetDistance(e.labelOffset.distance),[,,s,o]=e.labelXYWH;e.labelXYWH=[t-s/2,i-o/2,s,o]}e.updatingPath=!1}}},9292:(e,t,i)=>{i.d(t,{T:()=>b});var s=i(94098),o=i(69050),r=i(50620),a=i(71006),n=i(3471),l=i(62602),c=i(92820),d=i(33096),h=i(96448),u=i(31999),p=i(16019),f=i(66397),g=i(11559);function m(e){return Math.ceil(e/p.VF)-1}function v(e){e.rotate&&(e=(0,g.e0)(e));let t=m(e.x);return[t,m(e.x+e.w),m(e.y),m(e.y+e.h)]}class y{constructor(){this._elementToGrids=new Map,this._externalElementToGrids=new Map,this._externalGrids=new Map,this._grids=new Map}_addToExternalGrids(e){let t=function(e){if(!e.externalXYWH)return null;let t=s.z.deserialize(e.externalXYWH),i=m(t.x);return[i,m(t.maxX),m(t.y),m(t.maxY)]}(e);if(!t){this._removeFromExternalGrids(e);return}let[i,o,r,a]=t,n=new Set;this._externalElementToGrids.set(e,n);for(let t=i;t<=o;t++)for(let i=r;i<=a;i++){let s=this._getExternalGrid(t,i);s||(s=this._createExternalGrid(t,i)),s.add(e),n.add(s)}}_createExternalGrid(e,t){let i=new Set;return this._externalGrids.set(e+"|"+t,i),i}_createGrid(e,t){let i=new Set;return this._grids.set(e+"|"+t,i),i}_getExternalGrid(e,t){return this._externalGrids.get(e+"|"+t)}_getGrid(e,t){return this._grids.get(e+"|"+t)}_removeFromExternalGrids(e){let t=this._externalElementToGrids.get(e);if(t)for(let i of t)i.delete(e)}_searchExternal(e,t=!1){let[i,o,r,a]=v(e),n=new Set,l=s.z.from(e);for(let s=i;s<=o;s++)for(let i=r;i<=a;i++){let o=this._getExternalGrid(s,i);if(o)for(let i of o){let s=i.externalBound;s&&(t?l.contains(s):(0,g.HY)(s,e))&&n.add(i)}}return n}add(e){this._addToExternalGrids(e);let[t,i,s,o]=function(e){let t=e.elementBound,i=m(t.x);return[i,m(t.maxX),m(t.y),m(t.maxY)]}(e),r=new Set;this._elementToGrids.set(e,r);for(let a=t;a<=i;a++)for(let t=s;t<=o;t++){let i=this._getGrid(a,t);i||(i=this._createGrid(a,t)),i.add(e),r.add(i)}}boundHasChanged(e,t){let[i,s,o,r]=v(e),[a,n,l,c]=v(t);return i!==a||s!==n||o!==l||r!==c}has(e,t=!1,i=!1,o){let[r,a,n,l]=v(e),c=s.z.from(e),d=i?e=>t?e.contains(c):(0,g.HY)(c,e):e=>t?c.contains(e):(0,g.HY)(e,c);for(let e=r;e<=a;e++)for(let t=n;t<=l;t++){let i=this._getGrid(e,t);if(i){for(let e of i)if(!o?.has(e)&&d(e.elementBound))return!0}}return!1}pick(e,t){let i=m(e),o=m(t),r=this._getGrid(i,o);if(!r)return[];let a=[];for(let i of r)(0,g.Sp)((0,g.e0)(s.z.deserialize(i.xywh)),e,t)&&a.push(i);return a}remove(e){let t=this._elementToGrids.get(e);if(t)for(let i of t)i.delete(e);this._removeFromExternalGrids(e)}search(e,t=!1,i=!1){let o=this._searchExternal(e,t),[r,a,n,l]=v(e),c=s.z.from(e);for(let i=r;i<=a;i++)for(let s=n;s<=l;s++){let r=this._getGrid(i,s);if(r)for(let i of r)(t?c.contains(i.elementBound):(0,g.HY)(i.elementBound,e))&&o.add(i)}return i?o:Array.from(o).sort(f.UD)}update(e){this.remove(e),this.add(e)}get isEmpty(){return 0===this._grids.size}}class b{static{this.INITAL_INDEX="a0"}constructor(e,t){this._doc=e,this._surface=t,this._disposables=new o.K,this.blocks=[],this.blocksGrid=new y,this.canvasElements=[],this.canvasGrid=new y,this.canvasLayers=[],this.frames=[],this.framesGrid=new y,this.layers=[],this.slots={layerUpdated:new r.D},this._reset()}static create(e,t){let i=new b(e,t);return i.listen(e,t),i}_buildCanvasLayers(){let e=this.layers.filter(e=>"canvas"===e.type).map(e=>({set:e.set,elements:e.elements,zIndex:e.zIndex,indexes:e.indexes}));e.length&&l.HV(this.layers)?.type==="canvas"||e.push({set:new Set,elements:[],zIndex:0,indexes:[b.INITAL_INDEX,b.INITAL_INDEX]}),this.canvasLayers=e}_getModelType(e){return"flavour"in e?"block":"canvas"}_initLayers(){let e,t=0,i=0,o=[],r=1,n=()=>{e&&(e.indexes=[(0,f.HY)(e.elements[0]),(0,f.HY)((0,l.HV)(e.elements))],e.zIndex=r,o.push(e),r+="block"===e.type?e.elements.length:1)},c=t=>{n(),e="canvas"===t?{type:t,indexes:[b.INITAL_INDEX,b.INITAL_INDEX],zIndex:0,set:new Set,elements:[],bound:new s.z}:{type:t,indexes:[b.INITAL_INDEX,b.INITAL_INDEX],zIndex:0,set:new Set,elements:[]}};for(;te.set.add(t));break}if(!o){e?.type!=="block"&&c("block"),(0,a.j)(e);let i=this.blocks.slice(t);e.elements=e.elements.concat(i),i.forEach(t=>e.set.add(t));break}switch((0,f.UD)(s,o)){case -1:e?.type!=="block"&&c("block"),(0,a.j)(e),e.set.add(s),e.elements.push(s),++t;break;case 1:e?.type!=="canvas"&&c("canvas"),(0,a.j)(e),e.set.add(o),e.elements.push(o),++i;break;case 0:e||c("block"),"block"===e.type?(e.set.add(s),e.elements.push(s),++t):(e.set.add(o),e.elements.push(o),++i)}}e&&e.elements.length&&n(),this.layers=o}_insertIntoLayer(e,t){if(0===this.layers.length){this._initLayers();return}let i=this.layers,s=i.length-1,o=(e,t,i)=>{(0,a.j)(e),(0,a.j)(t),"tail"===i?e.elements.push(t):e.elements.splice(i,0,t),e.set.add(t),("tail"===i||0===i||i===e.elements.length-1)&&(e.indexes=[(0,f.HY)(e.elements[0]),(0,f.HY)((0,l.HV)(e.elements))])},r=(e,t,i)=>({type:e,set:new Set(t),indexes:[(0,f.HY)(t[0]),(0,f.HY)((0,l.HV)(t))],zIndex:i+1,elements:t});if([f.xB.AFTER,f.xB.SAME].includes((0,f.UD)(e,(0,l.HV)((0,l.HV)(this.layers).elements)))){let a=(0,l.HV)(this.layers);a?.type===t?(o(a,e,"tail"),(0,f.a4)(i,s)):this.layers.push(r(t,[e],(0,f.Bj)(i,i.length-1)))}else for(;s>-1;){let a=i[s],n=a.elements;if((0,f.h$)([n[0],(0,l.HV)(n)],e)){let l=n.findIndex((t,i)=>{let s=n[i-1];return 0>(0,f.UD)(e,n[i])&&(!s||(0,f.UD)(e,s)>=0)});if(a.type===t)o(a,e,l),(0,f.a4)(i,s);else{let o=a.elements.splice(l);a.set=new Set(a.elements),i.splice(s+1,0,r(a.type,o,1)),i.splice(s+1,0,r(t,[e],1)),(0,f.a4)(i,s)}break}{let n=i[s-1];if(!n||(0,f.UD)(e,(0,l.HV)(n.elements))>=0){a.type===t?(o(a,e,0),(0,f.a4)(i,s)):n?(o(n,e,"tail"),(0,f.a4)(i,s-1)):(i.unshift(r(t,[e],1)),(0,f.a4)(i,0));break}}--s}}_removeFromLayer(e,t){let i=this.layers,s=i.findIndex(i=>i.type===t&&((0,a.j)(i),(0,a.j)(e),!!i.set.has(e)&&(i.set.delete(e),-1!==i.elements.indexOf(e)&&(i.elements.splice(i.elements.indexOf(e),1),i.elements.length&&(i.indexes=[(0,f.HY)(i.elements[0]),(0,f.HY)((0,l.HV)(i.elements))])),!0)));if(-1===s)return;let o=0===s||s===i.length-1;if(0===i[s].set.size){if(o)i.splice(s,1),i[s]&&(0,f.a4)(i,s);else{let e=i[s-1],t=i[s+1];e.elements=e.elements.concat(t.elements),e.set=new Set(e.elements),i.splice(s,2),(0,f.a4)(i,s-1)}return}(0,f.a4)(i,s)}_reset(){let e=this._doc.getBlocks().filter(e=>e instanceof h.y&&(0,f.eZ)(this._doc,this._surface,e)).concat(this._surface?.elementModels??[]);this.canvasElements=[],this.blocks=[],this.frames=[],e.forEach(e=>{e instanceof u.nz?(this.canvasElements.push(e),this.canvasGrid.add(e)):(0,c.o)(e,["affine:frame"])?(this.framesGrid.add(e),this.frames.push(e)):(this.blocksGrid.add(e),this.blocks.push(e))}),this.canvasElements.sort(f.UD),this.frames.sort(f.UD),this.blocks.sort(f.UD),this._initLayers(),this._buildCanvasLayers()}_updateLayer(e,t){let i;let s="flavour"in e?e.flavour:e.type,o=!t||"index"in t,r=t&&"childIds"in t,a=("group"===s||e instanceof u.$b)&&(o||r),n=(e,t)=>{o&&((0,f.Ps)(e,t),(0,f.hB)(e,t))};return a?(this._reset(),!0):(s.startsWith("affine:")?(0,c.o)(e,["affine:frame"])?(n(this.frames,e),this.framesGrid.update(e)):(i="block",n(this.blocks,e),this.blocksGrid.update(e)):(i="canvas",n(this.canvasElements,e),this.canvasGrid.update(e)),!!i&&(!!o||!!r)&&(this._removeFromLayer(e,i),this._insertIntoLayer(e,i),!0))}listen(e,t){this._disposables.add(e.slots.blockUpdated.on(i=>{if("add"===i.type){let s=e.getBlockById(i.id);s instanceof h.y&&(0,f.eZ)(e,t,s)&&-1===this.blocks.indexOf(s)&&this.add(s)}if("update"===i.type){let s=e.getBlockById(i.id);("index"===i.props.key||"xywh"===i.props.key&&s instanceof h.y&&(0,f.eZ)(e,t,s))&&this.update(s,{[i.props.key]:!0})}if("delete"===i.type){let t=e.getBlockById(i.id);t instanceof h.y&&this.delete(t)}})),this._disposables.add(t.elementAdded.on(e=>this.add(t.getElementById(e.id)))),this._disposables.add(t.elementUpdated.on(e=>{(e.props.index||e.props.xywh||e.props.externalXYWH||e.props.childIds)&&this.update(t.getElementById(e.id),e.props)})),this._disposables.add(t.elementRemoved.on(e=>this.delete(e.model)))}add(e){let t;let i="flavour"in e?e.flavour:e.type,s="group"===i||e instanceof u.$b;i.startsWith("affine:")?(0,c.o)(e,["affine:frame"])?((0,f.hB)(this.frames,e),this.framesGrid.add(e)):(t="block",(0,f.hB)(this.blocks,e),this.blocksGrid.add(e)):(t="canvas",s&&e.childElements.forEach(e=>{e&&"canvas"===this._getModelType(e)&&(0,f.Ps)(this.canvasElements,e)}),(0,f.hB)(this.canvasElements,e),this.canvasGrid.add(e)),t&&(this._insertIntoLayer(e,t),s&&e.childElements.forEach(e=>e&&this._updateLayer(e)),this._buildCanvasLayers(),this.slots.layerUpdated.emit({type:"add",initiatingElement:e}))}compare(e,t){return(0,f.UD)(e,t)}createIndexGenerator(e=!1){let t=new b(this._doc,this._surface);return i=>{e&&"affine:frame"!==i&&(i="shape");let o=t.generateIndex(i),r=new s.z(0,0,10,10);"group"===i&&(i="shape");let a={index:o,flavour:i,x:0,y:0,w:10,h:10,elementBound:r,xywh:"[0, 0, 10, 10]",get group(){return null},get groups(){return[]}};return t.add(a),o}}delete(e){let t;if(e instanceof u.$b){this._reset(),this.slots.layerUpdated.emit({type:"delete",initiatingElement:e});return}e instanceof u.nz?(t="canvas",(0,f.Ps)(this.canvasElements,e),this.canvasGrid.remove(e)):(0,c.o)(e,["affine:frame"])?((0,f.Ps)(this.frames,e),this.framesGrid.remove(e)):(t="block",(0,f.Ps)(this.blocks,e),this.blocksGrid.remove(e)),t&&(this._removeFromLayer(e,t),this._buildCanvasLayers(),this.slots.layerUpdated.emit({type:"delete",initiatingElement:e}))}dispose(){this.slots.layerUpdated.dispose(),this._disposables.dispose()}generateIndex(e){let t="affine:frame"===e?"frame":"common",i=e.startsWith("affine:")?"block":"canvas";if("frame"===t){let e=(0,l.HV)(this.frames);return e?(0,n.TU)((0,f.Jr)((0,f.HY)(e)),null):b.INITAL_INDEX}{if("canvas"===i){let e=l.HV(this.layers)?.indexes[1];return e?(0,n.TU)((0,f.Jr)(e),null):b.INITAL_INDEX}let e=(0,l.HV)(this.layers);if(!e)return b.INITAL_INDEX;if((0,a.j)(e),"canvas"===e.type){let t=(0,l.E7)(this.layers,2),i=t?(0,f.Jr)(t.indexes[1]):null,s=(0,f.Jr)(e.indexes[0]);return(0,n.TU)(i,i&&i>=s?null:s)}return(0,n.TU)(e.indexes[1],null)}}getCanvasLayers(){return this.canvasLayers}getReorderedIndex(e,t){let i;let s=e.group||null,o="affine:frame"===e.flavour;null!==s?(i=s.childElements.filter(e=>e?.flavour==="affine:frame"===o)).sort(f.UD):i=o?this.frames:this.layers.reduce((e,t)=>e.concat(t.elements.filter(e=>null==e.group)),[]);let r=i.indexOf(e);switch(t){case"forward":case"front":if(-1===r||r===i.length-1)return e.index;{let e="forward"===t?i[r+1]:i[i.length-1],s="forward"===t?i[r+2]:null;return(0,n.TU)(e.index,s?.index&&e.index=e.index?null:s.index,e.index)}}}getZIndex(e){if(e instanceof d.K)return this.frames.indexOf(e)-this.frames.length;let t=this.layers.find(t=>t.set.has(e));return t?t.zIndex+t.elements.indexOf(e):-1}update(e,t){this._updateLayer(e,t)&&(this._buildCanvasLayers(),this.slots.layerUpdated.emit({type:"update",initiatingElement:e}))}}},66397:(e,t,i)=>{i.d(t,{Bj:()=>a,HY:()=>l,Jr:()=>c,Ps:()=>h,UD:()=>f,a4:()=>n,eZ:()=>p,h$:()=>u,hB:()=>d,xB:()=>s});var s,o=i(62602),r=i(31999);function a(e,t){let i=e[t];return i?"block"===i.type?i.zIndex+i.elements.length-1:i.zIndex:1}function n(e,t){let i=e[t].zIndex;for(let s=t;se.index).reverse().join("-");return`${i}-${e.index}`}return e.index}function c(e){return e.split("-")[0]}function d(e,t){let i=0;for(;i=0&&0>f(t,e[1])}function p(e,t,i){let s=e.getParent(i);return s===e.root||s===t}function f(e,t){if(e instanceof r.$b&&e.hasDescendant(t))return s.BEFORE;if(t instanceof r.$b&&t.hasDescendant(e))return s.AFTER;{let i=e.groups,r=t.groups,a=1,n=(0,o.E7)(i,a),l=(0,o.E7)(r,a);for(;n===l&&n;)++a,n=(0,o.E7)(i,a),l=(0,o.E7)(r,a);return n=n??e,l=l??t,n.index===l.index?s.SAME:n.index{i.d(t,{i:()=>k,f:()=>S});var s=i(7595),o=i(64816),r=i(73711),a=i(91449),n=i(4564),l=i(22805),c=i(54719),d=i(80650),h=i(69849),u=i(54074),p=i(33503),f=i(3874),g=i(7770),m=i(72674),v=i(60267);let y=[{schema:g.x,service:v.G,view:{component:(0,f.eu)`mini-mindmap-root-block`}},{schema:m.Y,view:{component:(0,f.eu)`mini-mindmap-surface-block`}}],b=[g.x,m.Y];var w=i(85755),x=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},_=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,o,d,h,p,f,g,m=[(0,n.EM)("mini-mindmap-preview")],v=[],w=(0,s.Tm)(a.WF),k=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],P=[],H=[],A=[],L=[],D=[],Z=[];return class extends w{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(w[Symbol.metadata]??null):void 0;i=[(0,n.MZ)({attribute:!1})],o=[(0,n.MZ)({attribute:!1})],d=[(0,n.MZ)({attribute:!1})],h=[(0,n.MZ)({attribute:!1})],p=[(0,n.MZ)({attribute:!1})],f=[(0,n.P)("editor-host")],g=[(0,n.MZ)({attribute:!1})],x(this,null,i,{kind:"accessor",name:"answer",static:!1,private:!1,access:{has:e=>"answer"in e,get:e=>e.answer,set:(e,t)=>{e.answer=t}},metadata:s},k,M),x(this,null,o,{kind:"accessor",name:"ctx",static:!1,private:!1,access:{has:e=>"ctx"in e,get:e=>e.ctx,set:(e,t)=>{e.ctx=t}},metadata:s},E,I),x(this,null,d,{kind:"accessor",name:"height",static:!1,private:!1,access:{has:e=>"height"in e,get:e=>e.height,set:(e,t)=>{e.height=t}},metadata:s},B,$),x(this,null,h,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:s},T,O),x(this,null,p,{kind:"accessor",name:"mindmapStyle",static:!1,private:!1,access:{has:e=>"mindmapStyle"in e,get:e=>e.mindmapStyle,set:(e,t)=>{e.mindmapStyle=t}},metadata:s},P,H),x(this,null,f,{kind:"accessor",name:"portalHost",static:!1,private:!1,access:{has:e=>"portalHost"in e,get:e=>e.portalHost,set:(e,t)=>{e.portalHost=t}},metadata:s},A,L),x(this,null,g,{kind:"accessor",name:"templateShow",static:!1,private:!1,access:{has:e=>"templateShow"in e,get:e=>e.templateShow,set:(e,t)=>{e.templateShow=t}},metadata:s},D,Z),x(null,e={value:t},m,{kind:"class",name:t.name,metadata:s},null,v),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,a.AH)` mini-mindmap-root-block, mini-mindmap-surface-block, editor-host { display: block; width: 100%; height: 100%; } .select-template-title { align-self: stretch; color: var( --light-textColor-textSecondaryColor, var(--textColor-textSecondaryColor, #8e8d91) ); font-family: Inter; font-size: 12px; font-style: normal; font-weight: 500; line-height: 20px; margin-bottom: 4px; } .template { display: flex; gap: 12px; } .template-item { box-sizing: border-box; border: 2px solid var(--affine-border-color); border-radius: 4px; padding: 4px 6px; } .template-item.active, .template-item:hover { border-color: var(--affine-brand-color); } .template-item > svg { display: block; } `}_createTemporaryDoc(){let e=new r.Sj;e.register(b);let t={id:"MINI_MINDMAP_TEMPORARY",schema:e,idGenerator:r.jH.NanoID,awarenessSources:[]},i=new r.rl(t);i.meta.initialize(),i.start();let s=i.createDoc({id:"doc:home"}).load(),o=s.addBlock("affine:page",{}),a=s.addBlock("affine:surface",{},o),n=s.getBlockById(a);return s.resetHistory(),{doc:s,surface:n}}get _mindmap(){return this.surface?.getElementById(this.mindmapId||"")??null}_switchStyle(e){this._mindmap&&this.doc&&(this.doc.transact(()=>{this._mindmap.style=e}),this.ctx.set({...this.ctx.get(),style:e}),this.requestUpdate())}_toMindmapNode(e,t){return S(e,t)}connectedCallback(){super.connectedCallback();let e=this._createTemporaryDoc(),t=this._toMindmapNode(this.answer,e.doc);if(!t)return;this.doc=e.doc,this.surface=e.surface,this.mindmapId=this.surface.addElement({type:"mindmap",children:t,style:this.mindmapStyle??u.cy.FOUR});let i=this._mindmap?.tree.element.xywh;this.ctx.set({node:t,style:u.cy.FOUR,centerPosition:i})}render(){if(!this.doc||!this.surface||!this._mindmap)return a.s6;let e=this._mindmap.style;return(0,a.qy)`
    ${this.host.renderSpecPortal(this.doc,y)}
    ${this.templateShow?(0,a.qy)`
    Select template
    ${(0,l.u)(C,([e])=>e,([t,i])=>(0,a.qy)`
    this._switchStyle(t)} > ${i}
    `)}
    `:a.s6}
    `}#cE=_(this,k,void 0);get answer(){return this.#cE}set answer(e){this.#cE=e}#cI=(_(this,M),_(this,E,void 0));get ctx(){return this.#cI}set ctx(e){this.#cI=e}#iU=(_(this,I),_(this,B,400));get height(){return this.#iU}set height(e){this.#iU=e}#n=(_(this,$),_(this,T,void 0));get host(){return this.#n}set host(e){this.#n=e}#rL=(_(this,O),_(this,P,void 0));get mindmapStyle(){return this.#rL}set mindmapStyle(e){this.#rL=e}#cB=(_(this,H),_(this,A,void 0));get portalHost(){return this.#cB}set portalHost(e){this.#cB=e}#c$=(_(this,L),_(this,D,!0));get templateShow(){return this.#c$}set templateShow(e){this.#c$=e}constructor(){super(...arguments),_(this,Z)}static{_(t,v)}},t})(),S=(e,t)=>{let i=null,s=new r._O({collection:t.collection}),o=new d.F(s)._markdownToAst(e),a=(e,t=!1)=>{switch(e.type){case"list":{let i=e.children.map(e=>a(e)).filter(e=>e);if(t)return i[0]}break;case"listItem":{let t=e.children[0],i=e.children[1],s={text:"",children:[]};return t?.type==="paragraph"&&t.children[0]?.type==="text"&&(s.text=t.children[0].value),i?.type==="list"&&(s.children=i.children.map(e=>a(e)).filter(e=>e)),s}}return null};return o?.children?.[0]?.type==="list"&&(i=a(o.children[0],!0)),i}},33503:(e,t,i)=>{i.d(t,{e:()=>l});var s=i(7595),o=i(91449),r=i(4564),a=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},n=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,r.EM)("mini-mindmap-root-block")],l=[],c=s.p_;return class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;a(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),n(t,l)}render(){return(0,o.qy)`
    ${this.host.renderChildren(this.model)}
    `}},t})()},60267:(e,t,i)=>{i.d(t,{G:()=>r});var s=i(7595),o=i(73711);class r extends s.ps{constructor(){super(...arguments),this.requestCenter=new o.DX}center(){this.requestCenter.emit()}mounted(){}}},85755:(e,t,i)=>{i.d(t,{n:()=>p});var s=i(7595),o=i(91449),r=i(4564),a=i(66050),n=i(99621),l=i(49210),c=i(64369),d=i(9292),h=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},u=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,r.EM)("mini-mindmap-surface-block")],p=[],f=s.p_,g=[],m=[];return class extends f{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;h(this,null,[(0,r.P)(".affine-mini-mindmap-surface")],{kind:"accessor",name:"editorContainer",static:!1,private:!1,access:{has:e=>"editorContainer"in e,get:e=>e.editorContainer,set:(e,t)=>{e.editorContainer=t}},metadata:s},g,m),h(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,p),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),u(t,p)}constructor(){super(),u(this,m),this._viewport=new n.LM}_adjustNodeWidth(){this.model.doc.transact(()=>{this.model.elementModels.forEach(e=>{"shape"===e.type&&(0,l.hw)(e)})})}_resizeEffect(){let e=new ResizeObserver(()=>{this._viewport.onResize()});e.observe(this.editorContainer),this._disposables.add(()=>{e.disconnect()})}_setupCenterEffect(){this._disposables.add(this.mindmapService.requestCenter.on(()=>{let e;this.model.elementModels.forEach(t=>{e=e?e.unite(t.elementBound):t.elementBound}),e&&this._viewport.setViewportByBound(e,[10,10,10,10])}))}_setupRenderer(){this._disposables.add(this.model.elementUpdated.on(()=>{this._renderer?.refresh(),this.mindmapService.center()})),this._viewport.ZOOM_MIN=.01}connectedCallback(){super.connectedCallback(),this._layer=d.T.create(this.doc,this.model),this._viewport=new n.LM,this._renderer=new c.A({viewport:this._viewport,layerManager:this._layer,enableStackingCanvas:!0,provider:{selectedElements:()=>[],getColorScheme:()=>a.Q.mode,getColorValue:(e,t,i)=>a.Q.getColorValue(e,t,i),generateColorProperty:(e,t)=>a.Q.generateColorProperty(e,t),getPropertyValue:e=>a.Q.getPropertyValue(e)}})}firstUpdated(e){this._renderer?.attach(this.editorContainer),this._viewport.setContainer(this.editorContainer),this._resizeEffect(),this._setupCenterEffect(),this._setupRenderer(),this._adjustNodeWidth(),this.mindmapService.center()}render(){return(0,o.qy)`
    `}get mindmapService(){return this.host.spec.getService("affine:page")}#cT=u(this,g,void 0);get editorContainer(){return this.#cT}set editorContainer(e){this.#cT=e}},t})()},4536:(e,t,i)=>{function s(e,t,i,o=e=>e){return e*o(.5-t*(.5-i))}function o(e,t){return[e[0]+t[0],e[1]+t[1]]}function r(e,t){return[e[0]-t[0],e[1]-t[1]]}function a(e,t){return[e[0]*t,e[1]*t]}function n(e){return[e[1],-e[0]]}function l(e,t){return e[0]*t[0]+e[1]*t[1]}function c(e,t){var i;return(i=r(e,t))[0]*i[0]+i[1]*i[1]}function d(e){var t;return t=Math.hypot(e[0],e[1]),[e[0]/t,e[1]/t]}function h(e,t,i){let s=Math.sin(i),o=Math.cos(i),r=e[0]-t[0],a=e[1]-t[1];return[r*o-a*s+t[0],r*s+a*o+t[1]]}function u(e,t,i){return o(e,a(r(t,e),i))}i.d(t,{$:()=>m});let{min:p,PI:f}=Math,g=f+1e-4;function m(e,t={}){return function(e,t={}){var i,f;let m;let{size:v=16,smoothing:y=.5,thinning:b=.5,simulatePressure:w=!0,easing:x=e=>e,start:_={},end:C={},last:k=!1}=t,{cap:S=!0,easing:M=e=>e*(2-e)}=_,{cap:E=!0,easing:I=e=>--e*e*e+1}=C;if(0===e.length||v<=0)return[];let B=e[e.length-1].runningLength,$=!1===_.taper?0:!0===_.taper?Math.max(v,B):_.taper,T=!1===C.taper?0:!0===C.taper?Math.max(v,B):C.taper,O=Math.pow(v*y,2),P=[],H=[],A=e.slice(0,10).reduce((e,t)=>{let i=t.pressure;if(w){let s=p(1,t.distance/v),o=p(1,1-s);i=p(1,e+.275*s*(o-e))}return(e+i)/2},e[0].pressure),L=s(v,b,e[e.length-1].pressure,x),D=e[0].vector,Z=e[0].point,j=Z,V=Z,z=j,R=!1;for(let t=0;tl(f,D)&&!R,E=null!==k&&k<0;if(S||E){let e=a(n(D),L);for(let t=1/13,i=0;i<=1;i+=t)V=h(r(d,e),d,g*i),P.push(V),z=h(o(d,e),d,-(g*i)),H.push(z);Z=V,j=z,E&&(R=!0);continue}if(R=!1,t===e.length-1){let e=a(n(f),L);P.push(r(d,e)),H.push(o(d,e));continue}let F=a(n(u(C,f,k)),L);V=r(d,F),(t<=1||c(Z,V)>O)&&(P.push(V),Z=V),z=o(d,F),(t<=1||c(j,z)>O)&&(H.push(z),j=z),A=i,D=f}let F=e[0].point.slice(0,2),N=e.length>1?e[e.length-1].point.slice(0,2):o(e[0].point,[1,1]),q=[],U=[];if(1===e.length){if(!($||T)||k){let e=(i=d(n(r(F,N))),o(F,a(i,-(m||L)))),t=[];for(let i=1/13,s=i;s<=1;s+=i)t.push(h(e,F,2*g*s));return t}}else{if($||T&&1===e.length);else if(S)for(let e=1/13,t=e;t<=1;t+=e){let e=h(H[0],F,g*t);q.push(e)}else{let e=r(P[0],H[0]),t=a(e,.5),i=a(e,.51);q.push(r(F,t),r(F,i),o(F,i),o(F,t))}let t=n([-(f=e[e.length-1].vector)[0],-f[1]]);if(T||$&&1===e.length)U.push(N);else if(E){let e=o(N,a(t,L));for(let t=1/29,i=t;i<1;i+=t)U.push(h(e,N,3*g*i))}else U.push(o(N,a(t,L)),o(N,a(t,.99*L)),r(N,a(t,.99*L)),r(N,a(t,L)))}return P.concat(U,H.reverse(),q)}(function(e,t={}){let{streamline:i=.5,size:s=16,last:a=!1}=t;if(0===e.length)return[];let n=.15+(1-i)*.85,l=Array.isArray(e[0])?e:e.map(({x:e,y:t,pressure:i=.5})=>[e,t,i]);if(2===l.length){let e=l[1];l=l.slice(0,-1);for(let t=1;t<5;t++)l.push(u(l[0],e,t/4))}1===l.length&&(l=[...l,[...o(l[0],[1,1]),...l[0].slice(2)]]);let c=[{point:[l[0][0],l[0][1]],pressure:(l[0][2]??-1)>=0?l[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],h=!1,p=0,f=c[0],g=l.length-1;for(let e=1;e=0?l[e][2]:.5,vector:d(r(f.point,t)),distance:i,runningLength:p},c.push(f)}return c[0].vector=c[1]?.vector||[0,0],c}(e,t),t)}},11623:(e,t,i)=>{function s(e,t){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function o(e,t,i){return[e[0]+(t[0]-e[0])*i,e[1]+(t[1]-e[1])*i]}function r(e,t,i,a,n){let l=n||[],c=e[t],d=e[i-1],h=0,u=1;for(let r=t+1;rh&&(h=t,u=r)}return Math.sqrt(h)>a?(r(e,t,u+1,a,l),r(e,u,i,a,l)):(l.length||l.push(c),l.push(d)),l}function a(e,t=.15,i){let n=[],l=(e.length-1)/3;for(let i=0;i1&&n.push(e):n.push(e),n.push(t[i+3])}else{let s=t[i+0],a=t[i+1],l=t[i+2],c=t[i+3],d=o(s,a,.5),h=o(a,l,.5),u=o(l,c,.5),p=o(d,h,.5),f=o(h,u,.5),g=o(p,f,.5);e([s,d,p,g],0,r,n),e([g,f,u,c],0,r,n)}return n}(e,3*i,t,n);return i&&i>0?r(n,0,n.length,i):n}function n(e){let t=0,i=0,s=0,o=0,r=[];for(let{key:a,data:n}of e)switch(a){case"M":r.push({key:"M",data:[...n]}),[t,i]=n,[s,o]=n;break;case"m":t+=n[0],i+=n[1],r.push({key:"M",data:[t,i]}),s=t,o=i;break;case"L":r.push({key:"L",data:[...n]}),[t,i]=n;break;case"l":t+=n[0],i+=n[1],r.push({key:"L",data:[t,i]});break;case"C":r.push({key:"C",data:[...n]}),t=n[4],i=n[5];break;case"c":{let e=n.map((e,s)=>s%2?e+i:e+t);r.push({key:"C",data:e}),t=e[4],i=e[5];break}case"Q":r.push({key:"Q",data:[...n]}),t=n[2],i=n[3];break;case"q":{let e=n.map((e,s)=>s%2?e+i:e+t);r.push({key:"Q",data:e}),t=e[2],i=e[3];break}case"A":r.push({key:"A",data:[...n]}),t=n[5],i=n[6];break;case"a":t+=n[5],i+=n[6],r.push({key:"A",data:[n[0],n[1],n[2],n[3],n[4],t,i]});break;case"H":r.push({key:"H",data:[...n]}),t=n[0];break;case"h":t+=n[0],r.push({key:"H",data:[t]});break;case"V":r.push({key:"V",data:[...n]}),i=n[0];break;case"v":i+=n[0],r.push({key:"V",data:[i]});break;case"S":r.push({key:"S",data:[...n]}),t=n[2],i=n[3];break;case"s":{let e=n.map((e,s)=>s%2?e+i:e+t);r.push({key:"S",data:e}),t=e[2],i=e[3];break}case"T":r.push({key:"T",data:[...n]}),t=n[0],i=n[1];break;case"t":t+=n[0],i+=n[1],r.push({key:"T",data:[t,i]});break;case"Z":case"z":r.push({key:"Z",data:[]}),t=s,i=o}return r}function l(e){let t=[],i="",s=0,o=0,r=0,a=0,n=0,l=0;for(let{key:d,data:h}of e){switch(d){case"M":t.push({key:"M",data:[...h]}),[s,o]=h,[r,a]=h;break;case"C":t.push({key:"C",data:[...h]}),s=h[4],o=h[5],n=h[2],l=h[3];break;case"L":t.push({key:"L",data:[...h]}),[s,o]=h;break;case"H":s=h[0],t.push({key:"L",data:[s,o]});break;case"V":o=h[0],t.push({key:"L",data:[s,o]});break;case"S":{let e=0,r=0;"C"===i||"S"===i?(e=s+(s-n),r=o+(o-l)):(e=s,r=o),t.push({key:"C",data:[e,r,...h]}),n=h[0],l=h[1],s=h[2],o=h[3];break}case"T":{let[e,r]=h,a=0,c=0;"Q"===i||"T"===i?(a=s+(s-n),c=o+(o-l)):(a=s,c=o);let d=s+2*(a-s)/3,u=o+2*(c-o)/3,p=e+2*(a-e)/3,f=r+2*(c-r)/3;t.push({key:"C",data:[d,u,p,f,e,r]}),n=a,l=c,s=e,o=r;break}case"Q":{let[e,i,r,a]=h,c=s+2*(e-s)/3,d=o+2*(i-o)/3,u=r+2*(e-r)/3,p=a+2*(i-a)/3;t.push({key:"C",data:[c,d,u,p,r,a]}),n=e,l=i,s=r,o=a;break}case"A":{let e=Math.abs(h[0]),i=Math.abs(h[1]),r=h[2],a=h[3],n=h[4],l=h[5],d=h[6];0===e||0===i?(t.push({key:"C",data:[s,o,l,d,l,d]}),s=l,o=d):(s!==l||o!==d)&&((function e(t,i,s,o,r,a,n,l,d,h){let u=Math.PI*n/180,p=[],f=0,g=0,m=0,v=0;if(h)[f,g,m,v]=h;else{[t,i]=c(t,i,-u),[s,o]=c(s,o,-u);let e=(t-s)/2,n=(i-o)/2,h=e*e/(r*r)+n*n/(a*a);h>1&&(r*=h=Math.sqrt(h),a*=h);let p=r*r,y=a*a,b=(l===d?-1:1)*Math.sqrt(Math.abs((p*y-p*n*n-y*e*e)/(p*n*n+y*e*e)));m=b*r*n/a+(t+s)/2,v=-(b*a)*e/r+(i+o)/2,f=Math.asin(parseFloat(((i-v)/a).toFixed(9))),g=Math.asin(parseFloat(((o-v)/a).toFixed(9))),tg&&(f-=2*Math.PI),!d&&g>f&&(g-=2*Math.PI)}let y=g-f;if(Math.abs(y)>120*Math.PI/180){let t=g,i=s,l=o;p=e(s=m+r*Math.cos(g=d&&g>f?f+120*Math.PI/180*1:f+-(120*Math.PI/180*1)),o=v+a*Math.sin(g),i,l,r,a,n,0,d,[g,t,m,v])}y=g-f;let b=Math.cos(f),w=Math.cos(g),x=Math.tan(y/4),_=4/3*r*x,C=4/3*a*x,k=[t,i],S=[t+_*Math.sin(f),i-C*b],M=[s+_*Math.sin(g),o-C*w],E=[s,o];if(S[0]=2*k[0]-S[0],S[1]=2*k[1]-S[1],h)return[S,M,E].concat(p);{p=[S,M,E].concat(p);let e=[];for(let t=0;tR});let d={A:7,a:7,C:6,c:6,H:1,h:1,L:2,l:2,M:2,m:2,Q:4,q:4,S:4,s:4,T:2,t:2,V:1,v:1,Z:0,z:0};function h(e){let t=[],i=function(e){let t;let i=[];for(;""!==e;){if(t=e.match(/^([ \t\r\n,]+)/)){e=e.slice(t[0].length);continue}if(t=e.match(/^([aAcChHlLmMqQsStTvVzZ])/)){i.push({type:0,text:t[0]}),e=e.slice(t[0].length);continue}if(!(t=e.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)))return[];i.push({type:1,text:`${parseFloat(t[0])}`}),e=e.slice(t[0].length)}return i.push({type:2,text:""}),i}(e),s="BOD",o=0,r=i[0];for(;2!==r.type;){let a=0,n=[];if("BOD"===s){if("M"!==r.text&&"m"!==r.text)return h("M0,0"+e);o++,a=d[r.text],s=r.text}else 1===r.type?a=d[s]:(o++,a=d[r.text],s=r.text);if(o+a{let[t,i]=e;e[0]=(t-s)*a-(i-o)*n+s,e[1]=(t-s)*n+(i-o)*a+o})}}function f(e){let t=e[0],i=e[1];return Math.sqrt(Math.pow(t[0]-i[0],2)+Math.pow(t[1]-i[1],2))}function g(e,t){let i=t.hachureAngle+90,s=t.hachureGap;s<0&&(s=4*t.strokeWidth),s=Math.max(s,.1);let o=[0,0];if(i)for(let t of e)p(t,o,i);let r=function(e,t){let i=[];for(let t of e){let e=[...t];e[0].join(",")!==e[e.length-1].join(",")&&e.push([e[0][0],e[0][1]]),e.length>2&&i.push(e)}let s=[];t=Math.max(t,.1);let o=[];for(let e of i)for(let t=0;te.ymint.ymin?1:e.xt.x?1:e.ymax===t.ymax?0:(e.ymax-t.ymax)/Math.abs(e.ymax-t.ymax)),!o.length)return s;let r=[],a=o[0].ymin;for(;r.length||o.length;){if(o.length){let e=-1;for(let t=0;ta);t++)e=t;o.splice(0,e+1).forEach(e=>{r.push({s:a,edge:e})})}if((r=r.filter(e=>!(e.edge.ymax<=a))).sort((e,t)=>e.edge.x===t.edge.x?0:(e.edge.x-t.edge.x)/Math.abs(e.edge.x-t.edge.x)),r.length>1)for(let e=0;e=r.length)break;let i=r[e].edge,o=r[t].edge;s.push([[Math.round(i.x),a],[Math.round(o.x),a]])}a+=t,r.forEach(e=>{e.edge.x=e.edge.x+t*e.edge.islope})}return s}(e,s);if(i){for(let t of e)p(t,o,-i);!function(e,t,i){let s=[];e.forEach(e=>s.push(...e)),p(s,t,i)}(r,o,-i)}return r}class m{constructor(e){this.helper=e}dashedLine(e,t){let i=t.dashOffset<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashOffset,s=t.dashGap<0?t.hachureGap<0?4*t.strokeWidth:t.hachureGap:t.dashGap,o=[];return e.forEach(e=>{let r=f(e),a=Math.floor(r/(i+s)),n=(r+s-a*(i+s))/2,l=e[0],c=e[1];l[0]>c[0]&&(l=e[1],c=e[0]);let d=Math.atan((c[1]-l[1])/(c[0]-l[0]));for(let e=0;e{let o=Math.round(f(e)/(2*t)),r=e[0],a=e[1];r[0]>a[0]&&(r=e[1],a=e[0]);let n=Math.atan((a[1]-r[1])/(a[0]-r[0]));for(let e=0;e2){let o=[];for(let t=0;t2*Math.PI&&(h=0,u=2*Math.PI);let p=Math.min(2*Math.PI/l.curveStepCount/2,(u-h)/2),f=j(p,e,t,c,d,h,u,1,l);if(!l.disableMultiStroke){let i=j(p,e,t,c,d,h,u,1.5,l);f.push(...i)}return a&&(n?f.push(...H(e,t,e+c*Math.cos(h),t+d*Math.sin(h),l),...H(e,t,e+c*Math.cos(u),t+d*Math.sin(u),l)):f.push({op:"lineTo",data:[e,t]},{op:"lineTo",data:[e+c*Math.cos(h),t+d*Math.sin(h)]})),{type:"path",ops:f}}function B(e,t){let i=[];for(let s of e)if(s.length){let e=t.maxRandomnessOffset||0,o=s.length;if(o>2){i.push({op:"move",data:[s[0][0]+P(e,t),s[0][1]+P(e,t)]});for(let r=1;r500?.4:-.0016668*l+1.233334;let d=o.maxRandomnessOffset||0;d*d*100>n&&(d=l/10);let h=d/2,u=.2+.2*T(o),p=o.bowing*o.maxRandomnessOffset*(s-t)/200,f=o.bowing*o.maxRandomnessOffset*(e-i)/200;p=P(p,o,c),f=P(f,o,c);let g=[],m=()=>P(h,o,c),v=()=>P(d,o,c),y=o.preserveVertices;return r&&(a?g.push({op:"move",data:[e+(y?0:m()),t+(y?0:m())]}):g.push({op:"move",data:[e+(y?0:P(d,o,c)),t+(y?0:P(d,o,c))]})),a?g.push({op:"bcurveTo",data:[p+e+(i-e)*u+m(),f+t+(s-t)*u+m(),p+e+2*(i-e)*u+m(),f+t+2*(s-t)*u+m(),i+(y?0:m()),s+(y?0:m())]}):g.push({op:"bcurveTo",data:[p+e+(i-e)*u+v(),f+t+(s-t)*u+v(),p+e+2*(i-e)*u+v(),f+t+2*(s-t)*u+v(),i+(y?0:v()),s+(y?0:v())]}),g}function L(e,t,i){let s=[];s.push([e[0][0]+P(t,i),e[0][1]+P(t,i)]),s.push([e[0][0]+P(t,i),e[0][1]+P(t,i)]);for(let o=1;o3){let r=[],a=1-i.curveTightness;o.push({op:"move",data:[e[1][0],e[1][1]]});for(let t=1;t+22*Math.PI&&(c=0,d=2*Math.PI);let h=(d-c)/a.curveStepCount,u=[];for(let i=c;i<=d;i+=h)u.push([e+n*Math.cos(i),t+l*Math.sin(i)]);return u.push([e+n*Math.cos(d),t+l*Math.sin(d)]),u.push([e,t]),$([u],a)}(e,t,i,s,o,r,l))}return l.stroke!==V&&c.push(d),this._d("arc",c,l)}circle(e,t,i,s){let o=this.ellipse(e,t,i,i,s);return o.shape="circle",o}curve(e,t){let i=this._o(t),s=[],o=function(e,t){let i=L(e,1*(1+.2*t.roughness),t);if(!t.disableMultiStroke){let s=L(e,1.5*(1+.22*t.roughness),function(e){let t={...e};return t.randomizer=void 0,e.seed&&(t.seed=e.seed+1),t}(t));i=i.concat(s)}return{type:"path",ops:i}}(e,i);if(i.fill&&i.fill!==V&&e.length>=3){let t=a(function(e,t=0){let i=e.length;if(i<3)throw Error("A curve must have at least three points.");let s=[];if(3===i)s.push([...e[0]],[...e[1]],[...e[2]],[...e[2]]);else{let i=[];i.push(e[0],e[0]);for(let t=1;t=0?s.data.map(e=>+e.toFixed(t)):s.data;switch(s.op){case"move":i+=`M${e[0]} ${e[1]} `;break;case"bcurveTo":i+=`C${e[0]} ${e[1]}, ${e[2]} ${e[3]}, ${e[4]} ${e[5]} `;break;case"lineTo":i+=`L${e[0]} ${e[1]} `}}return i.trim()}path(e,t){let i=this._o(t),s=[];if(!e)return this._d("path",s,i);e=(e||"").replace(/\n/g," ").replace(/(-\s)/g,"-").replace("/(ss)/g"," ");let o=i.fill&&"transparent"!==i.fill&&i.fill!==V,c=i.stroke!==V,d=!!(i.simplification&&i.simplification<1),u=d?4-4*i.simplification:(1+i.roughness)/2,p=function(e,t,i){let s=l(n(h(e))),o=[],c=[],d=[0,0],u=[],p=()=>{u.length>=4&&c.push(...a(u,1)),u=[]},f=()=>{p(),c.length&&(o.push(c),c=[])};for(let{key:e,data:t}of s)switch(e){case"M":f(),d=[t[0],t[1]],c.push(d);break;case"L":p(),c.push([t[0],t[1]]);break;case"C":if(!u.length){let e=c.length?c[c.length-1]:d;u.push([e[0],e[1]])}u.push([t[0],t[1]]),u.push([t[2],t[3]]),u.push([t[4],t[5]]);break;case"Z":p(),c.push([d[0],d[1]])}if(f(),!i)return o;let g=[];for(let e of o){let t=r(e,0,e.length,i);t.length&&g.push(t)}return g}(e,0,u);return o&&("solid"===i.fillStyle?s.push(B(p,i)):s.push($(p,i))),c&&(d?p.forEach(e=>{s.push(S(e,!1,i))}):s.push(function(e,t){let i=l(n(h(e))),s=[],o=[0,0],r=[0,0];for(let{key:e,data:a}of i)switch(e){case"M":{let e=1*(t.maxRandomnessOffset||0),i=t.preserveVertices;s.push({op:"move",data:a.map(s=>s+(i?0:P(e,t)))}),r=[a[0],a[1]],o=[a[0],a[1]];break}case"L":s.push(...H(r[0],r[1],a[0],a[1],t)),r=[a[0],a[1]];break;case"C":{let[e,i,o,n,l,c]=a;s.push(...function(e,t,i,s,o,r,a,n){let l=[],c=[n.maxRandomnessOffset||1,(n.maxRandomnessOffset||1)+.3],d=[0,0],h=n.disableMultiStroke?1:2,u=n.preserveVertices;for(let p=0;p=0?s.data.map(e=>+e.toFixed(i)):s.data;switch(s.op){case"move":e.moveTo(t[0],t[1]);break;case"bcurveTo":e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]);break;case"lineTo":e.lineTo(t[0],t[1])}}"fillPath"===t.type?e.fill(s):e.stroke()}fillSketch(e,t,i){let s=i.fillWeight;s<0&&(s=i.strokeWidth/2),e.save(),i.fillLineDash&&e.setLineDash(i.fillLineDash),i.fillLineDashOffset&&(e.lineDashOffset=i.fillLineDashOffset),e.strokeStyle=i.fill||"",e.lineWidth=s,this._drawToContext(e,t,i.fixedDecimalPlaceDigits),e.restore()}arc(e,t,i,s,o,r,a=!1,n){let l=this.gen.arc(e,t,i,s,o,r,a,n);return this.draw(l),l}circle(e,t,i,s){let o=this.gen.circle(e,t,i,s);return this.draw(o),o}curve(e,t){let i=this.gen.curve(e,t);return this.draw(i),i}draw(e){let t=e.sets||[],i=e.options||this.getDefaultOptions(),s=this.ctx,o=e.options.fixedDecimalPlaceDigits;for(let r of t)switch(r.type){case"path":s.save(),s.strokeStyle="none"===i.stroke?"transparent":i.stroke,s.lineWidth=i.strokeWidth,i.strokeLineDash&&s.setLineDash(i.strokeLineDash),i.strokeLineDashOffset&&(s.lineDashOffset=i.strokeLineDashOffset),this._drawToContext(s,r,o),s.restore();break;case"fillPath":{s.save(),s.fillStyle=i.fill||"";let t="curve"===e.shape||"polygon"===e.shape||"path"===e.shape?"evenodd":"nonzero";this._drawToContext(s,r,o,t),s.restore();break}case"fillSketch":this.fillSketch(s,r,i)}}ellipse(e,t,i,s,o){let r=this.gen.ellipse(e,t,i,s,o);return this.draw(r),r}getDefaultOptions(){return this.gen.defaultOptions}line(e,t,i,s,o){let r=this.gen.line(e,t,i,s,o);return this.draw(r),r}linearPath(e,t){let i=this.gen.linearPath(e,t);return this.draw(i),i}path(e,t){let i=this.gen.path(e,t);return this.draw(i),i}polygon(e,t){let i=this.gen.polygon(e,t);return this.draw(i),i}rectangle(e,t,i,s,o){let r=this.gen.rectangle(e,t,i,s,o);return this.draw(r),r}get generator(){return this.gen}}},72674:(e,t,i)=>{i.d(t,{Y:()=>g});var s=i(1126),o=i(69050),r=i(73711),a=i(992),n=i(18513);let l=e=>{let t=t=>e.hasElementById(t)||e.doc.hasBlockById(t),i=t=>e.getElementById(t)??e.doc.getBlockById(t),s=new n.IV({getElementById:i}),o=e=>{(e.source?.id&&t(e.source.id)||!e.source?.id&&e.source?.position)&&(e.target?.id&&t(e.target.id)||!e.target?.id&&e.target?.position)&&s.updatePath(e)},r=new Set,a=!1,l=e=>{r.add(e),a||(a=!0,queueMicrotask(()=>{r.forEach(o),r.clear(),a=!1}))},c=[e.elementAdded.on(({id:t})=>{let s=i(t);s&&("type"in s&&"connector"===s.type?l(s):e.getConnectors(t).forEach(l))}),e.elementUpdated.on(({id:t,props:s})=>{let o=i(t);(s.xywh||s.rotate)&&e.getConnectors(t).forEach(l),"type"in o&&"connector"===o.type&&(void 0!==s.mode||s.target||s.source||s.xywh&&!o.updatingPath)&&l(o)}),e.doc.slots.blockUpdated.on(t=>{("add"===t.type||"update"===t.type&&"xywh"===t.props.key)&&e.getConnectors(t.id).forEach(l)})];return e.getElementsByType("connector").forEach(e=>o(e)),()=>{c.forEach(e=>e.dispose())}};var c=i(31999);let d=e=>{let t=[e.elementUpdated.filter(e=>e.local).on(({id:t,props:i})=>{let s=e.getElementById(t);s instanceof c.$b&&i.childIds&&0===s.childIds.length&&e.removeElement(t)})];return()=>{t.forEach(e=>e.dispose())}},h="affine:surface:text",u="affine:surface:ymap";class p extends r.S4{_elementToJSON(e){let t={};return e.forEach((e,i)=>{t[i]=this._toJSON(e)}),t}_fromJSON(e){if(e instanceof Object){if(Reflect.has(e,h)){let t=new r.rl.Y.Text;return t.applyDelta(Reflect.get(e,"delta")),t}if(Reflect.has(e,u)){let t=new r.rl.Y.Map;return Object.entries(Reflect.get(e,"json")).forEach(([e,i])=>{t.set(e,i)}),t}}return e}_toJSON(e){return e instanceof r.rl.Y.Text?{[h]:!0,delta:e.toDelta()}:e instanceof r.rl.Y.Map?{[u]:!0,json:e.toJSON()}:e}elementFromJSON(e){let t=new r.rl.Y.Map;return Object.entries(e).forEach(([e,i])=>{t.set(e,this._fromJSON(i))}),t}async fromSnapshot(e){let t=await super.fromSnapshot(e),i=t.props.elements,s=new r.rl.Y.Map;Object.entries(i).forEach(([e,t])=>{let i=this.elementFromJSON(t);s.set(e,i)});let o=this._internal.Boxed(s);return t.props={elements:o},t}async toSnapshot(e){let t=await super.toSnapshot(e),i=e.model.elements.getValue(),s={};return i&&i.forEach((e,t)=>{s[t]=this._elementToJSON(e)}),t.props={elements:s},t}}let f={toV4:e=>{let{elements:t}=e;if(t instanceof r.J5){let e=t.getValue();if(!e)return;for(let[t,i]of e.entries()){let s=i.get("type");if("shape"===s||"text"===s){let e=i.get("isBold"),t=i.get("isItalic");i.delete("isBold"),i.delete("isItalic"),e&&i.set("bold",!0),t&&i.set("italic",!0)}if("connector"===s){let s=i.get("source"),o=i.get("target"),r=s.id,a=o.id;if(!s.position&&!r||!o.position&&!a){e.delete(t);return}}}}else for(let e of Object.keys(t)){let i=t[e],s=i.type;if("shape"===s||"text"===s){let e=i.isBold,t=i.isItalic;delete i.isBold,delete i.isItalic,e&&(i.bold=!0),t&&(i.italic=!0)}if("connector"===s){let s=i.source,o=i.target,r=s.id,a=o.id;if(!s.position&&(!r||!t[r])||!o.position&&(!a||!t[a])){delete t[e];return}}}},toV5:e=>{let{elements:t}=e;if(!(t instanceof r.J5)){let i=new r.rl.Y.Map;Object.entries(t).forEach(([e,t])=>{let s=new r.rl.Y.Map;Object.entries(t).forEach(([e,t])=>{s.set(e,t instanceof r.rl.Y.Text?t.clone():t instanceof r.EY?t.yText.clone():t)}),i.set(e,s)});let s=new r.J5(i);e.elements=s}let i=e.elements.getValue();for(let[e,t]of i)if("mindmap"===t.get("type")||"group"===t.get("type")){let s=t.get("children");s?.size===0&&i.delete(e)}}},g=(0,r.A9)({flavour:"affine:surface",props:e=>({elements:e.Boxed(new r.rl.Y.Map)}),metadata:{version:5,role:"hub",parent:["affine:page"],children:["affine:frame","affine:image","affine:bookmark","affine:attachment","affine:embed-*","affine:edgeless-text"]},onUpgrade:(e,t,i)=>{t<4&&i>=4&&f.toV4(e),t<5&&i>=5&&f.toV5(e)},transformer:()=>new p,toModel:()=>new m});class m extends s.i5{constructor(){super(...arguments),this._disposables=new o.K}_init(){this._extendElement(a.IN),super._init()}applyMiddlewares(){[l(this,this.hooks),d(this,this.hooks)].forEach(e=>this._disposables.add(e))}getConnectors(e){return this.getElementsByType("connector").filter(t=>t.source?.id===e||t.target?.id===e)}getElementsByType(e){return super.getElementsByType(e)}}},40907:(e,t,i)=>{i.d(t,{w:()=>d});var s=i(71006),o=i(11559);function r(e,t){return(0,o.f3)(e[0],t[0])&&(0,o.f3)(e[1],t[1])}class a{constructor(e,t=[],i=[],s=[]){this.points=e,this.blocks=t,this.expandedBlocks=i,this.excludedPoints=s,this._xMap=new Map,this._yMap=new Map;let o=this._xMap,r=this._yMap;this.points.forEach(e=>{let[t,i]=e;o.has(t)||o.set(t,[]),r.has(i)||r.set(i,[]),o.get(t)?.push(e),r.get(i)?.push(e)})}_canSkipBlock(e){return this.excludedPoints.some(t=>r(e,t))}_isBlock(e,t){return this.blocks.some(i=>{let s=(0,o.Dx)(e,t,i.points);return s?.length===2||i.isPointInBound(e,0)||i.isPointInBound(t,0)||[i.leftLine,i.upperLine,i.rightLine,i.lowerLine].some(i=>{var s;return s=[e,t],[i[0][1],i[1][1],s[0][1],s[1][1]].every(e=>(0,o.f3)(e,i[0][1],.02))?(0,o.s5)(i,s,0):!![i[0][0],i[1][0],s[0][0],s[1][0]].every(e=>(0,o.f3)(e,i[0][0],.02))&&(0,o.s5)(i,s,1)})})||this.expandedBlocks.some(i=>{let s=(0,o.Dx)(e,t,i.expand(-.5).points);return s?.length===2})}neighbors(e){let[t,i]=e,s=new Set,o=this._xMap.get(t),a=this._yMap.get(i);if(o){let t,i,a=1/0,n=1/0;o.forEach(s=>{if(r(s,e))return;let o=s[1]-e[1];o>0&&o{if(r(s,e))return;let a=s[0]-e[0];a>0&&athis._compare(s.priority,i.priority)&&(n=r)),athis._compare(o.priority,i.priority)||null!==n&&0>this._compare(o.priority,s.priority))&&(n=a)),-1===n)break;this.heap[e]=this.heap[n],this.heap[n]=i,e=n}}bubbleUp(e=this.heap.length-1){let t=this.heap[e];for(;e>0;){let i=Math.floor((e-1)/2),s=this.heap[i];if(0>=this._compare(s.priority,t.priority))break;this.heap[i]=t,this.heap[e]=s,e=i}}dequeue(){let e=this.heap[0],t=this.heap.pop();return this.heap.length>0&&t&&(this.heap[0]=t,this.bubbleDown()),e?.value??null}empty(){return 0===this.heap.length}enqueue(e,t){this.heap.push({value:e,priority:t}),this.bubbleUp()}}function l(e,t){return e[2]+.01t[2]?1:e[0]t[0]?1:e[1]>t[1]?-1:e[1]{let i=t.findIndex(t=>c(t,e));i>=0&&t.splice(i,1)}),e===this._ep&&t.push(this._originalEp),t}reset(){this._cameFrom.clear(),this._costSoFar.clear(),this._diagonalCount.clear(),this._pointPriority.clear(),this._complete=!1,this._init()}run(){for(;!this._complete;)this.step()}step(){if(this._complete)return;this._current=this._frontier.dequeue();let e=this._current;if(!e){this._complete=!0;return}e===this._ep&&c(this._ep,this._originalEp)&&(this._originalEp=this._ep);let t=this._neighbors(e);for(let r=0;rt+(Math.abs(e[0]-a[0])+Math.abs(e[1]-a[1]))),g=d.map((t,i)=>{var s;return t+(s=p.from[i],(0,o.f3)(a[0],e[0])&&(0,o.f3)(a[0],s[0])||(0,o.f3)(a[1],e[1])&&(0,o.f3)(a[1],s[1])?0:1)});(0,s.Z1)(a[2]);let m=u.map(e=>e+a[2]),v=-1;if(1===f.length)v=0;else{let e=h(f,(e,t)=>e+.01(0,o.f3)(e,t,.02));if(1===e.length)v=e[0];else{let t=h(e.map(e=>g[e]),(e,t)=>ee===t);v=1===t.length?e[t[0]]:function(e,t,i){let s=-1/0,o=[];for(let r=0;rm[e[t]]),(e,t)=>e>t,(e,t)=>e===t)[0]}}let y=!this._costSoFar.has(a),b=this._costSoFar.get(a)??[],w=this._diagonalCount.get(a)??[],x=this._pointPriority.get(a)??[],_=this._cameFrom.get(a)??{from:[],indexs:[]};b.push(f[v]),w.push(g[v]),x.push(m[v]),_.from.push(e),_.indexs.push(v);let C=g[v],k=m[v],S=f[v];this._costSoFar.set(a,b),this._diagonalCount.set(a,w),this._pointPriority.set(a,x),this._cameFrom.set(a,_);let M=[C,k,S+(i=this._ep,Math.abs(a[0]-i[0])+Math.abs(a[1]-i[1]))];if(y)this._frontier.enqueue(a,M);else{let e=this._frontier.heap.findIndex(e=>e.value===a),t=this._frontier.heap[e];t?0>l(M,t.priority)&&(t.priority=M,this._frontier.bubbleUp(e)):this._frontier.enqueue(a,M)}if(c(e,this._ep)&&c(a,this._originalEp)){this._originalEp=a,this._complete=!0;return}}}get path(){let e=[],t=this._complete?this._originalEp:this._current,i=[0];for(;t;){e.unshift(t);let o=this._cameFrom.get(t);if(!o)break;let r=i.shift();(0,s.Z1)(r),i.push(o.indexs[r]),t=o.from[r]}return e}}function h(e,t,i){let s=1/0,o=[];for(let r=0;r{i.d(t,{O3:()=>n,SG:()=>l,qZ:()=>a,ql:()=>r,vs:()=>c});var s=i(94098),o=i(11559);function r(e){if(!e.length)return null;if(1===e.length){let{x:t,y:i,w:o,h:r}=e[0];return new s.z(t,i,o,r)}let t=e[0];for(let i=1;i{let s=(0,o.e0)(e);t=Math.min(t,s.x),i=Math.min(i,s.y),r=Math.max(r,s.x+s.w),a=Math.max(a,s.y+s.h)}),new s.z(t,i,r-t,a-i)}function n(e){let{minX:t,minY:i,width:r,height:a}=(0,o.lK)(e);return new s.z(t,i,r,a)}function l(e,t){let i=t/2,o=new s.z(e.x-i,e.y-i,e.w+t,e.h+t);if(o.w<=0||o.h<=0)throw Error("Invalid delta range or bound size.");return o}function c(e,t,i,o,r){let a=2*i,n=2*r,l=Math.max(t.w-a,1),c=Math.max(t.h-a,1),d=Math.max(o.w-n,1),h=Math.max(o.h-n,1);return{points:e.map(e=>({...e,x:d*((e.x-i)/l)+r,y:h*((e.y-i)/c)+r})),bound:new s.z(o.x,o.y,d+n,h+n)}}},75510:(e,t,i)=>{i.d(t,{HY:()=>y,IV:()=>f,KV:()=>c,UV:()=>p,Vr:()=>h,ol:()=>u,rL:()=>d});var s=i(31716),o=i(94098),r=i(96458),a=i(71006),n=i(11559);function l(e,t,i,s){let o,r;if(null==t||t<0||t>1)return null;let a=e[0][0],l=e[0][1],c=e[3][0],d=e[3][1],h=e[1][0],u=e[1][1],p=e[2][0],f=e[2][1];(0,n.be)(h-a)&&(0,n.be)(u-l)&&(h=a,u=l),(0,n.be)(p-c)&&(0,n.be)(f-d)&&(p=c,f=d);let g=3*(h-a),m=3*(p-h)-g,v=c-a-g-m,y=3*(u-l),b=3*(f-u)-y,w=d-l-y-b;if(0===i)o=0===t?a:1===t?c:((v*t+m)*t+g)*t+a,r=0===t?l:1===t?d:((w*t+b)*t+y)*t+l;else{let e=n.ot,a=1-e;if(ta?(o=3*(c-p),r=3*(d-f)):(o=(3*v*t+2*m)*t+g,r=(3*w*t+2*b)*t+y),s){0===o&&0===r&&(ta)&&(o=p-h,r=f-u);let i=Math.sqrt(o*o+r*r);i&&(o/=i,r/=i)}if(3===i){let e=Math.pow(o*o+r*r,1.5);o=0!==e?(o*(6*w*t+2*b)-r*(6*v*t+2*m))/e:0,r=0}}return 2===i?[r,-o]:[o,r]}function c(e,t){return l(e,t,0,!1)}function d(e,t){return l(e,t,1,!0)}function h(e,t){let i=1/0,o=0;function r(r){if(r>=0&&r<=1){let n=c(e,r);(0,a.Z1)(n);let l=s.l.dist2(t,n);if(ln.ot;)r(o-l)||r(o+l)||(l/=2);return o}function u(e,t){let i=h(e,t),s=c(e,i);return(0,a.Z1)(s),s}function p(e){return[e[0],e[0].absOut,e[1].absIn,e[1]]}function f(e){let t,i,s,r,a,n,l,c,d,h,u;let[p,f,g,m]=e,[v,y]=p,[b,w]=f,[x,_]=g,[C,k]=m,S=[],M=[],E=[[],[]];for(let e=0;e<2;e+=1){if(0===e?(i=6*v-12*b+6*x,t=-3*v+9*b-9*x+3*C,s=3*b-3*v):(i=6*y-12*w+6*_,t=-3*y+9*w-9*_+3*k,s=3*w-3*y),1e-12>Math.abs(t)){if(1e-12>Math.abs(i))continue;(r=-s/i)>0&&r<1&&M.push(r);continue}c=Math.sqrt(l=i*i-4*s*t),!(l<0)&&((a=(-i+c)/(2*t))>0&&a<1&&M.push(a),(n=(-i-c)/(2*t))>0&&n<1&&M.push(n))}let I=M.length,B=I;for(;I;)I-=1,d=(u=1-(r=M[I]))*u*u*v+3*u*u*r*b+3*u*r*r*x+r*r*r*C,E[0][I]=d,h=u*u*u*y+3*u*u*r*w+3*u*r*r*_+r*r*r*k,E[1][I]=h,S[I]={X:d,Y:h};M[B]=0,M[B+1]=1,S[B]={X:v,Y:y},S[B+1]={X:C,Y:k},E[0][B]=v,E[1][B]=y,E[0][B+1]=C,E[1][B+1]=k,M.length=B+2,E[0].length=B+2,E[1].length=B+2,S.length=B+2;let $=Math.min.apply(null,E[0]),T=Math.min.apply(null,E[1]),O=Math.max.apply(null,E[0]),P=Math.max.apply(null,E[1]);return new o.z($,T,O-$,P-T)}function g(e){return e<0?-Math.pow(-e,1/3):Math.pow(e,1/3)}function m(e,t,i){return t<=e&&e<=i||v(e,t)||v(e,i)}function v(e,t,i,s=1e-6){return Math.abs(e-t)<=(i||s)}function y(e,t){let{minX:i,maxX:s,minY:a,maxY:n}=o.z.fromPoints(t),l=p(e),d=(function(e,t){let i,s;let o=e.length-1,r=function(e,[t,i]){let s=t[0],o=t[1],r=-Math.atan2(i[1]-o,i[0]-s);return e.map(function([e,t]){return[(e-s)*Math.cos(r)-(t-o)*Math.sin(r),(e-s)*Math.sin(r)+(t-o)*Math.cos(r)]})}(e,t),a=function(e){return 0<=e&&e<=1};if(2===o){let e=r[0][1],t=r[1][1],i=r[2][1],s=e-2*t+i;if(0!==s){let o=-Math.sqrt(t*t-e*i),r=-e+t;return[-(o+r)/s,-(-o+r)/s].filter(a)}return t!==i&&0===s?[(2*t-i)/(2*t-2*i)].filter(a):[]}let n=r[0][1],l=r[1][1],c=r[2][1],d=-n+3*l-3*c+r[3][1],h=3*n-6*l+3*c,u=-3*n+3*l,p=n;if(v(d,0)){if(v(h,0))return v(u,0)?[]:[-p/u].filter(a);let e=Math.sqrt(u*u-4*h*p),t=2*h;return[(e-u)/t,(-u-e)/t].filter(a)}h/=d;let f=(3*(u/=d)-h*h)/3,m=f/3,y=(2*h*h*h-9*h*u+27*(p/=d))/27,b=y/2,w=b*b+m*m*m;if(w<0){let e=-f/3,t=Math.sqrt(e*e*e),i=-y/(2*t),s=Math.acos(i<-1?-1:i>1?1:i),o=2*g(t);return[o*Math.cos(s/3)-h/3,o*Math.cos((s+2*Math.PI)/3)-h/3,o*Math.cos((s+2*Math.PI*2)/3)-h/3].filter(a)}if(0===w)return[2*(i=b<0?g(-b):-g(b))-h/3,-i-h/3].filter(a);{let e=Math.sqrt(w);return[(i=g(-b+e))-g(b+e)-h/3].filter(a)}})(l,t).map(e=>c(l,e)).filter(e=>!!e&&m(e[0],i,s)&&m(e[1],a,n)).map(e=>new r.S(e));return d.length>0?d:null}},21320:(e,t,i)=>{i.d(t,{AF:()=>r,e4:()=>n,s9:()=>o,yp:()=>a});var s=i(63820);function o(e){return`"${e}"`}let r=s.$M?()=>{let e=document.fonts.keys(),t=[],i=!1;for(;!i;){let s=e.next();i=!!s.done,s.value&&t.push(s.value)}return t}:()=>[...document.fonts.keys()],a=s.$M?e=>t=>t.family===`"${e}"`:e=>t=>t.family===e;function n(e){return r().filter(a(e)).filter((e,t,i)=>i.findIndex(t=>t.family===e.family&&t.weight===e.weight&&t.style===e.style)===t)}},19057:(e,t,i)=>{i.d(t,{Fb:()=>a,TU:()=>r.TU,_z:()=>n});var s=i(30397),o=i(16019),r=i(3471);function a(){return(0,s.Ak)(10)}function n(e,t=1){let i=Math.sign(e),s=Math.abs(e),r=100*o.fv;return s>r&&(e=r*i),t-e/100+-(Math.log10(Math.max(1,t))*i)*Math.min(1,s/20)}},11559:(e,t,i)=>{i.d(t,{$B:()=>b,$L:()=>_,BE:()=>S,Bn:()=>B,Cs:()=>E,DF:()=>P,Dx:()=>x,GT:()=>L,HY:()=>c,Hb:()=>I,Lo:()=>h,R$:()=>$,Rg:()=>k,Sp:()=>l,Vk:()=>w,W4:()=>C,_S:()=>M,a0:()=>f,be:()=>u,ct:()=>H,e0:()=>T,f3:()=>d,hr:()=>v,kO:()=>m,lK:()=>function e(t,i=0){let o=1/0,r=1/0,a=-1/0,n=-1/0;if(t.length<1)o=0,r=0,a=1,n=1;else for(let[e,i]of t)o=Math.min(e,o),r=Math.min(i,r),a=Math.max(e,a),n=Math.max(i,n);return 0!==i?e(t.map(e=>s.l.rotWith(e,[(o+a)/2,(r+n)/2],i))):{minX:o,minY:r,maxX:a,maxY:n,width:Math.max(1,a-o),height:Math.max(1,n-r)}},op:()=>y,ot:()=>a,pz:()=>Z,qE:()=>p,s3:()=>g,s5:()=>A,uA:()=>r,z:()=>O});var s=i(31716),o=i(96458);let r=2*Math.PI,a=1e-8;function n(e,t){var i,s;return(i=e[0]-t[0])*i+(s=e[1]-t[1])*s}function l(e,t,i){return e.x<=t&&t<=e.x+e.w&&e.y<=i&&i<=e.y+e.h}function c(e,t){return e.xt.x&&e.yt.y}function d(e,t,i=1e-4){return Math.abs(e-t)u(e))}function u(e){return e>=-.000000000001&&e<=1e-12}function p(e,t,i){return Math.max(t,void 0!==i?Math.min(e,i):e)}function f(e,t,i,o,r=0){let a=Math.cos(r),n=Math.sin(r),l=s.l.sub(e,t),c=a*l[0]+n*l[1],d=n*l[0]-a*l[1];return c*c/(i*i)+d*d/(o*o)<=1}function g(e,t){let i=0;return t.forEach((o,r)=>{let a=t[(r+1)%t.length];o[1]<=e[1]?a[1]>e[1]&&s.l.cross(o,a,e)>0&&(i+=1):a[1]<=e[1]&&0>s.l.cross(o,a,e)&&(i-=1)}),0!==i}function m(e,t,i){for(let s=0;s=0){let t=Math.sqrt(u),o=(-h+t)/(2*d),r=(-h-t)/(2*d);0<=o&&o<=1&&l.push(s.l.add(s.l.rot(s.l.add(s.l.mul(c,o),e),n),i)),0<=r&&r<=1&&Math.abs(o-r)>1e-16&&l.push(s.l.add(s.l.rot(s.l.add(s.l.mul(c,r),e),n),i))}return 0===l.length?null:l.map(e=>{let t=new o.S(e),n=s.l.uni(s.l.divV(s.l.sub(e,i),[r*r,a*a]));return t.tangent=[-n[1],n[0]],t})}function x(e,t,i){let r=[],a=i.length;for(let n=0;n=s.l.dpr(r,a)}(t,[r,a]))return s.l.normalize(s.l.sub(a,r))}return[0,0]}function k(e,t,i){let r=[],a=i.length;for(let n=0;n0?1:-1}function E(e,t){let{x:i,y:s,w:o,h:r,rotate:a}=e;if(!a)return t;let n=i+o/2,l=s+r/2,c=new DOMMatrix().translateSelf(n,l).rotateSelf(a).translateSelf(-n,-l),d=new DOMPoint(...t).matrixTransform(c);return[d.x,d.y]}function I(e,t,i){let o=P(i);return e.map(e=>s.l.rotWith(e,t,o))}function B(e,t=({x:e,y:t,w:i,h:s})=>[[e,t],[e+i,t],[e+i,t+s],[e,t+s]]){let{rotate:i}=e,s=t(e);if(i){let{x:t,y:o,w:r,h:a}=e,n=t+r/2,l=o+a/2,c=new DOMMatrix().translateSelf(n,l).rotateSelf(i).translateSelf(-n,-l);s=s.map(e=>{let{x:t,y:i}=new DOMPoint(...e).matrixTransform(c);return[t,i]})}return s}function $(e){let{x:t,y:i,w:s,h:o,rotate:r}=e,a=new DOMRect(t,i,s,o);return r?new DOMQuad(...B(e).map(e=>new DOMPoint(...e))).getBounds():a}function T(e){let{x:t,y:i,width:s,height:o}=$(e);return{x:t,y:i,w:s,h:o}}function O(e){return e<0&&(e+=360),e%=360}function P(e){return e*Math.PI/180}function H(e){return 180*e/Math.PI}function A(e,t,i,s=!0){let o=s?(e,t)=>ee<=t;return!(o(Math.max(e[0][i],e[1][i]),Math.min(t[0][i],t[1][i]))||o(Math.max(t[0][i],t[1][i]),Math.min(e[0][i],e[1][i])))}function L(e,t){let{x:i,y:s,w:o,h:r,rotate:a}=e,n=o*t,l=r*t;return{x:i+o/2-n/2,y:s+r/2-l/2,w:n,h:l,rotate:a}}let D=(e,t,i,s)=>Math.hypot(i-e,s-t);function Z(e,t,i,o,r){let a,n,l;if(0===i)a=o[0]-e.x,n=o[1]-e.y;else{let{minX:t,minY:r,maxX:l,maxY:c}=e,d=function(e,t,i){let o=P(i);return s.l.add(t,s.l.rot(s.l.sub(e,t),o))}(o,[t+(l-t)/2,r+(c-r)/2],-i);a=d[0]-e.x,n=d[1]-e.y}let[c,d]=t;if(D(c[0],c[1],a,n)s?d:ps?c:l)[1],a-l[0]){i.d(t,{H:()=>s});let s=(0,i(73711).A9)({flavour:"affine:surface-ref",props:()=>({reference:"",caption:""}),metadata:{version:1,role:"content",parent:["affine:note","affine:paragraph","affine:list"]}})},28290:(e,t,i)=>{i.d(t,{A:()=>r,J:()=>o});var s=i(91449);function o(e){let t=e.getBlocksByFlavour("affine:surface");return 0!==t.length?t[0].model:null}let r=(0,s.qy)` `},63820:(e,t,i)=>{i.d(t,{$M:()=>l,A_:()=>a,H8:()=>h,bE:()=>u,pz:()=>c,u2:()=>r,vL:()=>d});let s=globalThis.navigator?.userAgent??"",o=globalThis.navigator?.platform,r="undefined"!=typeof window&&"undefined"!=typeof document,a="undefined"!=typeof process&&!r,n=/Apple Computer/.test(globalThis.navigator?.vendor),l=r&&navigator.userAgent.toLowerCase().indexOf("firefox")>-1;/Android \d/.test(s);let c=n&&(/Mobile\/\w+/.test(s)||globalThis.navigator?.maxTouchPoints>2),d=/Mac/i.test(o),h=/Win/.test(o),u="requestIdleCallback"in globalThis},73134:(e,t,i)=>{var s;i.d(t,{O:()=>s}),function(e){e[e.DefaultRuntimeError=1]="DefaultRuntimeError",e[e.ReactiveProxyError=2]="ReactiveProxyError",e[e.DocCollectionError=3]="DocCollectionError",e[e.ModelCRUDError=4]="ModelCRUDError",e[e.ValueNotExists=5]="ValueNotExists",e[e.ValueNotInstanceOf=6]="ValueNotInstanceOf",e[e.ValueNotEqual=7]="ValueNotEqual",e[e.MigrationError=8]="MigrationError",e[e.SchemaValidateError=9]="SchemaValidateError",e[e.TransformerError=10]="TransformerError",e[e.InlineEditorError=11]="InlineEditorError",e[e.TransformerNotImplementedError=12]="TransformerNotImplementedError",e[e.EdgelessExportError=13]="EdgelessExportError",e[e.CommandError=14]="CommandError",e[e.EventDispatcherError=15]="EventDispatcherError",e[e.SelectionError=16]="SelectionError",e[e.GfxBlockElementError=17]="GfxBlockElementError",e[e.MissingViewModelError=18]="MissingViewModelError",e[e.DatabaseBlockError=19]="DatabaseBlockError",e[e.DefaultFatalError=1e4]="DefaultFatalError",e[e.NoRootModelError=10001]="NoRootModelError",e[e.NoSurfaceModelError=10002]="NoSurfaceModelError",e[e.NoneSupportedSSRError=10003]="NoneSupportedSSRError"}(s||(s={}))},68419:(e,t,i)=>{i.d(t,{H4:()=>o,Ss:()=>s});class s extends Error{constructor(e,t){super(t),this.name="BlockSuiteError",this.code=e,this.isFatal=e>=1e4}}function o(e){if(!(e instanceof s))throw e;if(e.isFatal)throw Error("A fatal error for BlockSuite occurs, please contact the team if you find this.",{cause:e});console.error("A runtime error for BlockSuite occurs, you can ignore this error if it won't break the user experience."),console.error(e.stack)}},71006:(e,t,i)=>{i.d(t,{QV:()=>l,U2:()=>d,Z1:()=>n,j:()=>a,n4:()=>c,nn:()=>h});var s=i(73134),o=i(68419);function r(e){return e!==Object(e)}function a(e){}function n(e,t="val does not exist",i=s.O.ValueNotExists){if(null==e){if(t instanceof Error)throw t;throw new o.Ss(i,t)}}function l(e,t="val exists",i=s.O.ValueNotExists){if(null!=e)throw new o.Ss(i,t)}function c(e,t){let i=r(e),s=r(t);if(i&&s){if(!Object.is(e,t))return!1}else{if(i!==s)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,i)=>c(e,t[i]));if("object"==typeof e&&"object"==typeof t){let i=Object.entries(e),s=Object.entries(t);return i.length===s.length&&i.every((e,t)=>c(e,s[t]))}}return!0}function d(e,t,i="val is not same as expected",r=s.O.ValueNotEqual){if(!c(e,t))throw new o.Ss(r,i)}function h(e,t,i="val is not instance of expected",r=s.O.ValueNotInstanceOf){if(!(e instanceof t))throw new o.Ss(r,i)}},94098:(e,t,i)=>{i.d(t,{z:()=>r});var s=i(54702),o=i(43228);class r{constructor(e=0,t=0,i=0,s=0){this.x=e,this.y=t,this.w=i,this.h=s}static deserialize(e){let[t,i,s,a]=(0,o.W)(e);return new r(t,i,s,a)}static from(e){return new r(e.x,e.y,e.w,e.h)}static fromCenter(e,t,i){let[s,o]=e;return new r(s-t/2,o-i/2,t,i)}static fromDOMRect({left:e,top:t,width:i,height:s}){return new r(e,t,i,s)}static fromPoints(e){let{minX:t,minY:i,maxX:o,maxY:a}=(0,s.lK)(e);return new r(t,i,o-t,a-i)}static fromXYWH(e){return new r(e[0],e[1],e[2],e[3])}static serialize(e){return(0,o.P)(e.x,e.y,e.w,e.h)}clone(){return new r(this.x,this.y,this.w,this.h)}contains(e){return e.x>=this.x&&e.y>=this.y&&e.maxX<=this.maxX&&e.maxY<=this.maxY}containsPoint([e,t]){let{minX:i,minY:s,maxX:o,maxY:r}=this;return i<=e&&e<=o&&s<=t&&t<=r}expand(e,t=e,i=e,s=t){return new r(this.x-e,this.y-t,this.w+e+i,this.h+t+s)}getRelativePoint([e,t]){return[this.x+e*this.w,this.y+t*this.h]}getVerticesAndMidpoints(){return[...this.points,...this.midPoints]}horizontalDistance(e){return Math.min(Math.abs(this.minX-e.maxX),Math.abs(this.maxX-e.minX))}include(e){let t=Math.min(this.x,e[0]),i=Math.min(this.y,e[1]);return new r(t,i,Math.max(this.maxX,e[0])-t,Math.max(this.maxY,e[1])-i)}intersectLine(e,t,i=!1){let o=[];return[[this.tl,this.tr],[this.tl,this.bl],[this.tr,this.br],[this.bl,this.br]].forEach(([r,a])=>{let n=(0,s.$B)(e,t,r,a,i);n&&o.push(n)}),0===o.length?null:o}isHorizontalCross(e){return!(this.maxYe.maxY)}isIntersectWithBound(e,t=s.p8){return e.maxX>this.minX-t&&e.maxY>this.minY-t&&e.minXthis.minX-t&&e.maxY>this.minY-t&&e.minXthis.minX+i&&ethis.minY+i&&te.maxX)}serialize(){return(0,o.P)(this.x,this.y,this.w,this.h)}toRelative([e,t]){return[(e-this.x)/this.w,(t-this.y)/this.h]}toXYWH(){return[this.x,this.y,this.w,this.h]}unite(e){let t=Math.min(this.x,e.x),i=Math.min(this.y,e.y);return new r(t,i,Math.max(this.maxX,e.maxX)-t,Math.max(this.maxY,e.maxY)-i)}verticalDistance(e){return Math.min(Math.abs(this.minY-e.maxY),Math.abs(this.maxY-e.minY))}get bl(){return[this.x,this.y+this.h]}get br(){return[this.x+this.w,this.y+this.h]}get center(){return[this.x+this.w/2,this.y+this.h/2]}set center([e,t]){let[i,s]=this.center;this.x+=e-i,this.y+=t-s}get horizontalLine(){return[[this.x,this.y+this.h/2],[this.x+this.w,this.y+this.h/2]]}get leftLine(){return[[this.x,this.y],[this.x,this.y+this.h]]}get lowerLine(){return[[this.x,this.y+this.h],[this.x+this.w,this.y+this.h]]}get maxX(){return this.x+this.w}get maxY(){return this.y+this.h}get midPoints(){return[[this.x+this.w/2,this.y],[this.x+this.w,this.y+this.h/2],[this.x+this.w/2,this.y+this.h],[this.x,this.y+this.h/2]]}get minX(){return this.x}get minY(){return this.y}get points(){return[[this.x,this.y],[this.x+this.w,this.y],[this.x+this.w,this.y+this.h],[this.x,this.y+this.h]]}get rightLine(){return[[this.x+this.w,this.y],[this.x+this.w,this.y+this.h]]}get tl(){return[this.x,this.y]}get tr(){return[this.x+this.w,this.y]}get upperLine(){return[[this.x,this.y],[this.x+this.w,this.y]]}get verticalLine(){return[[this.x+this.w/2,this.y],[this.x+this.w/2,this.y+this.h]]}}},96509:(e,t,i)=>{i.d(t,{h:()=>r});var s=i(3531),o=i(30827);async function r(e){let t=void 0===crypto.subtle?(0,o.b)(new Uint8Array(e)):await crypto.subtle.digest("SHA-256",e);return(0,s.nk)(new Uint8Array(t)).replace(/\+/g,"-").replace(/\//g,"_")}},69050:(e,t,i)=>{i.d(t,{K:()=>s,O:()=>o});class s{constructor(){this._disposables=[],this._disposed=!1}add(e){"function"==typeof e?this._disposed?e():this._disposables.push({dispose:e}):this._disposed?e.dispose():this._disposables.push(e)}addFromEvent(e,t,i,s){this.add({dispose:()=>{e.removeEventListener(t,i,s)}}),e.addEventListener(t,i,s)}dispose(){r(this._disposables),this._disposables=[],this._disposed=!0}get disposed(){return this._disposed}}function o(e){return{dispose:()=>r(e)}}function r(e){for(let t of e)try{t.dispose()}catch(e){console.error(e)}}},64816:(e,t,i)=>{async function s(e,t){return new Promise(i=>{if(t?.aborted){i();return}let s=!1;t?.addEventListener("abort",()=>{s||(clearTimeout(o),i())});let o=setTimeout(()=>{s=!0,i()},e)})}function o(e){}function r(e,t,{leading:i=!0,trailing:s=!0}={}){let o=null,a=null,n=()=>{a&&s?(e(...a),a=null,o=setTimeout(n,t)):o=null};return function(...s){if(o){a=s;return}i&&e.apply(this,s),o=setTimeout(n,t)}}i.d(t,{lQ:()=>o,nF:()=>r,sg:()=>a,yy:()=>s});let a=(e,t,{leading:i=!0,trailing:s=!0}={})=>{let o=null,r=null,a=()=>{r&&s?(e(...r),r=null,o=setTimeout(a,t)):o=null};return function(...s){o&&(r=s,clearTimeout(o)),i&&!o&&e(...s),o=setTimeout(a,t)}}},54702:(e,t,i)=>{i.d(t,{$B:()=>c,$L:()=>d,Bn:()=>n,Dx:()=>m,Hb:()=>f,W4:()=>g,e0:()=>l,f3:()=>u,lK:()=>function e(t,i=0){let s=1/0,r=1/0,a=-1/0,n=-1/0;if(t.length<1)s=0,r=0,a=1,n=1;else for(let[e,i]of t)s=Math.min(e,s),r=Math.min(i,r),a=Math.max(e,a),n=Math.max(i,n);return 0!==i?e(t.map(e=>o.l.rotWith(e,[(s+a)/2,(r+n)/2],i))):{minX:s,minY:r,maxX:a,maxY:n,width:Math.max(1,a-s),height:Math.max(1,n-r)}},p8:()=>r,qE:()=>p,vo:()=>a,w:()=>h});var s=i(96458),o=i(31716);let r=1e-12;function a(){return Math.floor(2147483648*Math.random())}function n(e,t=({x:e,y:t,w:i,h:s})=>[[e,t],[e+i,t],[e+i,t+s],[e,t+s]]){let{rotate:i}=e,s=t(e);if(i){let{x:t,y:o,w:r,h:a}=e,n=t+r/2,l=o+a/2,c=new DOMMatrix().translateSelf(n,l).rotateSelf(i).translateSelf(-n,-l);s=s.map(e=>{let{x:t,y:i}=new DOMPoint(...e).matrixTransform(c);return[t,i]})}return s}function l(e){let{x:t,y:i,width:s,height:o}=function(e){let{x:t,y:i,w:s,h:o,rotate:r}=e,a=new DOMRect(t,i,s,o);return r?new DOMQuad(...n(e).map(e=>new DOMPoint(...e))).getBounds():a}(e);return{x:t,y:i,w:s,h:o}}function c(e,t,i,s,a=!1){let n=o.l.sub(t,e),l=o.l.sub(s,i),d=o.l.cpr(n,l);if(u(d,0,112e-18))return null;let h=o.l.sub(e,i),f=o.l.cpr(l,h)/d,g=o.l.cpr(n,h)/d,m=-r,v=1+r;return a||mo.l.rotWith(e,t,s))}function g(e,t){let i=e.length;for(let s=0;s=o.l.dpr(r,a)}(t,[r,a]))return o.l.normalize(o.l.sub(a,r))}return[0,0]}function m(e,t,i){let r=[],a=i.length;for(let n=0;n{i.d(t,{S:()=>o});var s=i(31716);class o extends Array{constructor(e=[0,0],t=[0,0],i=[0,0],s=[0,0]){super(2),this._in=[0,0],this._out=[0,0],this._tangent=[0,0],this[0]=e[0],this[1]=e[1],this._tangent=t,this._in=i,this._out=s}static fromVec(e){let t=new o;return t[0]=e[0],t[1]=e[1],t}clone(){return new o(this,this._tangent,this._in,this._out)}setVec(e){return this[0]=e[0],this[1]=e[1],this}toVec(){return[this[0],this[1]]}get absIn(){return s.l.add(this,this._in)}get absOut(){return s.l.add(this,this._out)}get in(){return this._in}set in(e){this._in=e}get length(){return super.length}get out(){return this._out}set out(e){this._out=e}get tangent(){return this._tangent}set tangent(e){this._tangent=e}}},46427:(e,t,i)=>{i.d(t,{b:()=>o});var s=i(54702);class o{constructor(e=0,t=0){this.x=e,this.y=t}static clamp(e,t,i){return new o((0,s.qE)(e.x,t.x,i.x),(0,s.qE)(e.y,t.y,i.y))}static from(e,t){return Array.isArray(e)?new o(e[0],e[1]):"number"==typeof e?new o(e,t??e):new o(e.x,e.y)}static max(e,t){return new o(Math.max(e.x,t.x),Math.max(e.y,t.y))}static min(e,t){return new o(Math.min(e.x,t.x),Math.min(e.y,t.y))}add(e){return new o(this.x+e.x,this.y+e.y)}clone(){return new o(this.x,this.y)}cross(e){return this.x*e.y-this.y*e.x}equals({x:e,y:t}){return this.x===e&&this.y===t}lerp(e,t){return new o(this.x+(e.x-this.x)*t,this.y+(e.y-this.y)*t)}scale(e){return new o(this.x*e,this.y*e)}set(e,t){this.x=e,this.y=t}subtract(e){return new o(this.x-e.x,this.y-e.y)}toArray(){return[this.x,this.y]}}},50620:(e,t,i)=>{i.d(t,{D:()=>o});var s=i(69050);class o{constructor(){this._callbacks=[],this._disposables=[],this._emitting=!1,this.subscribe=(e,t,i)=>{let s;let{filter:o,equalityFn:r=Object.is}=i??{};return this.on(i=>{if(o&&!o(i))return;let a=e(i);void 0!==s&&r(s,a)||(t(a),s=a)})}}dispose(){(0,s.O)(this._disposables).dispose(),this._callbacks=[],this._disposables=[]}emit(e){let t=this._emitting;this._emitting=!0,this._callbacks.forEach(t=>{try{t(e)}catch(e){console.error(e)}}),this._emitting=t}filter(e){let t=new o;return this._disposables.push({dispose:()=>t.dispose()}),this.on(i=>{e(i)&&t.emit(i)}),t}flatMap(e){let t=new o;return this._disposables.push({dispose:()=>t.dispose()}),this.on(i=>{let s=e(i);Array.isArray(s)?s.forEach(e=>t.emit(e)):t.emit(s)}),t}on(e){if(this._emitting){let t=[...this._callbacks,e];this._callbacks=t}else this._callbacks.push(e);return{dispose:()=>{if(this._emitting)this._callbacks=this._callbacks.filter(t=>t!==e);else{let t=this._callbacks.indexOf(e);t>-1&&this._callbacks.splice(t,1)}}}}once(e){let t;let i=this.on(i=>{e(i),t&&t()});return t=i.dispose,i}pipe(e){return this._callbacks.push(t=>e.emit(t)),this}toDispose(e){return e.push(this),this}unshift(e){if(this._emitting){let t=[e,...this._callbacks];this._callbacks=t}else this._callbacks.unshift(e);return{dispose:()=>{if(this._emitting)this._callbacks=this._callbacks.filter(t=>t!==e);else{let t=this._callbacks.indexOf(e);t>-1&&this._callbacks.splice(t,1)}}}}}},31716:(e,t,i)=>{i.d(t,{l:()=>s});class s{static{this.abs=e=>[Math.abs(e[0]),Math.abs(e[1])]}static{this.add=(e,t)=>[e[0]+t[0],e[1]+t[1]]}static{this.addScalar=(e,t)=>[e[0]+t,e[1]+t]}static{this.ang=(e,t)=>Math.atan2(s.cpr(e,t),s.dpr(e,t))}static{this.ang3=(e,t,i)=>{let o=s.vec(t,e),r=s.vec(t,i);return s.ang(o,r)}}static{this.angle=(e,t)=>Math.atan2(t[1]-e[1],t[0]-e[0])}static{this.clockwise=(e,t,i)=>s.isLeft(e,t,i)>0}static{this.cpr=(e,t)=>e[0]*t[1]-t[0]*e[1]}static{this.dist=(e,t)=>Math.hypot(e[1]-t[1],e[0]-t[0])}static{this.dist2=(e,t)=>s.len2(s.sub(e,t))}static{this.distanceToBounds=(e,t)=>s.dist(t,s.nearestPointOnBounds(e,t))}static{this.distanceToLineSegment=(e,t,i,o=!0)=>s.dist(i,s.nearestPointOnLineSegment(e,t,i,o))}static{this.distanceToLineThroughPoint=(e,t,i)=>s.dist(i,s.nearestPointOnLineThroughPoint(e,t,i))}static{this.div=(e,t)=>[e[0]/t,e[1]/t]}static{this.divV=(e,t)=>[e[0]/t[0],e[1]/t[1]]}static{this.dpr=(e,t)=>e[0]*t[0]+e[1]*t[1]}static{this.fastDist=(e,t)=>{let i=[t[0]-e[0],t[1]-e[1]],s=[Math.abs(i[0]),Math.abs(i[1])],o=1/Math.max(s[0],s[1]);return[i[0]*(o*=1.29289-(s[0]+s[1])*o*.29289),i[1]*o]}}static{this.int=(e,t,i,o,r=1)=>{let a=(s.clamp(i,o)-i)/(o-i);return s.add(s.mul(e,1-a),s.mul(t,r))}}static{this.isEqual=(e,t)=>e[0]===t[0]&&e[1]===t[1]}static{this.isLeft=(e,t,i)=>(t[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(t[1]-e[1])}static{this.len=e=>Math.hypot(e[0],e[1])}static{this.len2=e=>e[0]*e[0]+e[1]*e[1]}static{this.lrp=(e,t,i)=>s.add(e,s.mul(s.sub(t,e),i))}static{this.max=(...e)=>[Math.max(...e.map(e=>e[0])),Math.max(...e.map(e=>e[1]))]}static{this.med=(e,t)=>s.mul(s.add(e,t),.5)}static{this.min=(...e)=>[Math.min(...e.map(e=>e[0])),Math.min(...e.map(e=>e[1]))]}static{this.mul=(e,t)=>[e[0]*t,e[1]*t]}static{this.mulV=(e,t)=>[e[0]*t[0],e[1]*t[1]]}static{this.nearestPointOnBounds=(e,t)=>[s.clamp(t[0],e.minX,e.maxX),s.clamp(t[1],e.minY,e.maxY)]}static{this.nearestPointOnLineSegment=(e,t,i,o=!0)=>{let r=s.uni(s.sub(t,e)),a=s.add(e,s.mul(r,s.pry(s.sub(i,e),r)));if(o){if(a[0]Math.max(e[0],t[0]))return e[0]>t[0]?e:t;if(a[1]Math.max(e[1],t[1]))return e[1]>t[1]?e:t}return a}}static{this.nearestPointOnLineThroughPoint=(e,t,i)=>s.add(e,s.mul(t,s.pry(s.sub(i,e),t)))}static{this.neg=e=>[-e[0],-e[1]]}static{this.normalize=e=>s.uni(e)}static{this.nudge=(e,t,i)=>s.isEqual(e,t)?e:s.add(e,s.mul(s.uni(s.sub(t,e)),i))}static{this.nudgeAtAngle=(e,t,i)=>[Math.cos(t)*i+e[0],Math.sin(t)*i+e[1]]}static{this.per=e=>[e[1],-e[0]]}static{this.pointOffset=(e,t,i)=>{let o=s.uni(s.sub(t,e));return s.isEqual(e,t)&&(o=e),s.add(e,s.mul(o,i))}}static{this.pointsBetween=(e,t,i=6)=>Array.from({length:i}).map((o,r)=>{let a=r/(i-1),n=Math.min(1,.5+Math.abs(.5-a));return[...s.lrp(e,t,a),n]})}static{this.pry=(e,t)=>s.dpr(e,t)/s.len(t)}static{this.rescale=(e,t)=>{let i=s.len(e);return[t*e[0]/i,t*e[1]/i]}}static{this.rot=(e,t=0)=>[e[0]*Math.cos(t)-e[1]*Math.sin(t),e[0]*Math.sin(t)+e[1]*Math.cos(t)]}static{this.rotWith=(e,t,i=0)=>{if(0===i)return e;let s=Math.sin(i),o=Math.cos(i),r=e[0]-t[0],a=e[1]-t[1];return[r*o-a*s+t[0],r*s+a*o+t[1]]}}static{this.slope=(e,t)=>e[0]===t[0]?NaN:(e[1]-t[1])/(e[0]-t[0])}static{this.sub=(e,t)=>[e[0]-t[0],e[1]-t[1]]}static{this.subScalar=(e,t)=>[e[0]-t,e[1]-t]}static{this.tangent=(e,t)=>s.uni(s.sub(e,t))}static{this.toFixed=e=>e.map(e=>Math.round(100*e)/100)}static{this.toPoint=e=>({x:e[0],y:e[1]})}static{this.toPrecision=(e,t=4)=>[+e[0].toPrecision(t),+e[1].toPrecision(t)]}static{this.toVec=e=>[e.x,e.y]}static{this.uni=e=>s.div(e,s.len(e))}static{this.vec=(e,t)=>[t[0]-e[0],t[1]-e[1]]}static clamp(e,t,i){return Math.max(t,void 0!==i?Math.min(e,i):e)}static clampV(e,t,i){return e.map(e=>void 0!==i?s.clamp(e,t,i):s.clamp(e,t))}static cross(e,t,i){return(t[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(t[1]-e[1])}static snap(e,t=1){return[Math.round(e[0]/t)*t,Math.round(e[1]/t)*t]}}},43228:(e,t,i)=>{function s(e,t,i,s){return`[${e},${t},${i},${s}]`}function o(e){try{return JSON.parse(e)}catch(t){return console.error("Failed to deserialize xywh",e),console.error(t),[0,0,0,0]}}i.d(t,{P:()=>s,W:()=>o})},46317:(e,t,i)=>{i.d(t,{jN:()=>d,hq:()=>er,gT:()=>H,rM:()=>P,GZ:()=>c,pe:()=>l,oe:()=>E,BS:()=>A,zA:()=>S});var s=i(68419),o=i(73134),r=i(91449),a=i(4564),n=i(54719);let l="​",c="‌",d="data-v-root";var h=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},u=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,c,p=[(0,a.EM)("v-element")],f=[],g=r.WF,m=[],v=[],y=[],b=[];return class extends g{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(g[Symbol.metadata]??null):void 0;i=[(0,a.MZ)({type:Object})],c=[(0,a.MZ)({attribute:!1})],h(this,null,i,{kind:"accessor",name:"delta",static:!1,private:!1,access:{has:e=>"delta"in e,get:e=>e.delta,set:(e,t)=>{e.delta=t}},metadata:s},m,v),h(this,null,c,{kind:"accessor",name:"selected",static:!1,private:!1,access:{has:e=>"selected"in e,get:e=>e.selected,set:(e,t)=>{e.selected=t}},metadata:s},y,b),h(null,e={value:t},p,{kind:"class",name:t.name,metadata:s},null,f),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),u(t,f)}createRenderRoot(){return this}render(){let e=function(e){let t=e.closest(`[${d}]`);return t?t.inlineEditor||(console.error("element must be inside a v-root with inline-editor"),null):(console.error("element must be inside a v-root"),null)}(this);if(!e)return r.s6;let t=e.attributeService.attributeRenderer;if(e.isEmbed(this.delta)){if(1!==this.delta.insert.length)throw new s.Ss(o.O.InlineEditorError,`The length of embed node should only be 1. This seems to be an internal issue with inline editor. Please go to https://github.com/toeverything/blocksuite/issues to report it.`);return(0,r.qy)`${t(this.delta,this.selected)}`}return(0,r.qy)`${t(this.delta,this.selected)}`}#iu=u(this,m,{insert:l});get delta(){return this.#iu}set delta(e){this.#iu=e}#lv=(u(this,v),u(this,y,!1));get selected(){return this.#lv}set selected(e){this.#lv=e}constructor(){super(...arguments),u(this,b)}},t})();var f=i(71006);let g=(0,r.qy)``;var m=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},v=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,c,h=[(0,a.EM)("v-line")],u=[],p=r.WF,y=[],b=[],w=[],x=[];return class extends p{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;i=[(0,a.MZ)({attribute:!1})],c=[(0,a.MZ)({attribute:!1})],m(this,null,i,{kind:"accessor",name:"elements",static:!1,private:!1,access:{has:e=>"elements"in e,get:e=>e.elements,set:(e,t)=>{e.elements=t}},metadata:s},y,b),m(this,null,c,{kind:"accessor",name:"index",static:!1,private:!1,access:{has:e=>"index"in e,get:e=>e.index,set:(e,t)=>{e.index=t}},metadata:s},w,x),m(null,e={value:t},h,{kind:"class",name:t.name,metadata:s},null,u),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),v(t,u)}createRenderRoot(){return this}firstUpdated(){this.style.display="block",this.addEventListener("mousedown",e=>{if(e.detail>=3){e.preventDefault();let t=document.createRange();t.selectNodeContents(this);let i=window.getSelection();(0,f.Z1)(i),i.removeAllRanges(),i.addRange(t)}})}async getUpdateComplete(){let e=await super.getUpdateComplete();return await Promise.all(this.vElements.map(e=>e.updateComplete)),await Promise.all(this.vTexts.map(e=>e.updateComplete)),e}render(){if(this.isConnected)return this.inlineEditor.vLineRenderer?this.inlineEditor.vLineRenderer(this):this.renderVElements()}renderVElements(){if(0===this.elements.length)return(0,r.qy)`
    `;let e=this.inlineEditor,t=this.elements.flatMap(([t,i],r)=>{if(e.isEmbed(i)){if(1!==i.insert.length)throw new s.Ss(o.O.InlineEditorError,`The length of embed node should only be 1. This seems to be an internal issue with inline editor. Please go to https://github.com/toeverything/blocksuite/issues to report it.`);if(0===r){let i=this.elements[r+1]?.[1];return!i||e.isEmbed(i)?[g,t,g]:[g,t]}{let i=this.elements[r+1]?.[1];return!i||e.isEmbed(i)?[t,g]:[t]}}return t});return(0,r.qy)`
    ${t}
    `}get inlineEditor(){let e=this.closest(`[${d}]`);(0,f.Z1)(e,"v-line must be inside a v-root");let t=e.inlineEditor;return(0,f.Z1)(t,"v-line must be inside a v-root with inline-editor"),t}get vElements(){return Array.from(this.querySelectorAll("v-element"))}get vTextContent(){return this.vElements.reduce((e,t)=>e+t.delta.insert,"")}get vTextLength(){return this.vElements.reduce((e,t)=>e+t.delta.insert.length,0)}get vTexts(){return Array.from(this.querySelectorAll("v-text"))}#oB=v(this,y,[]);get elements(){return this.#oB}set elements(e){this.#oB=e}#i=(v(this,b),v(this,w,void 0));get index(){return this.#i}set index(e){this.#i=e}constructor(){super(...arguments),v(this,x)}},t})();var b=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},w=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,a.EM)("v-text")],s=[],o=r.WF,c=[],d=[];(class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;b(this,null,[(0,a.MZ)({attribute:!1})],{kind:"accessor",name:"str",static:!1,private:!1,access:{has:e=>"str"in e,get:e=>e.str,set:(e,t)=>{e.str=t}},metadata:r},c,d),b(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),w(t,s)}createRenderRoot(){return this}render(){return(0,r.qy)`${this.str}`}#cO=w(this,c,l);get str(){return this.#cO}set str(e){this.#cO=e}constructor(){super(...arguments),w(this,d)}})})();var x=i(69050),_=i(50620),C=i(16820);class k{constructor(e,t={}){this.editor=e,this.hooks=t}}let S=()=>e=>{let t=e.attributes?function(e){let t="";e.underline&&(t+="underline"),e.strike&&(t+=" line-through");let i={};return e.code&&(i={"font-family":'"SFMono-Regular", Menlo, Consolas, "PT Mono", "Liberation Mono", Courier, monospace',"line-height":"normal",background:"rgba(135,131,120,0.15)",color:"#EB5757","border-radius":"3px","font-size":"85%",padding:"0.2em 0.4em"}),(0,n.W)({"font-weight":e.bold?"bold":"normal","font-style":e.italic?"italic":"normal","text-decoration":t.length>0?t:"none",...i})}(e.attributes):(0,n.W)({});return(0,r.qy)``};var M=i(67448);let E=M.z.object({bold:M.z.literal(!0).optional().nullable().catch(void 0),italic:M.z.literal(!0).optional().nullable().catch(void 0),underline:M.z.literal(!0).optional().nullable().catch(void 0),strike:M.z.literal(!0).optional().nullable().catch(void 0),code:M.z.literal(!0).optional().nullable().catch(void 0),link:M.z.string().optional().nullable().catch(void 0)});function I(e){let t=[],i=e.insert;for(;i.length>0;){let s=i.indexOf("\n");if(-1===s){t.push({insert:i,attributes:e.attributes});break}i.slice(0,s).length>0&&t.push({insert:i.slice(0,s),attributes:e.attributes}),t.push("\n"),i=i.slice(s+1)}return t}function B(e){return e instanceof Element?e instanceof p?null!==e.querySelector('[data-v-embed="true"]'):!!e.closest('[data-v-embed="true"]'):!!e.parentElement?.closest('[data-v-embed="true"]')}function $(e,t){let i=[];for(let s of t)if(e.isEmbed(s)){let e=[...s.insert].map(e=>({insert:e,attributes:s.attributes}));i.push(...e)}else i.push(s);return i}var T=i(63820);let O=T.pz||T.vL?"metaKey":"ctrlKey",P=!1,H=!0;function A(e,t){let i={};return Object.values(t).forEach(e=>{!function(e){let t=(e.shortKey&&(e[O]=e.shortKey,delete e.shortKey),e);(Array.isArray(t.key)?t.key:[t.key]).forEach(e=>{let s={...t,key:e};i[e]=i[e]??[],i[e].push(s)})}(e)}),function(t){let s,o;if(t.defaultPrevented||t.isComposing)return;let r=(i[t.key]??[]).filter(e=>!["altKey","ctrlKey","metaKey","shiftKey"].some(i=>Object.hasOwn(e,i)&&e[i]!==t[i])&&e.key===t.key);if(0===r.length)return;let a=e.getInlineRange();if(!a)return;let n=e.getTextPoint(a.index);if(!n)return;let[l,c]=n;if(0===a.length)s=l,o=c;else{let t=e.getTextPoint(a.index+a.length);if(!t)return;[s,o]=t}let d=l.textContent?l.textContent.slice(0,c):"",h=s.textContent?s.textContent.slice(o):"",u={inlineRange:a,inlineEditor:e,collapsed:0===a.length,prefixText:d,suffixText:h,raw:t};r.some(e=>(!e.prefix||!!e.prefix.test(u.prefixText))&&(!e.suffix||!!e.suffix.test(u.suffixText))&&e.handler(u)===P)&&t.preventDefault()}}function L(e){return e.wholeText===l?0:e.wholeText.length}function D(e){return Array.from(e.querySelectorAll('[data-v-text="true"]')).flatMap(e=>Array.from(e.childNodes).find(e=>e instanceof Text)||[])}function Z(e,t){if(e instanceof Text&&e.parentElement?.dataset.vText==="true")return[e,t];if(e instanceof HTMLElement&&("true"===e.dataset.vElement||e instanceof p)){let i=D(e),s=i[0].parentElement?.closest('[data-v-element="true"]');if(1===i.length&&s instanceof HTMLElement&&"true"===s.dataset.vEmbed)return[i[0],0];if(i.length>0)return i[t]?[i[t],0]:null}if(e instanceof HTMLElement&&(e instanceof y||e.parentElement instanceof y)||e instanceof HTMLElement&&"true"===e.dataset.vRoot)return V(e,t,!0);if(!(e instanceof Node))return null;let i=function(e){let t=e.parentElement?.closest("v-line");if(t)return Array.from(t.querySelectorAll("v-element"));let i=e instanceof Element?e.closest(`[${d}]`):e.parentElement?.closest(`[${d}]`);return i?Array.from(i.querySelectorAll("v-line")):null}(e);return i?function(e,t,i){let s=e[0];for(let o=0;oe.contains(t)&&e.contains(i),N=({rootElement:e,startText:t,endText:i,startTextOffset:s,endTextOffset:o})=>{let r=j(t,s,e),a=j(i,o,e);return r&&a?{index:Math.min(r.index,a.index),length:Math.abs(r.index-a.index)}:null},q=({rootElement:e,startText:t,endText:i})=>!e.contains(t)&&e.contains(i),U=({rootElement:e,endText:t,endTextOffset:i})=>{let s=j(t,i,e);return s?{index:0,length:s.index}:null},W=({rootElement:e,startText:t,endText:i})=>e.contains(t)&&!e.contains(i),G=({yText:e,rootElement:t,startText:i,startTextOffset:s})=>{let o=j(i,s,t);return o?{index:o.index,length:e.length-o.index}:null},Y=({rootElement:e,startText:t,endText:i,range:s})=>!e.contains(t)&&!e.contains(i)&&s.intersectsNode(e),K=({yText:e})=>({index:0,length:e.length}),X=(e,t,i)=>{let{startContainer:s,startOffset:o,endContainer:r,endOffset:a}=e,n=Z(s,o),l=Z(r,a);if(!n||!l)return null;let[c,d]=n,[h,u]=l;return{rootElement:t,range:e,yText:i,startNode:s,startOffset:o,endNode:r,endOffset:a,startText:c,startTextOffset:d,endText:h,endTextOffset:u}};class Q{constructor(e){this.editor=e,this._attributeRenderer=S(),this._attributeSchema=E,this._marks=null,this.getFormat=(e,t=!1)=>{let i=this.editor.deltaService.getDeltasByInlineRange(e).filter(([t,i])=>i.index+i.length>e.index&&i.index<=e.index+e.length).map(([e])=>e.attributes);return t?i.reduce((e,t)=>({...e,...t}),{}):!i.length||i.some(e=>!e)?{}:i.reduce((e,t)=>{let i={};for(let s in e)e[s]===t[s]&&(i[s]=e[s]);return i})},this.normalizeAttributes=e=>{if(!e)return;let t=this._attributeSchema.safeParse(e);if(!t.success){console.error(t.error);return}return Object.fromEntries(Object.entries(t.data).filter(([e,t])=>t||null===t))},this.resetMarks=()=>{this._marks=null},this.setAttributeRenderer=e=>{this._attributeRenderer=e},this.setAttributeSchema=e=>{this._attributeSchema=e},this.setMarks=e=>{this._marks=e}}get attributeRenderer(){return this._attributeRenderer}get marks(){return this._marks}}var J=i(22805);class ee{constructor(e){this.editor=e,this.getDeltaByRangeIndex=e=>{let t=this.deltas,i=0;for(let s of t){if(i+s.insert.length>=e)return s;i+=s.insert.length}return null},this.getDeltasByInlineRange=e=>this.mapDeltasInInlineRange(e,(e,t)=>[e,{index:t,length:e.insert.length}]),this.mapDeltasInInlineRange=(e,t,i=!1)=>{let s=i?$(this.editor,this.deltas):this.deltas,o=[];return s.reduce((i,s,r)=>{let a=s.insert.length,n=e.index-a,l=e.index+e.length;if(i>=n&&(i{if(!this.editor.mounted)return;this.editor.slots.render.emit();let t=this.editor.rootElement,i=function(e){return 0===e.length?[[]]:Array.from(function*(e){let t=0;for(let i=0;i{if(!(e.length>0))return(0,r.qy)``;{let i=[];e.forEach(e=>{i.push([e,s]),s++});let o=i.map(([e,t])=>{let i=!1,s=this.editor.getInlineRange();return s&&(i=this.isNormalizedDeltaSelected(t,s)),[function(e,t,i){return(0,r.qy)``}(e,this.editor.attributeService.normalizeAttributes,i),e]});return(0,r.qy)``}});try{(0,r.XX)((0,J.u)(o.map((e,t)=>({line:e,index:t})),e=>e.index,e=>e.line),t)}catch(e){this.editor.rerenderWholeEditor(),await this.editor.waitForUpdate()}await this.editor.waitForUpdate(),e&&this.editor.rangeService.syncInlineRange(),this.editor.slots.renderComplete.emit()}}isNormalizedDeltaSelected(e,t){let i=!1;return t.length>=1&&this.editor.mapDeltasInInlineRange(t,(s,o,r)=>{r===e&&o>=t.index&&(i=!0)},!0),i}get deltas(){return this.editor.yText.toDelta()}}function et(e,t){return e===t||!!e&&!!t&&e.index===t.index&&e.length===t.length}class ei{constructor(e){this.editor=e,this._compositionInlineRange=null,this._isComposing=!1,this._isRangeCompletelyInRoot=e=>{let t=this.editor.rootElement,i=document.createRange();return(i.selectNode(t),e.startContainer.compareDocumentPosition(e.endContainer)&Node.DOCUMENT_POSITION_FOLLOWING)?i.comparePoint(e.startContainer,e.startOffset)>=0&&0>=i.comparePoint(e.endContainer,e.endOffset):i.comparePoint(e.endContainer,e.startOffset)>=0&&0>=i.comparePoint(e.startContainer,e.endOffset)},this._onBeforeInput=e=>{let t=this.editor.rangeService.getNativeRange();if(this.editor.isReadonly||this._isComposing||!t||!this._isRangeCompletelyInRoot(t))return;let i=this.editor.toInlineRange(t);if(!i)return;let s=!0;if(e.inputType.startsWith("delete")&&(function(e){let t=e instanceof Element?e:e.parentElement;return!!t&&!!t.closest('[data-v-embed-gap="true"]')}(t.commonAncestorContainer)&&0===i.length&&i.index>0?(i={index:i.index-1,length:1},s=!1):function(e){let t=e instanceof Element?e:e.parentElement,i=t?.closest("v-line");return!!i&&0===i.vTextLength}(t.commonAncestorContainer)&&0===i.length&&i.index>0&&(i={index:i.index-1,length:1},s=!1)),s){let t=e.getTargetRanges();if(t.length>0){let e=t[0],s=document.createRange();s.setStart(e.startContainer,e.startOffset),s.setEnd(e.endContainer,e.endOffset);let o=this.editor.toInlineRange(s);et(i,o)||(i=o)}}if(!i)return;e.preventDefault();let o={inlineEditor:this.editor,raw:e,inlineRange:i,data:e.data??e.dataTransfer?.getData("text/plain")??null,attributes:{}};this.editor.hooks.beforeinput?.(o),function(e,t,i,s,o){if(o.isValidInlineRange(s)){var r;if("insertText"===e)t&&(o.insertText(s,t,i),o.setInlineRange({index:s.index+t.length,length:0}));else if("insertParagraph"===e||"insertLineBreak"===e)o.insertLineBreak(s),o.setInlineRange({index:s.index+1,length:0});else if(e.startsWith("delete"))o.deleteText(s),o.setInlineRange({index:s.index,length:0});else{if("insertReplacementText"!==e)return;r=i,o.getDeltasByInlineRange(s).forEach(e=>{r={...e[0].attributes,...r}}),t&&(o.insertText(s,t,r),o.setInlineRange({index:s.index+t.length,length:0}))}}}(o.raw.inputType,o.data,o.attributes,o.inlineRange,this.editor),this.editor.slots.inputting.emit()},this._onClick=e=>{if(e.target instanceof Node&&B(e.target)){let t=document.getSelection();if(t){if(e.target instanceof HTMLElement){let i=e.target.closest("v-element");i&&t.selectAllChildren(i)}else{let i=e.target.parentElement?.closest("v-element");i&&t.selectAllChildren(i)}}}},this._onCompositionEnd=async e=>{if(this._isComposing=!1,!this.editor.rootElement.isConnected)return;let t=this.editor.rangeService.getNativeRange();if(this.editor.isReadonly||!t||!this._isRangeCompletelyInRoot(t))return;this.editor.rerenderWholeEditor(),await this.editor.waitForUpdate();let i=this._compositionInlineRange;if(!i)return;e.preventDefault();let s={inlineEditor:this.editor,raw:e,inlineRange:i,data:e.data,attributes:{}};this.editor.hooks.compositionEnd?.(s);let{inlineRange:o,data:r}=s;r&&r.length>0&&(this.editor.insertText(o,r,s.attributes),this.editor.setInlineRange({index:o.index+r.length,length:0},!1)),this.editor.slots.inputting.emit()},this._onCompositionStart=()=>{this._isComposing=!0,this.editor.rootElement.querySelectorAll('[data-v-embed="true"]').forEach(e=>{e.removeAttribute("contenteditable")});let e=this.editor.rangeService.getNativeRange();e?this._compositionInlineRange=this.editor.toInlineRange(e):this._compositionInlineRange=null},this._onCompositionUpdate=()=>{if(!this.editor.rootElement.isConnected)return;let e=this.editor.rangeService.getNativeRange();!this.editor.isReadonly&&e&&this._isRangeCompletelyInRoot(e)&&this.editor.slots.inputting.emit()},this._onKeyDown=e=>{let t=this.editor.getInlineRange();if(t&&(this.editor.slots.keydown.emit(e),!e.shiftKey&&("ArrowLeft"===e.key||"ArrowRight"===e.key))){if(0!==t.length)return;let i=()=>{e.preventDefault(),e.stopPropagation()},s=this.editor.getDeltasByInlineRange(t);if(2===s.length)"ArrowLeft"===e.key&&this.editor.isEmbed(s[0][0])?(i(),this.editor.setInlineRange({index:t.index-1,length:1})):"ArrowRight"===e.key&&this.editor.isEmbed(s[1][0])&&(i(),this.editor.setInlineRange({index:t.index,length:1}));else if(1===s.length){let o=s[0][0];this.editor.isEmbed(o)&&("ArrowLeft"===e.key&&t.index-1>=0?(i(),this.editor.setInlineRange({index:t.index-1,length:1})):"ArrowRight"===e.key&&t.index+1<=this.editor.yTextLength&&(i(),this.editor.setInlineRange({index:t.index,length:1})))}}},this._onSelectionChange=()=>{let e=this.editor.rootElement,t=this.editor.getInlineRange();if(this._isComposing)return;let i=document.getSelection();if(!i)return;if(0===i.rangeCount){null!==t&&this.editor.setInlineRange(null,!1);return}let s=i.getRangeAt(0);if(!s.intersectsNode(e)){if(s.endContainer.contains(e)&&1===Array.from(s.endContainer.childNodes).filter(e=>e instanceof HTMLElement).length&&s.startContainer.contains(e)&&1===Array.from(s.startContainer.childNodes).filter(e=>e instanceof HTMLElement).length){this.editor.focusEnd();return}null!==t&&this.editor.setInlineRange(null,!1);return}this._previousAnchor=[s.startContainer,s.startOffset],this._previousFocus=[s.endContainer,s.endOffset];let o=this.editor.toInlineRange(i.getRangeAt(0));et(t,o)||this.editor.setInlineRange(o,!1),((s.startContainer.nodeType!==Node.TEXT_NODE||s.endContainer.nodeType!==Node.TEXT_NODE)&&s.startContainer!==this._previousAnchor[0]&&s.endContainer!==this._previousFocus[0]&&s.startOffset!==this._previousAnchor[1]&&s.endOffset!==this._previousFocus[1]||s.startContainer.nodeType===Node.COMMENT_NODE||s.endContainer.nodeType===Node.COMMENT_NODE)&&this.editor.syncInlineRange()},this._previousAnchor=null,this._previousFocus=null,this.mount=()=>{let e=this.editor.eventSource,t=this.editor.rootElement;if(this.inlineRangeProvider||this.editor.disposables.addFromEvent(document,"selectionchange",this._onSelectionChange),!e){console.error("Mount inline editor without event source ready");return}this.editor.disposables.addFromEvent(e,"beforeinput",this._onBeforeInput),this.editor.disposables.addFromEvent(e,"compositionstart",this._onCompositionStart),this.editor.disposables.addFromEvent(e,"compositionupdate",this._onCompositionUpdate),this.editor.disposables.addFromEvent(e,"compositionend",e=>{this._onCompositionEnd(e).catch(console.error)}),this.editor.disposables.addFromEvent(e,"keydown",this._onKeyDown),this.editor.disposables.addFromEvent(t,"click",this._onClick)}}get inlineRangeProvider(){return this.editor.inlineRangeProvider}get isComposing(){return this._isComposing}}class es{constructor(e){this.editor=e,this._applyInlineRange=e=>{let t=document.getSelection();if(t)try{let i=this.toDomRange(e);if(!i)return;t.removeAllRanges(),t.addRange(i),this.editor.slots.inlineRangeApply.emit(i)}catch(e){console.error("failed to apply inline range"),console.error(e)}},this._inlineRange=null,this._lastEndRelativePosition=null,this._lastStartRelativePosition=null,this.focusEnd=()=>{this.setInlineRange({index:this.editor.yTextLength,length:0})},this.focusIndex=e=>{this.setInlineRange({index:e,length:0})},this.focusStart=()=>{this.setInlineRange({index:0,length:0})},this.getInlineRange=()=>this.inlineRangeProvider?this.inlineRangeProvider.getInlineRange():this._inlineRange,this.getInlineRangeFromElement=e=>{let t=document.createRange(),i=e.querySelector("[data-v-text]");if(!i)return null;let s=i.childNodes[1];return(0,f.Z1)(s instanceof Text),t.setStart(s,0),t.setEnd(s,s.textContent?.length??0),this.toInlineRange(t)},this.isFirstLine=e=>{if(!e||e.length>0)return!1;let t=this.toDomRange(e);if(!t)return console.error("failed to convert inline range to domRange"),!1;if(this.editor.yTextString.slice(0,e.index).includes("\n"))return!1;let i=t.commonAncestorContainer.parentElement;(0,f.Z1)(i);let s=i.getBoundingClientRect(),o=t.getClientRects();return 1>Math.abs(o[o.length-1].top-s.top)},this.isLastLine=e=>{if(!e||e.length>0||this.editor.yTextString.slice(e.index).includes("\n"))return!1;let t=this.toDomRange(e);if(!t)return console.error("failed to convert inline range to domRange"),!1;let i=t.commonAncestorContainer.parentElement;(0,f.Z1)(i);let s=i.getBoundingClientRect(),o=t.getClientRects();return 1>Math.abs(o[o.length-1].bottom-s.bottom)},this.isValidInlineRange=e=>!(e&&(e.index<0||e.index+e.length>this.editor.yText.length)),this.onInlineRangeUpdated=async([e,t])=>{if(!et(this._inlineRange,e)&&(this._inlineRange=e,e?(this._lastStartRelativePosition=C.createRelativePositionFromTypeIndex(this.yText,e.index),this._lastEndRelativePosition=C.createRelativePositionFromTypeIndex(this.yText,e.index+e.length)):(this._lastStartRelativePosition=null,this._lastEndRelativePosition=null),this.editor.mounted&&(await this.editor.waitForUpdate(),T.bE?requestIdleCallback(()=>{this.editor.requestUpdate(!1)}):Promise.resolve().then(()=>{this.editor.requestUpdate(!1)}).catch(console.error)),t)){if(null===this._inlineRange){let e=document.getSelection();e&&e.rangeCount>0&&e.getRangeAt(0).intersectsNode(this.editor.rootElement)&&e.removeAllRanges();return}requestAnimationFrame(()=>{this.syncInlineRange()})}},this.selectAll=()=>{this.setInlineRange({index:0,length:this.editor.yTextLength})},this.setInlineRange=(e,t=!0)=>{if(!this.isValidInlineRange(e)){console.error("invalid inline range");return}if(this.inlineRangeProvider){this.inlineRangeProvider.setInlineRange(e,t);return}this.editor.slots.inlineRangeUpdate.emit([e,t])},this.syncInlineRange=()=>{let e=this.getInlineRange();e&&this.editor.mounted&&this._applyInlineRange(e)},this.toDomRange=e=>(function(e,t){let i=Array.from(e.querySelectorAll("v-line")),r=null,a=null,n=0,l=0,c=0;for(let e=0;e=t.index&&(r=e,n=t.index-c),!a&&c+i>=t.index+t.length&&(a=e,l=t.index+t.length-c),r&&a)break;c+=i}c+=1}if(!r||!a)return null;if(B(r)){let e=r.parentElement?.closest("v-element");if(!e)throw new s.Ss(o.O.InlineEditorError,"failed to find vElement for a text note in an embed element");let t=e.nextElementSibling;if(!t)throw new s.Ss(o.O.InlineEditorError,"failed to find nextSibling sibling of an embed element");let i=D(t);if(0===i.length)throw new s.Ss(o.O.InlineEditorError,"text node in v-text not found");t instanceof p?n=L(r=i[i.length-1]):(r=i[0],n=0)}if(B(a)){let e=a.parentElement?.closest("v-element");if(!e)throw new s.Ss(o.O.InlineEditorError,"failed to find vElement for a text note in an embed element");let t=e.nextElementSibling;if(!t)throw new s.Ss(o.O.InlineEditorError,"failed to find nextSibling sibling of an embed element");let i=D(t);if(0===i.length)throw new s.Ss(o.O.InlineEditorError,"text node in v-text not found");a=i[0],l=0}let d=document.createRange();return d.setStart(r,n),d.setEnd(a,l),d})(this.editor.rootElement,e),this.toInlineRange=e=>{let{rootElement:t,yText:i}=this.editor;return function(e,t,i){let s=X(e,t,i);if(!s)return null;if(s.startNode&&s.startNode===s.endNode&&B(s.startNode)){let e=j(s.startText,s.startTextOffset,t);if(e)return{index:e.index,length:1}}return F(s)?N(s):q(s)?U(s):W(s)?G(s):Y(s)?K(s):null}(e,t,i)}}getLine(e){let t=Array.from(this.rootElement.querySelectorAll("v-line")),i=0;for(let[s,o]of t.entries()){if(e>=i&&e=e)return[s,e-i];i+=L(s)}i+=1}return null}get inlineRangeProvider(){return this.editor.inlineRangeProvider}get lastEndRelativePosition(){return this._lastEndRelativePosition}get lastStartRelativePosition(){return this._lastStartRelativePosition}get rootElement(){return this.editor.rootElement}get yText(){return this.editor.yText}}class eo{constructor(e){this.editor=e,this.deleteText=e=>{this.editor.isReadonly||this.transact(()=>{this.yText.delete(e.index,e.length)})},this.formatText=(e,t,i={})=>{if(this.editor.isReadonly)return;let{match:s=()=>!0,mode:o="merge"}=i;this.editor.deltaService.getDeltasByInlineRange(e).filter(([e,t])=>s(e,t)).forEach(([i,s])=>{let r=this.editor.attributeService.normalizeAttributes(t);if(!r)return;let a=function(e,t){if(!(e.index<=t.index+t.length)||!(e.index+e.length>=t.index))return null;let i=Math.max(e.index,t.index),s=Math.min(e.index+e.length,t.index+t.length)-i;return{index:i,length:s}}(e,s);a&&("replace"===o&&this.resetText(a),this.transact(()=>{this.yText.format(a.index,a.length,r)}))})},this.insertLineBreak=e=>{this.editor.isReadonly||this.transact(()=>{this.yText.delete(e.index,e.length),this.yText.insert(e.index,"\n")})},this.insertText=(e,t,i={})=>{if(this.editor.isReadonly)return;this.editor.attributeService.marks&&(i={...i,...this.editor.attributeService.marks});let r=this.editor.attributeService.normalizeAttributes(i);if(!t||!t.length)throw new s.Ss(o.O.InlineEditorError,"text must not be empty");this.transact(()=>{this.yText.delete(e.index,e.length),this.yText.insert(e.index,t,r)})},this.resetText=e=>{if(this.editor.isReadonly)return;let t=[];for(let i=e.index;i<=e.index+e.length;i++){let e=this.editor.getDeltaByRangeIndex(i);e&&t.push(e)}let i=Object.fromEntries(t.flatMap(e=>e.attributes?Object.keys(e.attributes).map(e=>[e,null]):[]));this.transact(()=>{this.yText.format(e.index,e.length,{...i})})},this.setText=(e,t={})=>{this.editor.isReadonly||this.transact(()=>{this.yText.delete(0,this.yText.length),this.yText.insert(0,e,t)})},this.transact=this.editor.transact}get yText(){return this.editor.yText}}class er{static{this.getTextNodesFromElement=D}static{this.nativePointToTextPoint=Z}static{this.textPointToDomPoint=j}constructor(e,t={}){if(this._attributeService=new Q(this),this._deltaService=new ee(this),this._disposables=new x.K,this._eventService=new ei(this),this._eventSource=null,this._isReadonly=!1,this._mounted=!1,this._onYTextChange=(e,t)=>{if(this.yText.toString().includes("\r"))throw new s.Ss(o.O.InlineEditorError,'yText must not contain "\\r" because it will break the range synchronization');this.slots.textChange.emit(),Promise.resolve().then(()=>{if(this.deltaService.render().catch(console.error),!this.rangeService.getInlineRange()||t.local)return;let e=this.rangeService.lastStartRelativePosition,i=this.rangeService.lastEndRelativePosition;if(!e||!i)return;let s=this.yText.doc;(0,f.Z1)(s);let o=C.createAbsolutePositionFromRelativePosition(e,s),r=C.createAbsolutePositionFromRelativePosition(i,s),a=o?.index,n=r?.index;if(!a||!n)return;let l={index:a,length:n-a};this.isValidInlineRange(l)&&this.setInlineRange(l)}).catch(console.error)},this._rangeService=new es(this),this._rootElement=null,this._textService=new eo(this),this.deleteText=this._textService.deleteText,this.focusEnd=this.rangeService.focusEnd,this.focusIndex=this.rangeService.focusIndex,this.focusStart=this.rangeService.focusStart,this.formatText=this._textService.formatText,this.getDeltaByRangeIndex=this.deltaService.getDeltaByRangeIndex,this.getDeltasByInlineRange=this.deltaService.getDeltasByInlineRange,this.getFormat=this._attributeService.getFormat,this.getInlineRange=this.rangeService.getInlineRange,this.getInlineRangeFromElement=this.rangeService.getInlineRangeFromElement,this.getLine=this.rangeService.getLine,this.getNativeSelection=this.rangeService.getNativeSelection,this.getTextPoint=this.rangeService.getTextPoint,this.insertLineBreak=this._textService.insertLineBreak,this.insertText=this._textService.insertText,this.isFirstLine=this.rangeService.isFirstLine,this.isLastLine=this.rangeService.isLastLine,this.isNormalizedDeltaSelected=this.deltaService.isNormalizedDeltaSelected,this.isValidInlineRange=this.rangeService.isValidInlineRange,this.mapDeltasInInlineRange=this.deltaService.mapDeltasInInlineRange,this.resetMarks=this._attributeService.resetMarks,this.resetText=this._textService.resetText,this.selectAll=this.rangeService.selectAll,this.setAttributeRenderer=this._attributeService.setAttributeRenderer,this.setAttributeSchema=this._attributeService.setAttributeSchema,this.setInlineRange=this.rangeService.setInlineRange,this.setMarks=this._attributeService.setMarks,this.setText=this._textService.setText,this.slots={mounted:new _.D,unmounted:new _.D,textChange:new _.D,render:new _.D,renderComplete:new _.D,inlineRangeUpdate:new _.D,inlineRangeApply:new _.D,inputting:new _.D,keydown:new _.D},this.syncInlineRange=this.rangeService.syncInlineRange,this.toDomRange=this.rangeService.toDomRange,this.toInlineRange=this.rangeService.toInlineRange,!e.doc)throw new s.Ss(o.O.InlineEditorError,"yText must be attached to a Y.Doc");if(e.toString().includes("\r"))throw new s.Ss(o.O.InlineEditorError,'yText must not contain "\\r" because it will break the range synchronization');let{isEmbed:i=()=>!1,hooks:r={},inlineRangeProvider:a=null,vLineRenderer:n=null}=t;this._yText=e,this.isEmbed=i,this.vLineRenderer=n,this._hooksService=new k(this,r),this.inlineRangeProvider=a,a&&a.inlineRangeUpdated.on(e=>{this.slots.inlineRangeUpdate.emit(e)}),this.slots.inlineRangeUpdate.on(this.rangeService.onInlineRangeUpdated)}_bindYTextObserver(){this.yText.observe(this._onYTextChange),this.disposables.add({dispose:()=>{this.yText.unobserve(this._onYTextChange)}})}mount(e,t=e,i=!1){e.inlineEditor=this,this._rootElement=e,this._eventSource=t,this._eventSource.style.outline="none",this._rootElement.dataset.vRoot="true",this.setReadonly(i),(0,r.XX)(r.s6,this._rootElement),this._bindYTextObserver(),this._eventService.mount(),this._mounted=!0,this.slots.mounted.emit(),this._deltaService.render().catch(console.error)}requestUpdate(e=!0){this._deltaService.render(e).catch(console.error)}rerenderWholeEditor(){this.rootElement.isConnected&&((0,r.XX)(r.s6,this.rootElement),this._deltaService.render().catch(console.error))}setReadonly(e){let t=e?"false":"true";this.rootElement.contentEditable!==t&&(this.rootElement.contentEditable=t),this.eventSource&&this.eventSource.contentEditable!==t&&(this.eventSource.contentEditable=t),this._isReadonly=e}transact(e){let t=this.yText.doc;if(!t)throw new s.Ss(o.O.InlineEditorError,"yText is not attached to a doc");t.transact(e,t.clientID)}unmount(){this.rootElement.isConnected&&(0,r.XX)(r.s6,this.rootElement),this.rootElement.removeAttribute(d),this._rootElement=null,this._mounted=!1,this.disposables.dispose(),this.slots.unmounted.emit()}async waitForUpdate(){let e=Array.from(this.rootElement.querySelectorAll("v-line"));await Promise.all(e.map(e=>e.updateComplete))}get attributeService(){return this._attributeService}get deltaService(){return this._deltaService}get disposables(){return this._disposables}get eventService(){return this._eventService}get eventSource(){return this._eventSource}get hooks(){return this._hooksService.hooks}get isComposing(){return this._eventService.isComposing}get isReadonly(){return this._isReadonly}get marks(){return this._attributeService.marks}get mounted(){return this._mounted}get rangeService(){return this._rangeService}get rootElement(){return(0,f.Z1)(this._rootElement),this._rootElement}get yText(){return this._yText}get yTextDeltas(){return this.yText.toDelta()}get yTextLength(){return this.yText.length}get yTextString(){return this.yText.toString()}}},52153:(e,t,i)=>{i.d(t,{hJ:()=>N,Jy:()=>F,DX:()=>U,fh:()=>Y,Ct:()=>G,Ke:()=>H,H7:()=>ed,Lz:()=>ep,HB:()=>W,cX:()=>ee,bP:()=>t0,Fj:()=>t7,$y:()=>eb});var s=i(91449),o=i(4564),r=i(83951),a=i(22805),n=i(53010);let l=(0,s.qy)` `,c=(0,s.qy)` `,d=(0,s.qy)` `,h=(0,s.qy)` `;(0,s.qy)` `;var u=i(99971),p=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},f=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a=[(0,o.EM)("image-placeholder")],n=[],l=s.WF,c=[],d=[],h=[],g=[];(class extends l{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],p(this,null,i,{kind:"accessor",name:"icon",static:!1,private:!1,access:{has:e=>"icon"in e,get:e=>e.icon,set:(e,t)=>{e.icon=t}},metadata:s},c,d),p(this,null,r,{kind:"accessor",name:"text",static:!1,private:!1,access:{has:e=>"text"in e,get:e=>e.text,set:(e,t)=>{e.text=t}},metadata:s},h,g),p(null,e={value:t},a,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .placeholder-container { display: flex; width: 100%; height: 122px; padding: 12px; align-items: flex-start; border-radius: 8px; border: 1px solid var(--affine-background-tertiary-color); background: var(--affine-background-secondary-color); box-sizing: border-box; } .placeholder-title { display: flex; gap: 8px; align-items: center; color: var(--affine-placeholder-color, #c0bfc1); text-align: justify; /* light/smBold */ font-family: ${(0,s.iz)(u.$7.fontSansFamily)}; font-size: var(--affine-font-sm); font-style: normal; font-weight: 600; line-height: 22px; /* 157.143% */ height: 22px; } .placeholder-icon { display: flex; align-items: center; justify-content: center; color: var(--affine-icon-color); } `}render(){return(0,s.qy)`
    ${this.icon} ${this.text}
    `}#cP=f(this,c,void 0);get icon(){return this.#cP}set icon(e){this.#cP=e}#ia=(f(this,d),f(this,h,void 0));get text(){return this.#ia}set text(e){this.#ia=e}constructor(){super(...arguments),f(this,g)}static{f(t,n)}})})();var g=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},m=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a=[(0,o.EM)("chat-image")],l=[],c=s.WF,u=[],p=[],f=[],v=[];(class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],g(this,null,i,{kind:"accessor",name:"imageUrl",static:!1,private:!1,access:{has:e=>"imageUrl"in e,get:e=>e.imageUrl,set:(e,t)=>{e.imageUrl=t}},metadata:s},u,p),g(this,null,r,{kind:"accessor",name:"status",static:!1,private:!1,access:{has:e=>"status"in e,get:e=>e.status,set:(e,t)=>{e.status=t}},metadata:s},f,v),g(null,e={value:t},a,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .image-container { border-radius: 4px; overflow: hidden; position: relative; display: flex; justify-content: center; align-items: center; width: 70%; max-width: 200px; max-height: 122px; img { max-width: 100%; max-height: 100%; width: auto; height: auto; } } `}render(){return(0,n.S)(this.status,[["loading",()=>(0,s.qy)``],["error",()=>(0,s.qy)``],["success",()=>(0,s.qy)`
    `]])}#cH=m(this,u,void 0);get imageUrl(){return this.#cH}set imageUrl(e){this.#cH=e}#cA=(m(this,p),m(this,f,void 0));get status(){return this.#cA}set status(e){this.#cA=e}constructor(){super(...arguments),m(this,v)}static{m(t,l)}})})(),(()=>{let e,t,i=[(0,o.EM)("chat-images")],r=[],n=s.WF,l=[],c=[];(class extends n{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(n[Symbol.metadata]??null):void 0;g(this,null,[(0,o.MZ)({attribute:!1})],{kind:"accessor",name:"attachments",static:!1,private:!1,access:{has:e=>"attachments"in e,get:e=>e.attachments,set:(e,t)=>{e.attachments=t}},metadata:s},l,c),g(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .images-container { display: flex; width: 100%; gap: 8px; flex-wrap: wrap; } `}render(){return this.attachments&&0!==this.attachments.length?(0,s.qy)`
    ${(0,a.u)(this.attachments,e=>e,e=>(0,s.qy)``)}
    `:s.s6}#cL=m(this,l,void 0);get attachments(){return this.#cL}set attachments(e){this.#cL=e}constructor(){super(...arguments),m(this,c)}static{m(t,r)}})})();var v=i(7595),y=i(21167),b=i(73711),w=i(71323);async function x(e,t){let i=e.std.doc.collection.schema,s=new b.rl({schema:i});s.meta.initialize();let o=new b._O({collection:s,middlewares:[y.HzZ]}),r=new y.FNZ(o),a=await r.toDoc({file:t,assets:o.assetsManager});return a||console.error("Failed to convert markdown to doc"),a}var _=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},C=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,a,n,l,c,d=[(0,o.EM)("text-renderer")],h=[],u=(0,v.Tm)(s.WF),p=[],f=[],g=[],m=[],M=[],E=[],I=[],B=[],$=[],T=[];(class extends u{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(u[Symbol.metadata]??null):void 0;i=[(0,o.P)(".ai-answer-text-container")],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],c=[(0,o.MZ)({attribute:!1})],_(this,null,i,{kind:"accessor",name:"_container",static:!1,private:!1,access:{has:e=>"_container"in e,get:e=>e._container,set:(e,t)=>{e._container=t}},metadata:s},p,f),_(this,null,a,{kind:"accessor",name:"answer",static:!1,private:!1,access:{has:e=>"answer"in e,get:e=>e.answer,set:(e,t)=>{e.answer=t}},metadata:s},g,m),_(this,null,n,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:s},M,E),_(this,null,l,{kind:"accessor",name:"options",static:!1,private:!1,access:{has:e=>"options"in e,get:e=>e.options,set:(e,t)=>{e.options=t}},metadata:s},I,B),_(this,null,c,{kind:"accessor",name:"state",static:!1,private:!1,access:{has:e=>"state"in e,get:e=>e.state,set:(e,t)=>{e.state=t}},metadata:s},$,T),_(null,e={value:t},d,{kind:"class",name:t.name,metadata:s},null,h),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .ai-answer-text-editor.affine-page-viewport { background: transparent; font-family: var(--affine-font-family); margin-top: 0; margin-bottom: 0; } .ai-answer-text-editor .affine-page-root-block-container { padding: 0; line-height: var(--affine-line-height); color: var(--affine-text-primary-color); font-weight: 400; } .affine-paragraph-block-container { line-height: 22px; } .ai-answer-text-editor { .affine-note-block-container { > .affine-block-children-container { > :first-child, > :first-child * { margin-top: 0 !important; } > :last-child, > :last-child * { margin-bottom: 0 !important; } } } } .ai-answer-text-container { overflow-y: auto; overflow-x: hidden; padding: 0; overscroll-behavior-y: none; } .ai-answer-text-container.show-scrollbar::-webkit-scrollbar { width: 5px; height: 100px; } .ai-answer-text-container.show-scrollbar::-webkit-scrollbar-thumb { border-radius: 20px; } .ai-answer-text-container.show-scrollbar:hover::-webkit-scrollbar-thumb { background-color: var(--affine-black-30); } .ai-answer-text-container.show-scrollbar::-webkit-scrollbar-corner { display: none; } .ai-answer-text-container { rich-text .nowrap-lines v-text span, rich-text .nowrap-lines v-element span { white-space: pre; } editor-host:focus-visible { outline: none; } editor-host * { box-sizing: border-box; } } ${k} ${S} `}_onWheel(e){e.stopPropagation(),"generating"===this.state&&e.preventDefault()}connectedCallback(){super.connectedCallback(),this._answers.push(this.answer),this._updateDoc(),"generating"===this.state&&(this._timer=setInterval(this._updateDoc,600))}disconnectedCallback(){super.disconnectedCallback(),this._clearTimer()}render(){if(!this._doc)return s.s6;let{maxHeight:e,customHeading:t}=this.options,i=y.fs6.getInstance().getSpec("page:preview"),o=(0,r.H)({"ai-answer-text-container":!0,"show-scrollbar":!!e,"custom-heading":!!t});return(0,s.qy)`
    ${(0,w.D)(this._doc,(0,s.qy)`
    ${this.host.renderSpecPortal(this._doc,i.value)}
    `)}
    `}shouldUpdate(e){return!e.has("answer")||(this._answers.push(this.answer),!1)}updated(e){super.updated(e),requestAnimationFrame(()=>{this._container&&(this._container.scrollTop=this._container.scrollHeight)})}#e5;get _container(){return this.#e5}set _container(e){this.#e5=e}#cE;get answer(){return this.#cE}set answer(e){this.#cE=e}#n;get host(){return this.#n}set host(e){this.#n=e}#z;get options(){return this.#z}set options(e){this.#z=e}#oe;get state(){return this.#oe}set state(e){this.#oe=e}constructor(){super(...arguments),this._answers=[],this._clearTimer=()=>{this._timer&&(clearInterval(this._timer),this._timer=null)},this._doc=null,this._query={mode:"strict",match:["affine:page","affine:note","affine:surface","affine:paragraph","affine:code","affine:list","affine:divider"].map(e=>({flavour:e,viewType:b.lv.Display}))},this._timer=null,this._updateDoc=()=>{if(this._answers.length>0){let e=this._answers.pop();this._answers=[],e&&x(this.host,e).then(e=>{this._doc=e.blockCollection.getDoc({query:this._query}),this.disposables.add(()=>{e.blockCollection.clearQuery(this._query)}),this._doc.awarenessStore.setReadonly(this._doc.blockCollection,!0),this.requestUpdate(),"generating"!==this.state&&this._clearTimer()}).catch(console.error)}},this.#e5=C(this,p,void 0),this.#cE=(C(this,f),C(this,g,void 0)),this.#n=(C(this,m),C(this,M,void 0)),this.#z=(C(this,E),C(this,I,void 0)),this.#oe=(C(this,B),C(this,$,void 0)),C(this,T)}static{C(t,h)}})})();var M=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},E=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l=[(0,o.EM)("user-info")],c=[],d=s.WF,h=[],p=[],f=[],g=[],m=[],v=[],y=[],b=[];(class extends d{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],M(this,null,i,{kind:"accessor",name:"avatarIcon",static:!1,private:!1,access:{has:e=>"avatarIcon"in e,get:e=>e.avatarIcon,set:(e,t)=>{e.avatarIcon=t}},metadata:s},h,p),M(this,null,r,{kind:"accessor",name:"avatarLoadedFailed",static:!1,private:!1,access:{has:e=>"avatarLoadedFailed"in e,get:e=>e.avatarLoadedFailed,set:(e,t)=>{e.avatarLoadedFailed=t}},metadata:s},f,g),M(this,null,a,{kind:"accessor",name:"avatarUrl",static:!1,private:!1,access:{has:e=>"avatarUrl"in e,get:e=>e.avatarUrl,set:(e,t)=>{e.avatarUrl=t}},metadata:s},m,v),M(this,null,n,{kind:"accessor",name:"userName",static:!1,private:!1,access:{has:e=>"userName"in e,get:e=>e.userName,set:(e,t)=>{e.userName=t}},metadata:s},y,b),M(null,e={value:t},l,{kind:"class",name:t.name,metadata:s},null,c),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .user-info-container { display: flex; width: 100%; height: 24px; flex-direction: row; gap: 10px; font-weight: 500; .user-avatar-container { width: 24px; height: 24px; color: var(--affine-brand-color); display: flex; justify-content: center; align-items: center; } .default-avatar, .user-avatar-container img { width: 100%; height: 100%; border-radius: 50%; } .user-avatar-container img { object-fit: cover; } .default-avatar, .avatar-image { background-color: var(--affine-primary-color); } .user-name { color: var(--affine-text-primary-color); text-align: justify; font-family: ${(0,s.iz)(u.$7.fontSansFamily)}; font-size: var(--affine-font-sm); font-style: normal; font-weight: 500; line-height: 22px; text-overflow: ellipsis; } } `}_handleAvatarLoadError(e){e.target.onerror=null,this.avatarLoadedFailed=!0}render(){return(0,s.qy)``}#cD=E(this,h,void 0);get avatarIcon(){return this.#cD}set avatarIcon(e){this.#cD=e}#cZ=(E(this,p),E(this,f,!1));get avatarLoadedFailed(){return this.#cZ}set avatarLoadedFailed(e){this.#cZ=e}#cj=(E(this,g),E(this,m,void 0));get avatarUrl(){return this.#cj}set avatarUrl(e){this.#cj=e}#cV=(E(this,v),E(this,y,void 0));get userName(){return this.#cV}set userName(e){this.#cV=e}constructor(){super(...arguments),E(this,b)}static{E(t,c)}})})();var I=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},B=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,a,n,l,d,h,u,p=[(0,o.EM)("ai-chat-message")],f=[],g=s.WF,m=[],v=[],y=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],$=[],T=[];(class extends g{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(g[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],d=[(0,o.MZ)({attribute:!1})],h=[(0,o.MZ)({attribute:!1})],u=[(0,o.MZ)({attribute:!1})],I(this,null,i,{kind:"accessor",name:"attachments",static:!1,private:!1,access:{has:e=>"attachments"in e,get:e=>e.attachments,set:(e,t)=>{e.attachments=t}},metadata:s},m,v),I(this,null,a,{kind:"accessor",name:"content",static:!1,private:!1,access:{has:e=>"content"in e,get:e=>e.content,set:(e,t)=>{e.content=t}},metadata:s},y,b),I(this,null,n,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:s},w,x),I(this,null,l,{kind:"accessor",name:"messageRole",static:!1,private:!1,access:{has:e=>"messageRole"in e,get:e=>e.messageRole,set:(e,t)=>{e.messageRole=t}},metadata:s},_,C),I(this,null,d,{kind:"accessor",name:"state",static:!1,private:!1,access:{has:e=>"state"in e,get:e=>e.state,set:(e,t)=>{e.state=t}},metadata:s},k,S),I(this,null,h,{kind:"accessor",name:"textRendererOptions",static:!1,private:!1,access:{has:e=>"textRendererOptions"in e,get:e=>e.textRendererOptions,set:(e,t)=>{e.textRendererOptions=t}},metadata:s},M,E),I(this,null,u,{kind:"accessor",name:"userInfo",static:!1,private:!1,access:{has:e=>"userInfo"in e,get:e=>e.userInfo,set:(e,t)=>{e.userInfo=t}},metadata:s},$,T),I(null,e={value:t},p,{kind:"class",name:t.name,metadata:s},null,f),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .ai-chat-message { display: flex; width: 100%; flex-direction: column; gap: 4px; box-sizing: border-box; } .ai-chat-content { display: block; width: calc(100% - 34px); padding-left: 34px; font-weight: 400; } .with-attachments { margin-top: 8px; } `}render(){let{host:e,textRendererOptions:t,state:i,content:o,attachments:a,messageRole:n,userInfo:l}=this,d=!!a&&a.length>0,h=(0,r.H)({"with-attachments":d});return(0,s.qy)`
    ${n&&"user"===n?(0,s.qy)``:(0,s.qy)``}
    `}#cL=B(this,m,void 0);get attachments(){return this.#cL}set attachments(e){this.#cL=e}#tn=(B(this,v),B(this,y,""));get content(){return this.#tn}set content(e){this.#tn=e}#n=(B(this,b),B(this,w,void 0));get host(){return this.#n}set host(e){this.#n=e}#cz=(B(this,x),B(this,_,void 0));get messageRole(){return this.#cz}set messageRole(e){this.#cz=e}#oe=(B(this,C),B(this,k,"finished"));get state(){return this.#oe}set state(e){this.#oe=e}#cR=(B(this,S),B(this,M,{}));get textRendererOptions(){return this.#cR}set textRendererOptions(e){this.#cR=e}#cF=(B(this,E),B(this,$,{}));get userInfo(){return this.#cF}set userInfo(e){this.#cF=e}constructor(){super(...arguments),B(this,T)}static{B(t,f)}})})(),(()=>{let e,t,i,r,n,l=[(0,o.EM)("ai-chat-messages")],c=[],d=s.WF,h=[],u=[],p=[],f=[],g=[],m=[];(class extends d{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],I(this,null,i,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:s},h,u),I(this,null,r,{kind:"accessor",name:"messages",static:!1,private:!1,access:{has:e=>"messages"in e,get:e=>e.messages,set:(e,t)=>{e.messages=t}},metadata:s},p,f),I(this,null,n,{kind:"accessor",name:"textRendererOptions",static:!1,private:!1,access:{has:e=>"textRendererOptions"in e,get:e=>e.textRendererOptions,set:(e,t)=>{e.textRendererOptions=t}},metadata:s},g,m),I(null,e={value:t},l,{kind:"class",name:t.name,metadata:s},null,c),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` :host { width: 100%; box-sizing: border-box; } .ai-chat-messages { display: flex; box-sizing: border-box; width: 100%; height: 100%; flex-direction: column; gap: 24px; } `}render(){return(0,s.qy)`
    ${(0,a.u)(this.messages,e=>e.id,e=>{let{attachments:t,role:i,content:o}=e,r={userId:e.userId,userName:e.userName,avatarUrl:e.avatarUrl};return(0,s.qy)` `})}
    `}#n=B(this,h,void 0);get host(){return this.#n}set host(e){this.#n=e}#cN=(B(this,u),B(this,p,[]));get messages(){return this.#cN}set messages(e){this.#cN=e}#cR=(B(this,f),B(this,g,{}));get textRendererOptions(){return this.#cR}set textRendererOptions(e){this.#cR=e}constructor(){super(...arguments),B(this,m)}static{B(t,c)}})})();var $=i(31980);let T=(0,s.AH)` .affine-ai-chat-block-container { display: flex; flex-direction: column; align-items: flex-end; width: 100%; height: 100%; box-sizing: border-box; padding: 16px; background: var(--affine-white); color: var(--affine-text-primary-color); line-height: 22px; font-size: var(--affine-font-sm); font-family: ${(0,s.iz)(u.$7.fontSansFamily)}; border-radius: 8px; user-select: none; pointer-events: none; .ai-chat-messages-container { display: block; flex: 1 0 0; width: 100%; box-sizing: border-box; background: linear-gradient(to top, transparent, var(--affine-white)); -webkit-mask-image: linear-gradient( to bottom, var(--affine-white) 25%, transparent ); mask-image: linear-gradient( to bottom, var(--affine-white) 25%, transparent ); overflow: hidden; } .ai-chat-block-button { display: flex; width: 100%; height: 22px; flex-direction: row; align-items: center; gap: 8px; font-weight: 600; svg { color: var(--affine-icon-color); } } } `;var O=i(67448);let P=O.z.object({id:O.z.string(),content:O.z.string(),role:O.z.union([O.z.literal("user"),O.z.literal("assistant")]),createdAt:O.z.string(),attachments:O.z.array(O.z.string()).optional(),userId:O.z.string().optional(),userName:O.z.string().optional(),avatarUrl:O.z.string().optional()}),H=O.z.array(P);var A=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},L=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-ai-chat"),(0,y.YE2)({enableOn:({doc:e})=>!e.readonly})],r=[],a=v.p_;return class extends a{static{t=this}constructor(){super(...arguments),this._deserializeChatMessages=(0,$.EW)(()=>{let e=this.model.messages$.value;try{let t=H.safeParse(JSON.parse(e));if(t.success)return t.data;return[]}catch{return[]}})}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;A(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=T}get _peekViewService(){return this._rootService.peekViewService}get _rootService(){return this.host.std.spec.getService("affine:page")}renderBlock(){let e=this._deserializeChatMessages.value.slice(-2);return(0,s.qy)`
    ${l} AI chat block
    `}static{L(t,r)}},t})();var Z=i(94098),j=i(54719),V=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},z=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("affine-edgeless-ai-chat")],r=[],a=(0,v.$K)(D);(class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;V(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s}),z(t,r)}renderGfxBlock(){let e=Z.z.deserialize(this.model.xywh$.value),t=this.model.scale$.value,i=e.w/t,o=e.h/t,r={width:`${i}px`,height:`${o}px`,borderRadius:"8px",transformOrigin:"0 0",boxShadow:"var(--affine-shadow-1)",border:"1px solid var(--affine-border-color)",transform:`scale(${t})`};return(0,s.qy)`
    ${this.renderPageContent()}
    `}})})();var R=i(1126);let F=(0,b.A9)({flavour:"affine:embed-ai-chat",props:()=>({xywh:"[0,0,0,0]",index:"a0",scale:1,messages:"",sessionId:"",rootWorkspaceId:"",rootDocId:""}),metadata:{version:1,role:"content",children:[]},toModel:()=>new N});class N extends(0,R.S5)(b.zg){}var q=i(3874);let U={schema:F,view:{component:(0,q.eu)`affine-ai-chat`}},W={schema:F,view:{component:(0,q.eu)`affine-edgeless-ai-chat`}},G=300,Y=320;var K=i(64816),X=i(45601),Q=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},J=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n=[(0,o.EM)("edgeless-editor")],l=[],c=(0,v.Tm)(v.ao),d=[],h=[],u=[],p=[],f=[],g=[];return class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],Q(this,null,i,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:s},d,h),Q(this,null,r,{kind:"accessor",name:"editor",static:!1,private:!1,access:{has:e=>"editor"in e,get:e=>e.editor,set:(e,t)=>{e.editor=t}},metadata:s},u,p),Q(this,null,a,{kind:"accessor",name:"specs",static:!1,private:!1,access:{has:e=>"specs"in e,get:e=>e.specs,set:(e,t)=>{e.specs=t}},metadata:s},f,g),Q(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` edgeless-editor { font-family: var(--affine-font-family); background: var(--affine-background-primary-color); } edgeless-editor * { box-sizing: border-box; } @media print { edgeless-editor { height: auto; } } .affine-edgeless-viewport { display: block; height: 100%; position: relative; overflow: clip; container-name: viewport; container-type: inline-size; } `}connectedCallback(){super.connectedCallback(),this._disposables.add(this.doc.slots.rootAdded.on(()=>this.requestUpdate()))}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.host?.updateComplete,e}render(){return this.doc.root?(0,s.qy)`
    `:s.s6}get host(){return this._host.value}#d;get doc(){return this.#d}set doc(e){this.#d=e}#cq;get editor(){return this.#cq}set editor(e){this.#cq=e}#h;get specs(){return this.#h}set specs(e){this.#h=e}constructor(){super(...arguments),this._host=(0,X._)(),this.#d=J(this,d,void 0),this.#cq=(J(this,h),J(this,u,void 0)),this.#h=(J(this,p),J(this,f,y.BH6)),J(this,g)}static{J(t,l)}},t})();var et=i(71006),ei=i(50620),es=i(94423);let eo="Untitled";var er=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ea=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[(0,o.EM)("backlink-button")],r=[],a=(0,v.Tm)(s.WF),n=[],l=[];return class extends a{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(a[Symbol.metadata]??null):void 0;er(this,null,[(0,o.wk)()],{kind:"accessor",name:"_showPopover",static:!1,private:!1,access:{has:e=>"_showPopover"in e,get:e=>e._showPopover,set:(e,t)=>{e._showPopover=t}},metadata:s},n,l),er(null,e={value:t},i,{kind:"class",name:t.name,metadata:s},null,r),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` :host { position: relative; display: flex; } .btn { padding: 0 12px; box-sizing: border-box; display: inline-flex; align-items: center; border: none; height: 30px; border-radius: 8px; gap: 4px; background: transparent; cursor: pointer; user-select: none; font-size: var(--affine-font-sm); font-family: ${(0,s.iz)(u.$7.fontSansFamily)}; fill: var(--affine-text-secondary-color); color: var(--affine-text-secondary-color); pointer-events: auto; } .btn > span { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .btn:hover { background: var(--affine-hover-color); } .btn:active { background: var(--affine-hover-color); } .backlink-popover { position: absolute; left: 0; bottom: 0; transform: translateY(100%); z-index: 1; padding-top: 8px; } .menu { display: flex; flex-direction: column; padding: 8px 4px; background: var(--affine-white); box-shadow: var(--affine-menu-shadow); border-radius: 12px; } .backlink-popover .group-title { color: var(--affine-text-secondary-color); margin: 8px 12px; } .backlink-popover icon-button { padding: 8px; justify-content: flex-start; gap: 8px; } ${(0,y.kMM)(".backlink-popover .group")} `}constructor(e){super(),this._onClickAway=e=>{e.target!==this&&this._showPopover&&(this._showPopover=!1,document.removeEventListener("mousedown",this._onClickAway))},this.#cU=ea(this,n,!1),ea(this,l),this._backlinks=e}connectedCallback(){super.connectedCallback(),this.tabIndex=0}onClick(){this._showPopover=!this._showPopover,document.addEventListener("mousedown",this._onClickAway)}render(){let e=this._backlinks;return e.length?(0,s.qy)`
    ${y.BAN}Backlinks (${e.length}) ${this._showPopover?(0,s.qy)``:null}
    `:null}#cU;get _showPopover(){return this.#cU}set _showPopover(e){this.#cU=e}static{ea(t,r)}},t})();var el=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ec=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,n,l,c=[(0,o.EM)("doc-meta-tags")],d=[],h=(0,v.Tm)(s.WF),p=[],f=[],g=[],m=[],b=[],w=[],x=[],_=[];return class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.wk)()],r=[(0,o.MZ)({attribute:!1})],n=[(0,o.wk)()],l=[(0,o.wk)()],el(this,null,i,{kind:"accessor",name:"backlinkList",static:!1,private:!1,access:{has:e=>"backlinkList"in e,get:e=>e.backlinkList,set:(e,t)=>{e.backlinkList=t}},metadata:s},p,f),el(this,null,r,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:s},g,m),el(this,null,n,{kind:"accessor",name:"expanded",static:!1,private:!1,access:{has:e=>"expanded"in e,get:e=>e.expanded,set:(e,t)=>{e.expanded=t}},metadata:s},b,w),el(this,null,l,{kind:"accessor",name:"showSelect",static:!1,private:!1,access:{has:e=>"showSelect"in e,get:e=>e.showSelect,set:(e,t)=>{e.showSelect=t}},metadata:s},x,_),el(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .doc-meta-container { font-family: ${(0,s.iz)(u.$7.fontSansFamily)}; font-size: var(--affine-font-base); line-height: var(--affine-line-height); color: var(--affine-text-primary-color); display: block; box-sizing: border-box; max-width: var(--affine-editor-width); margin-left: auto; margin-right: auto; padding-left: var( --affine-editor-side-padding, ${24}px ); padding-right: var( --affine-editor-side-padding, ${24}px ); } /* Extra small devices (phones, 640px and down) */ @container viewport (width <= 640px) { .doc-meta-container { padding-left: ${24}px; padding-right: ${24}px; } } .meta-data { border-radius: 8px; display: flex; align-items: center; height: 30px; cursor: pointer; justify-content: space-between; margin: 0 -12px; } .meta-data-content { display: flex; align-items: center; gap: 8px; color: var(--affine-text-secondary-color); } .meta-data:hover { background-color: var(--affine-hover-color); } .tags-inline { display: flex; align-items: center; gap: 4px; font-size: 14px; } .tags-inline .tag-list { display: flex; align-items: center; } .tag-inline { max-width: 100px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .expand { display: flex; align-items: center; justify-content: center; margin-right: 12px; } .expand svg { color: var(--affine-icon-color); } .meta-data-expanded { padding: 10px 12px 24px; margin: 0 -24px; display: flex; flex-direction: column; gap: 10px; background-color: var(--affine-hover-color-filled); border-radius: 8px; } .meta-data-expanded-title { display: flex; justify-content: space-between; align-items: center; padding: 0 12px; font-weight: 600; font-size: 14px; color: var(--affine-text-secondary-color); border-radius: 4px; cursor: pointer; } .meta-data-expanded-title:hover { background-color: var(--affine-hover-color); } .meta-data-expanded-title .close { transform: rotate(180deg); border-radius: 4px; display: flex; align-items: center; } @media print { .meta-data-expanded-title .close { display: none; } .expand { display: none; } } .meta-data-expanded-title .close:hover { background-color: var(--affine-hover-color); } .meta-data-expanded-content { display: flex; flex-direction: column; gap: 24px; padding: 0 12px; } .meta-data-expanded-column-item { display: flex; flex-direction: column; } .meta-data-expanded-column-item .backlink-title { display: flex; align-items: center; gap: 8px; fill: var(--affine-icon-color); } .meta-data-expanded-column-item .backlinks { margin-left: 24px; } .meta-data-expanded-item { display: flex; gap: 8px; } .meta-data-expanded-item .value { flex: 1; } .add-tag { display: flex; align-items: center; justify-content: center; cursor: pointer; } .add-tag svg { width: 16px; height: 16px; border-radius: 4px; fill: var(--affine-icon-color); } .add-tag:hover svg { background-color: var(--affine-hover-color); } .tags { display: flex; flex-wrap: wrap; gap: 8px; } .tag { padding: 4px 10px; border-radius: 8px; color: var(--affine-text-primary-color); font-size: 13px; line-height: 13px; display: flex; align-items: center; font-weight: 400; cursor: pointer; } .backlinks { display: flex; gap: 8px; flex-direction: column; } .backlinks .title { height: 28px; color: var(--affine-text-secondary-color); font-size: var(--affine-font-sm); } .backlinks .link { display: flex; align-items: center; gap: 5px; font-size: 15px; cursor: pointer; width: max-content; border-radius: 4px; padding: 0 8px 0 4px; margin: 0 -8px 0 -4px; } .backlinks .link:hover { background-color: var(--affine-hover-color); } .backlinks .link svg { fill: var(--affine-icon-color); } .link-title { border-bottom: 0.5px solid var(--affine-divider-color); } .backlinks .link:hover .link-title { border-bottom-color: transparent; } `}connectedCallback(){super.connectedCallback(),this._listenBacklinkList(),this._disposables.add(this.meta.docMetaUpdated.on(()=>{this.requestUpdate()}))}render(){return this.expanded?(0,s.qy)`
    `:(0,s.qy)`
    `}get meta(){return this.doc.collection.meta}get options(){return this.meta.properties.tags?.options??[]}set options(e){this.tags=this.tags.filter(t=>e.find(e=>e.id===t)),this.doc.collection.meta.setProperties({...this.meta.properties,tags:{...this.meta.properties.tags,options:e}})}get pageRoot(){let e=this.closest(".affine-page-viewport");(0,et.Z1)(e);let t=e.querySelector("affine-page-root");return(0,et.Z1)(t),t}get tags(){return this.doc.meta?.tags??[]}set tags(e){(0,et.Z1)(this.doc.meta),this.doc.meta.tags=e}#cW;get backlinkList(){return this.#cW}set backlinkList(e){this.#cW=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}#cG;get expanded(){return this.#cG}set expanded(e){this.#cG=e}#cY;get showSelect(){return this.#cY}set showSelect(e){this.#cY=e}constructor(){super(...arguments),this._listenBacklinkList=()=>{let e=Object.fromEntries(this.doc.collection.meta.docMetas.map(e=>[e.id,e])),t=t=>{let i=e[t.pageId];return i||console.warn("Unexpected doc meta not found",t.pageId),{...t,...i,icon:"LinkedPage"===t.type?y.hhn:y.UdY,jump:()=>{t.pageId!==this.doc.id&&this.pageRoot.slots.docLinkClicked.emit({docId:t.pageId,blockId:t.blockId})}}},i=this.doc.collection.indexer.backlink;if(i){let e=()=>i.getBacklink(this.doc.id).filter(e=>"LinkedPage"===e.type).map(t);this.backlinkList=e(),this._disposables.add(i.slots.indexUpdated.on(()=>{this.backlinkList=e()}))}},this._renderBacklinkExpanded=()=>{let e=this.backlinkList;return e.length?(0,s.qy)``:null},this._renderBacklinkInline=()=>new en(this.backlinkList),this._renderTagsExpanded=()=>{let e=Object.fromEntries(this.options.map(e=>[e.id,e]));return(0,s.qy)` `},this._renderTagsInline=()=>{let e=this.tags,t=Object.fromEntries(this.options.map(e=>[e.id,e]));return(0,s.qy)`
    ${y.P3Z} ${e.length>0?(0,s.qy)`
    ${(0,a.u)(e.slice(0,3),e=>e,(e,i)=>{let o=t[e];return o?(0,s.qy)`
    ${0!==i?(0,s.qy)`, `:""}
    ${o.value}
    `:null})} ${e.length>3?(0,s.qy)`, and ${e.length-3} more`:""}
    `:"Tags"}
    `},this._selectTags=()=>{this._disposables.add({dispose:(0,y.oVP)(this.shadowRoot?.querySelector(".tags")??this,{value:this.tags,onChange:e=>this.tags=e,options:this.options,onOptionsChange:e=>this.options=e})})},this._toggle=()=>{this.expanded=!this.expanded},this.#cW=ec(this,p,void 0),this.#d=(ec(this,f),ec(this,g,void 0)),this.#cG=(ec(this,m),ec(this,b,!1)),this.#cY=(ec(this,w),ec(this,x,!1)),ec(this,_)}static{ec(t,d)}},t})();var eh=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},eu=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l=[(0,o.EM)("doc-title")],c=[],d=(0,v.Tm)(v.ao),h=[],u=[],p=[],f=[],g=[],m=[],y=[],b=[];return class extends d{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,o.wk)()],r=[(0,o.wk)()],a=[(0,o.P)("rich-text")],n=[(0,o.MZ)({attribute:!1})],eh(this,null,i,{kind:"accessor",name:"_isComposing",static:!1,private:!1,access:{has:e=>"_isComposing"in e,get:e=>e._isComposing,set:(e,t)=>{e._isComposing=t}},metadata:s},h,u),eh(this,null,r,{kind:"accessor",name:"_isReadonly",static:!1,private:!1,access:{has:e=>"_isReadonly"in e,get:e=>e._isReadonly,set:(e,t)=>{e._isReadonly=t}},metadata:s},p,f),eh(this,null,a,{kind:"accessor",name:"_richTextElement",static:!1,private:!1,access:{has:e=>"_richTextElement"in e,get:e=>e._richTextElement,set:(e,t)=>{e._richTextElement=t}},metadata:s},g,m),eh(this,null,n,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:s},y,b),eh(null,e={value:t},l,{kind:"class",name:t.name,metadata:s},null,c),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .doc-title-container { box-sizing: border-box; font-family: var(--affine-font-family); font-size: var(--affine-font-base); line-height: var(--affine-line-height); color: var(--affine-text-primary-color); font-size: 40px; line-height: 50px; font-weight: 700; outline: none; resize: none; border: 0; width: 100%; max-width: var(--affine-editor-width); margin-left: auto; margin-right: auto; padding: 38px 0; padding-left: var( --affine-editor-side-padding, ${24}px ); padding-right: var( --affine-editor-side-padding, ${24}px ); } /* Extra small devices (phones, 640px and down) */ @container viewport (width <= 640px) { .doc-title-container { padding-left: ${24}px; padding-right: ${24}px; } } .doc-title-container-empty::before { content: 'Title'; color: var(--affine-placeholder-color); position: absolute; opacity: 0.5; pointer-events: none; } .doc-title-container:disabled { background-color: transparent; } `}get _inlineEditor(){return this._richTextElement.inlineEditor}get _pageRoot(){let e=this._viewport.querySelector("affine-page-root");return(0,et.Z1)(e),e}get _rootModel(){return this.doc.root}get _viewport(){let e=this.closest(".affine-page-viewport");return(0,et.Z1)(e),e}connectedCallback(){super.connectedCallback(),this._isReadonly=this.doc.readonly,this._disposables.add(this.doc.awarenessStore.slots.update.on(()=>{this._isReadonly!==this.doc.readonly&&(this._isReadonly=this.doc.readonly,this.requestUpdate())})),this._disposables.addFromEvent(this,"keydown",this._onTitleKeyDown),this._disposables.addFromEvent(this,"compositionstart",()=>this._isComposing=!0),this._disposables.addFromEvent(this,"compositionend",()=>this._isComposing=!1);let e=()=>{this._updateTitleInMeta(),this.requestUpdate()};this._rootModel.title.yText.observe(e),this._disposables.add(()=>{this._rootModel.title.yText.unobserve(e)})}render(){let e=!this._rootModel.title.length&&!this._isComposing;return(0,s.qy)`
    this._viewport} .readonly=${this.doc.readonly} .enableFormat=${!1} >
    `}#cK;get _isComposing(){return this.#cK}set _isComposing(e){this.#cK=e}#cX;get _isReadonly(){return this.#cX}set _isReadonly(e){this.#cX=e}#eL;get _richTextElement(){return this.#eL}set _richTextElement(e){this.#eL=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}constructor(){super(...arguments),this._onTitleKeyDown=e=>{if(e.isComposing||this.doc.readonly)return;let t=!this.doc.isEmpty;if("Enter"===e.key&&t&&!e.isComposing){e.preventDefault();let t=this._inlineEditor;(0,et.Z1)(t);let i=t.getInlineRange();(0,et.Z1)(i);let s=this._rootModel.title.split(i.index);this._pageRoot.prependParagraphWithText(s)}else"ArrowDown"===e.key&&t?(e.preventDefault(),this._pageRoot.focusFirstParagraph()):"Tab"===e.key&&e.preventDefault()},this._updateTitleInMeta=()=>{this.doc.collection.setDocMeta(this.doc.id,{title:this._rootModel.title.toString()})},this.#cK=eu(this,h,!1),this.#cX=(eu(this,u),eu(this,p,!1)),this.#eL=(eu(this,f),eu(this,g,void 0)),this.#d=(eu(this,m),eu(this,y,void 0)),eu(this,b)}static{eu(t,c)}},t})();var ef=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},eg=function(e,t,i){for(var s=arguments.length>2,o=0;o{let s=t[e];s&&i.pipe(s)})}(0,K.lQ)(v.AE),(()=>{let e,t,i,r,a,n,l=[(0,o.EM)("affine-editor-container")],c=[],d=(0,$.Jb)((0,v.Tm)(v.ao)),h=[],u=[],p=[],f=[],g=[],m=[],b=[],x=[];(class extends d{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,o.P)("affine-edgeless-root")],r=[(0,o.P)("affine-page-root")],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],ef(this,null,i,{kind:"accessor",name:"_edgelessRoot",static:!1,private:!1,access:{has:e=>"_edgelessRoot"in e,get:e=>e._edgelessRoot,set:(e,t)=>{e._edgelessRoot=t}},metadata:s},h,u),ef(this,null,r,{kind:"accessor",name:"_pageRoot",static:!1,private:!1,access:{has:e=>"_pageRoot"in e,get:e=>e._pageRoot,set:(e,t)=>{e._pageRoot=t}},metadata:s},p,f),ef(this,null,a,{kind:"accessor",name:"autofocus",static:!1,private:!1,access:{has:e=>"autofocus"in e,get:e=>e.autofocus,set:(e,t)=>{e.autofocus=t}},metadata:s},g,m),ef(this,null,n,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:s},b,x),ef(null,e={value:t},l,{kind:"class",name:t.name,metadata:s},null,c),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .affine-page-viewport { position: relative; display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; container-name: viewport; container-type: inline-size; font-family: var(--affine-font-family); } .affine-page-viewport * { box-sizing: border-box; } @media print { .affine-page-viewport { height: auto; } } .playground-page-editor-container { flex-grow: 1; font-family: var(--affine-font-family); background: var(--affine-background-primary-color); display: block; } .playground-page-editor-container * { box-sizing: border-box; } @media print { .playground-page-editor-container { height: auto; } } .edgeless-editor-container { font-family: var(--affine-font-family); background: var(--affine-background-primary-color); display: block; height: 100%; position: relative; overflow: clip; } .edgeless-editor-container * { box-sizing: border-box; } @media print { .edgeless-editor-container { height: auto; } } .affine-edgeless-viewport { display: block; height: 100%; position: relative; overflow: clip; container-name: viewport; container-type: inline-size; } `}connectedCallback(){super.connectedCallback(),this._disposables.add(this.doc.slots.rootAdded.on(()=>this.requestUpdate()))}firstUpdated(){"page"===this.mode&&setTimeout(()=>{if(this.autofocus){let e=this.querySelector("rich-text");(0,et.Z1)(e);let t=e.inlineEditor;(0,et.Z1)(t),t.focusEnd()}}),this._disposables.add((0,$.QZ)(()=>{let e=this._mode.value;this._forwardRef(e)}))}render(){let e=this._mode.value;return(0,s.qy)`${(0,w.D)(this.rootModel.id+e,(0,s.qy)`
    ${(0,es.z)("page"===e,()=>(0,s.qy)` `)}
    `)}`}switchEditor(e){this.mode=e}updated(e){if(e.has("doc")&&(this.slots.docUpdated.emit({newDocId:this.doc.id}),this._forwardRef(this.mode)),!e.has("doc")&&!e.has("mode"))return}set edgelessSpecs(e){this._edgelessSpecs$.value=e}get host(){return this._hostRef.value}get mode(){return this._mode.value}set mode(e){this._mode.value=e}set pageSpecs(e){this._pageSpecs$.value=e}get rootModel(){return this.doc.root}#cQ;get _edgelessRoot(){return this.#cQ}set _edgelessRoot(e){this.#cQ=e}#cJ;get _pageRoot(){return this.#cJ}set _pageRoot(e){this.#cJ=e}#c1;get autofocus(){return this.#c1}set autofocus(e){this.#c1=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}constructor(){super(...arguments),this._edgelessSpecs=(0,$.EW)(()=>[...this._edgelessSpecs$.value].map(e=>{if("affine:page"===e.schema.model.flavour){let t=e.setup;e={...e,setup:(e,i)=>{t?.(e,i),e.mounted.once(({service:e})=>{let{docModeService:t}=e;i.add(t.onModeChange(this.switchEditor.bind(this)))})}}}return e})),this._edgelessSpecs$=(0,$.vP)(y.BH6),this._forwardRef=e=>{requestAnimationFrame(()=>{"page"===e?this._pageRoot&&em(this._pageRoot.slots,this.slots):this._edgelessRoot&&em(this._edgelessRoot.slots,this.slots)})},this._hostRef=(0,X._)(),this._mode=(0,$.vP)("page"),this._pageSpecs=(0,$.EW)(()=>[...this._pageSpecs$.value].map(e=>{if("affine:page"===e.schema.model.flavour){let t=e.setup;e={...e,setup:(e,i)=>{t?.(e,i),e.mounted.once(({service:e})=>{let{docModeService:t}=e;i.add(t.onModeChange(this.switchEditor.bind(this)))})}}}return e})),this._pageSpecs$=(0,$.vP)(y.kbk),this._specs=(0,$.EW)(()=>"page"===this._mode.value?this._pageSpecs.value:this._edgelessSpecs.value),this.slots={docLinkClicked:new ei.D,editorModeSwitched:new ei.D,docUpdated:new ei.D,tagClicked:new ei.D},this.#cQ=eg(this,h,null),this.#cJ=(eg(this,u),eg(this,p,null)),this.#c1=(eg(this,f),eg(this,g,!1)),this.#d=(eg(this,m),eg(this,b,void 0)),eg(this,x)}static{eg(t,c)}})})();var ev=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ey=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l=[(0,o.EM)("page-editor")],c=[],d=(0,v.Tm)(v.ao),h=[],u=[],p=[],f=[],g=[],m=[],b=[],w=[];return class extends d{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(d[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({type:Boolean})],n=[(0,o.MZ)({attribute:!1})],ev(this,null,i,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:s},h,u),ev(this,null,r,{kind:"accessor",name:"editor",static:!1,private:!1,access:{has:e=>"editor"in e,get:e=>e.editor,set:(e,t)=>{e.editor=t}},metadata:s},p,f),ev(this,null,a,{kind:"accessor",name:"hasViewport",static:!1,private:!1,access:{has:e=>"hasViewport"in e,get:e=>e.hasViewport,set:(e,t)=>{e.hasViewport=t}},metadata:s},g,m),ev(this,null,n,{kind:"accessor",name:"specs",static:!1,private:!1,access:{has:e=>"specs"in e,get:e=>e.specs,set:(e,t)=>{e.specs=t}},metadata:s},b,w),ev(null,e={value:t},l,{kind:"class",name:t.name,metadata:s},null,c),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` page-editor { font-family: var(--affine-font-family); background: var(--affine-background-primary-color); } page-editor * { box-sizing: border-box; } @media print { page-editor { height: auto; } } .affine-page-viewport { position: relative; height: 100%; overflow-x: hidden; overflow-y: auto; container-name: viewport; container-type: inline-size; } .page-editor-container { display: block; height: 100%; } `}connectedCallback(){super.connectedCallback(),this._disposables.add(this.doc.slots.rootAdded.on(()=>this.requestUpdate()))}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.host?.updateComplete,e}render(){return this.doc.root?(0,s.qy)`
    `:s.s6}get host(){return this._host.value}#d;get doc(){return this.#d}set doc(e){this.#d=e}#cq;get editor(){return this.#cq}set editor(e){this.#cq=e}#c0;get hasViewport(){return this.#c0}set hasViewport(e){this.#c0=e}#h;get specs(){return this.#h}set specs(e){this.#h=e}constructor(){super(...arguments),this._host=(0,X._)(),this.#d=ey(this,h,void 0),this.#cq=(ey(this,u),ey(this,p,void 0)),this.#c0=(ey(this,f),ey(this,g,!0)),this.#h=(ey(this,m),ey(this,b,y.kbk)),ey(this,w)}static{ey(t,c)}},t})(),ew=(0,s.qy)` `,ex=(0,s.qy)` `,e_=(0,s.qy)` `,eC=(0,s.qy)` `,ek=(0,s.qy)` `,eS=(0,s.qy)` `,eM=(0,s.qy)` `,eE=(0,s.qy)` `,eI=(0,s.qy)` `,eB=(0,s.qy)` `,e$=(0,s.qy)` `,eT=(0,s.qy)` `,eO=(0,s.qy)` `,eP=(0,s.qy)` `,eH=(0,s.qy)` `,eA=(0,s.qy)` `,eL=(0,s.qy)` `,eD=(0,s.qy)` `,eZ=(0,s.qy)` `,ej=(0,s.qy)` `,eV=(0,s.qy)` `,ez=(0,s.qy)` `,eR=(0,s.qy)` `,eF=(0,s.qy)` `,eN=(0,s.qy)` `,eq=(0,s.qy)` `,eU=(0,s.qy)` `,eW=(0,s.qy)` `,eG=(0,s.qy)` `;var eY=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},eK=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,n,l,c=[(0,o.EM)("bi-directional-link-panel")],d=[],h=(0,v.Tm)(s.WF),u=[],p=[],f=[],g=[],m=[],b=[],w=[],x=[];(class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.wk)()],r=[(0,o.wk)()],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],eY(this,null,i,{kind:"accessor",name:"_backLinkShow",static:!1,private:!1,access:{has:e=>"_backLinkShow"in e,get:e=>e._backLinkShow,set:(e,t)=>{e._backLinkShow=t}},metadata:s},u,p),eY(this,null,r,{kind:"accessor",name:"_show",static:!1,private:!1,access:{has:e=>"_show"in e,get:e=>e._show,set:(e,t)=>{e._show=t}},metadata:s},f,g),eY(this,null,n,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:s},m,b),eY(this,null,l,{kind:"accessor",name:"pageRoot",static:!1,private:!1,access:{has:e=>"pageRoot"in e,get:e=>e.pageRoot,set:(e,t)=>{e.pageRoot=t}},metadata:s},w,x),eY(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` :host { width: 100%; max-width: var(--affine-editor-width); margin-left: auto; margin-right: auto; padding-left: var( --affine-editor-side-padding, ${24} ); padding-right: var( --affine-editor-side-padding, ${24} ); font-size: var(--affine-font-base); } /* Extra small devices (phones, 640px and down) */ @container viewport (width <= 640px) { :host { padding-left: ${24}px; padding-right: ${24}px; } } .title-line { display: flex; justify-content: space-between; align-items: center; } .back-links-title, .links-title { color: var(--affine-text-secondary-color); height: 32px; line-height: 32px; } .links, .back-links { margin-bottom: 16px; } .back-link-title { width: 100%; height: 32px; display: flex; align-items: center; gap: 8px; } .back-link-title div { display: flex; align-items: center; gap: 4px; color: var(--affine-text-primary-color); } .back-links-container { height: auto; display: flex; } .back-links-container-left-divider { width: 20px; display: flex; justify-content: center; } .back-links-container-left-divider div { width: 1px; height: 100%; background-color: var(--affine-border-color); } .link { width: 100%; height: 32px; display: flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; } .link svg { flex: none; } .link div { width: fit-content; height: 100%; overflow: hidden; text-overflow: ellipsis; line-height: 32px; border-bottom: 0.5px solid var(--affine-divider-color); } .link.deleted { color: var(--affine-text-disable-color); text-decoration: line-through; fill: var(--affine-text-disable-color); } .arrow { cursor: pointer; transition: transform 0.2s; } .back-links-blocks-container { width: 100%; display: flex; flex-direction: column; padding-left: 8px; position: relative; } .rich-text-container { width: 100%; display: flex; justify-content: space-between; align-items: start; cursor: pointer; border-radius: 4px; padding: 0px 8px; padding-top: 8px; } .rich-text { max-width: 96%; padding-bottom: 8px; } .arrow-link { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 4px; display: none; } .rich-text-container:hover { background-color: var(--affine-hover-color); } .rich-text-container:hover .arrow-link { display: flex; } .arrow-link:hover { background-color: var(--affine-hover-color); } .quote { padding-left: 24px; } .quote::after { content: ''; width: 2px; height: 24px; position: absolute; left: 16px; background: var(--affine-quote-color); border-radius: 18px; } .linked-doc-container { display: flex; align-items: center; padding-left: 2px; gap: 2px; } .linked-doc-container svg { scale: 1.2; } `}get _backLinks(){let{doc:e}=this,{collection:t}=e,i=new Map;return t.indexer.backlink?.getBacklink(e.id).reduce((e,t)=>{let{pageId:i}=t;return e.has(i)?e.get(i).push(t.blockId):e.set(i,[t.blockId]),e},i),i}_backlink(e,t,i){if(!eX(e,["affine:paragraph","affine:list","affine:embed-linked-doc","affine:embed-synced-doc"]))return s.s6;let o=null;eX(e,["affine:list"])&&(o=this._host.spec.getService("affine:list").styles.icon(e,!1,()=>{}));let r=eX(e,["affine:embed-linked-doc","affine:embed-synced-doc"])?"":e.type;return(0,s.qy)`
    {this._handleLinkClick(e,t,i)}} >
    ${r?(0,s.qy)`${o??s.s6} `:(0,s.qy)`
    ${eV} ${this.doc.meta?.title?this.doc.meta?.title:"Untitled"}
    `}
    `}_divider(e){return(0,s.qy)`
    `}_handleLinkClick(e,t,i){e.shiftKey&&this._rootService.peekViewService?this._rootService.peekViewService.peek({docId:t,blockId:i}).catch(console.error):this.pageRoot.slots.docLinkClicked.emit({docId:t,blockId:i})}get _host(){return this.pageRoot.host}get _links(){let{doc:e}=this,t=new Set;return e.getBlockByFlavour(["affine:paragraph","affine:list","affine:embed-linked-doc","affine:embed-synced-doc"]).forEach(e=>{e.text?e.text.yText.toDelta().forEach(e=>{e.attributes?.reference?.pageId&&t.add(e.attributes.reference.pageId)}):eX(e,["affine:embed-linked-doc","affine:embed-synced-doc"])&&t.add(e.pageId)}),Array.from(t)}_renderBackLinks(e){let{doc:t}=this,{collection:i}=t,o=e.size;return(0,s.qy)` `}_renderLinks(e){let{collection:t}=this.doc;return(0,s.qy)` `}get _rootService(){return this._host.spec.getService("affine:page")}_toggleShow(){this._show=!this._show,this._rootService.editPropsStore.setStorage("showBidirectional",this._show)}connectedCallback(){super.connectedCallback();let e=new y.Edk;if(e.setInteractable(!1),e.setDoc(this.doc),e.setCustomContent(e=>{let t=e.doc.meta?.title?e.doc.meta.title:"Untitled";return(0,s.qy)` ${eV} ${t} `}),this._inlineManager.registerSpecs((0,y.UNy)(e)),this.doc.collection.indexer.backlink){let{_disposables:e}=this;e.add(this.doc.collection.indexer.backlink.slots.indexUpdated.on(()=>{this.requestUpdate()}))}this._show=!!this._rootService.editPropsStore.getStorage("showBidirectional")}render(){let e=this._links,t=this._backLinks;return e.length+t.size===0?s.s6:(0,s.qy)` ${this._divider(!this._show)}
    Bi-directional links
    ${this._show?"Hide":"Show"}
    ${this._divider(this._show)} ${this._show?(0,s.qy)`${this._renderBackLinks(t)} ${this._renderLinks(e)} `:s.s6} `}#c2;get _backLinkShow(){return this.#c2}set _backLinkShow(e){this.#c2=e}#iD;get _show(){return this.#iD}set _show(e){this.#iD=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}#c5;get pageRoot(){return this.#c5}set pageRoot(e){this.#c5=e}constructor(){super(...arguments),this._inlineManager=new y.fA2,this.#c2=eK(this,u,[]),this.#iD=(eK(this,p),eK(this,f,!1)),this.#d=(eK(this,g),eK(this,m,void 0)),this.#c5=(eK(this,b),eK(this,w,void 0)),eK(this,x)}static{eK(t,d)}})})();class eQ{constructor(e){this.host=e}get _command(){return this.host.command}addComment(e,t){let i=this.parseTextSelection(e);if(!i)throw Error("Invalid selection");let{quote:s,range:o}=i,r=this.host.doc.collection.idGenerator(),a={id:r,date:Date.now(),start:o.start,end:o.end,quote:s,...t};return this.commentsMap.set(r,new b.rl.Y.Map(Object.entries(a))),a}getComments(){let e=[];return this.commentsMap.forEach((t,i)=>{let s=t.get("start"),o=t.get("end"),r=b.rl.Y.createAbsolutePositionFromRelativePosition(s.index,this.host.doc.spaceDoc),a=this.host.view.viewFromPath("block",s.path),n=b.rl.Y.createAbsolutePositionFromRelativePosition(o.index,this.host.doc.spaceDoc),l=this.host.view.viewFromPath("block",o.path);if(!r||!a||!n||!l){this.commentsMap.delete(i);return}let c={id:t.get("id"),date:t.get("date"),start:s,end:o,quote:t.get("quote"),author:t.get("author"),text:t.get("text")};e.push(c)}),e}parseTextSelection(e){let[t,i]=this._command.chain().getSelectedBlocks({currentTextSelection:e,types:["text"]}).run(),s=i.selectedBlocks;if(!s||0===s.length)return null;let{from:o,to:r}=e,a=s[0],n=a.model.text,l=a.path;(0,et.Z1)(n),(0,et.Z1)(l);let c=s[s.length-1],d=c.model.text,h=c.path;(0,et.Z1)(d),(0,et.Z1)(h);let u=b.rl.Y.createRelativePositionFromTypeIndex(n.yText,o.index),p=b.rl.Y.createRelativePositionFromTypeIndex(d.yText,r?r.index+r.length:o.index+o.length);return{quote:s.reduce((e,t,i)=>{let a=t.model.text;return a?0===i?e+a.yText.toString().slice(o.index,o.index+o.length):i===s.length-1&&r?e+" "+a.yText.toString().slice(0,r.index+r.length):e+" "+a.yText.toString():e},""),range:{start:{path:l,index:u},end:{path:h,index:p}}}}get commentsMap(){return this.host.doc.spaceDoc.getMap("comments")}}var eJ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},e1=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n=[(0,o.EM)("comment-input")],l=[],c=(0,v.Tm)(v.ao),d=[],h=[],u=[],p=[],f=[],g=[];return class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.P)("rich-text")],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],eJ(this,null,i,{kind:"accessor",name:"_editor",static:!1,private:!1,access:{has:e=>"_editor"in e,get:e=>e._editor,set:(e,t)=>{e._editor=t}},metadata:s},d,h),eJ(this,null,r,{kind:"accessor",name:"manager",static:!1,private:!1,access:{has:e=>"manager"in e,get:e=>e.manager,set:(e,t)=>{e.manager=t}},metadata:s},u,p),eJ(this,null,a,{kind:"accessor",name:"onSubmit",static:!1,private:!1,access:{has:e=>"onSubmit"in e,get:e=>e.onSubmit,set:(e,t)=>{e.onSubmit=t}},metadata:s},f,g),eJ(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` .comment-input-container { padding: 16px; } .comment-quote { font-size: 10px; color: var(--affine-text-secondary-color); padding-left: 8px; border-left: 2px solid var(--affine-text-secondary-color); margin-bottom: 8px; } .comment-author { font-size: 12px; } .comment-editor { white-space: pre-wrap; overflow-wrap: break-word; min-height: 24px; margin-top: 16px; margin-bottom: 16px; } .comment-control { display: flex; gap: 8px; margin-top: 8px; } `}render(){let e=this.host.selection.find("text");if(!e)return this.remove(),s.s6;let t=this.manager.parseTextSelection(e);if(!t)return this.remove(),s.s6;let{quote:i}=t,o=new b.rl.Y.Doc().getText("comment");return(0,s.qy)`
    ${i}
    Anonymous
    this._submit(e)} .yText=${o} class="comment-editor" >
    `}get host(){return this.manager.host}#c7;get _editor(){return this.#c7}set _editor(e){this.#c7=e}#c3;get manager(){return this.#c3}set manager(e){this.#c3=e}#c4;get onSubmit(){return this.#c4}set onSubmit(e){this.#c4=e}constructor(){super(...arguments),this._cancel=()=>{this.remove()},this._submit=e=>{let t=this._editor.inlineEditor?.yTextDeltas;if(!t){this.remove();return}let i=new b.rl.Y.Text;i.applyDelta(t);let s=this.manager.addComment(e,{author:"Anonymous",text:i});this.onSubmit?.(s),this.remove()},this.#c7=e1(this,d,void 0),this.#c3=(e1(this,h),e1(this,u,void 0)),this.#c4=(e1(this,p),e1(this,f,void 0)),e1(this,g)}static{e1(t,l)}},t})();var e2=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},e5=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a=[(0,o.EM)("comment-panel")],n=[],l=(0,v.Tm)(v.ao),c=[],d=[],h=[],u=[];(class extends l{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,o.P)(".comment-panel-container")],r=[(0,o.MZ)({attribute:!1})],e2(this,null,i,{kind:"accessor",name:"_container",static:!1,private:!1,access:{has:e=>"_container"in e,get:e=>e._container,set:(e,t)=>{e._container=t}},metadata:s},c,d),e2(this,null,r,{kind:"accessor",name:"editor",static:!1,private:!1,access:{has:e=>"editor"in e,get:e=>e.editor,set:(e,t)=>{e.editor=t}},metadata:s},h,u),e2(null,e={value:t},a,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=(0,s.AH)` comment-panel { position: absolute; top: 0; right: 0; border: 1px solid var(--affine-border-color, #e3e2e4); background-color: var(--affine-background-primary-color); height: 100vh; width: 320px; box-sizing: border-box; padding-top: 16px; } .comment-panel-container { width: 100%; height: 100%; padding: 16px; } .comment-panel-head { display: flex; gap: 8px; } .comment-panel-comments { margin-top: 16px; } .comment-panel-comment { margin-bottom: 16px; } .comment-panel-comment-quote { font-size: 10px; color: var(--affine-text-secondary-color); padding-left: 8px; border-left: 2px solid var(--affine-text-secondary-color); margin-bottom: 8px; } .comment-panel-comment-author { font-size: 12px; } .comment-panel-comment-text { margin-top: 8px; } `}_addComment(){if(!this.editor.host?.selection.find("text"))return;let e=new e0;this.commentManager&&(e.manager=this.commentManager,e.onSubmit=()=>{this.requestUpdate()},this._container.append(e))}connectedCallback(){super.connectedCallback(),this.editor.host&&(this.commentManager=new eQ(this.editor.host))}render(){if(!this.commentManager)return;let e=this.commentManager.getComments();return(0,s.qy)`
    ${e.map(e=>(0,s.qy)`
    ${e.quote}
    ${e.author}
    `)}
    `}#e5;get _container(){return this.#e5}set _container(e){this.#e5=e}#cq;get editor(){return this.#cq}set editor(e){this.#cq=e}constructor(){super(...arguments),this.commentManager=null,this.#e5=e5(this,c,void 0),this.#cq=(e5(this,d),e5(this,h,void 0)),e5(this,u)}static{e5(t,n)}})})();var e7=i(69050),e3=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},e4=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c=[(0,o.EM)("affine-frame-card-title-editor")],d=[],h=(0,v.Tm)(v.ao),u=[],p=[],f=[],g=[],m=[],y=[],b=[],w=[],x=[],_=[];return class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.P)("rich-text")],l=[(0,o.MZ)({attribute:!1})],e3(this,null,i,{kind:"accessor",name:"frameModel",static:!1,private:!1,access:{has:e=>"frameModel"in e,get:e=>e.frameModel,set:(e,t)=>{e.frameModel=t}},metadata:s},u,p),e3(this,null,r,{kind:"accessor",name:"left",static:!1,private:!1,access:{has:e=>"left"in e,get:e=>e.left,set:(e,t)=>{e.left=t}},metadata:s},f,g),e3(this,null,a,{kind:"accessor",name:"maxWidth",static:!1,private:!1,access:{has:e=>"maxWidth"in e,get:e=>e.maxWidth,set:(e,t)=>{e.maxWidth=t}},metadata:s},m,y),e3(this,null,n,{kind:"accessor",name:"richText",static:!1,private:!1,access:{has:e=>"richText"in e,get:e=>e.richText,set:(e,t)=>{e.richText=t}},metadata:s},b,w),e3(this,null,l,{kind:"accessor",name:"titleContentElement",static:!1,private:!1,access:{has:e=>"titleContentElement"in e,get:e=>e.titleContentElement,set:(e,t)=>{e.titleContentElement=t}},metadata:s},x,_),e3(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=e6}_unmount(){this.disposables.dispose(),this.remove(),this.titleContentElement.style.display="block"}firstUpdated(){this.updateComplete.then(()=>{if(null===this.inlineEditor)return;this.titleContentElement.style.display="none",this.inlineEditor.selectAll(),this.inlineEditor.slots.renderComplete.on(()=>{this.requestUpdate()});let e=this.inlineEditor.rootElement;this.disposables.addFromEvent(e,"blur",()=>{this._unmount()}),this.disposables.addFromEvent(e,"click",e=>{e.stopPropagation()}),this.disposables.addFromEvent(e,"dblclick",e=>{e.stopPropagation()}),this.disposables.addFromEvent(e,"keydown",e=>{e.stopPropagation(),"Enter"!==e.key||this._isComposing||this._unmount()})}).catch(console.error)}async getUpdateComplete(){let e=await super.getUpdateComplete();return await this.richText?.updateComplete,e}render(){let e=(0,j.W)({transformOrigin:"top left",borderRadius:"4px",maxWidth:`${this.maxWidth}px`,maxHeight:"20px",width:"fit-content",height:"20px",fontSize:"var(--affine-font-sm)",lineHeight:"20px",position:"absolute",left:`${this.left}px`,top:"0px",minWidth:"8px",background:"var(--affine-background-primary-color)",border:"1px solid var(--affine-primary-color)",color:"var(--affine-text-primary-color)",boxShadow:"0px 0px 0px 2px rgba(30, 150, 235, 0.30)",zIndex:"1",display:"block"});return(0,s.qy)``}get inlineEditor(){return this.richText.inlineEditor}#iC;get frameModel(){return this.#iC}set frameModel(e){this.#iC=e}#tB;get left(){return this.#tB}set left(e){this.#tB=e}#cw;get maxWidth(){return this.#cw}set maxWidth(e){this.#cw=e}#eH;get richText(){return this.#eH}set richText(e){this.#eH=e}#c6;get titleContentElement(){return this.#c6}set titleContentElement(e){this.#c6=e}constructor(){super(...arguments),this._isComposing=!1,this.#iC=e4(this,u,void 0),this.#tB=(e4(this,p),e4(this,f,void 0)),this.#cw=(e4(this,g),e4(this,m,void 0)),this.#eH=(e4(this,y),e4(this,b,void 0)),this.#c6=(e4(this,w),e4(this,x,void 0)),e4(this,_)}static{e4(t,d)}},t})();var e9=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},te=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c=[(0,o.EM)("affine-frame-card-title")],d=[],h=(0,v.Tm)(v.ao),u=[],p=[],f=[],g=[],m=[],y=[],b=[],w=[],x=[],_=[];(class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.P)(".frame-card-title-container")],n=[(0,o.P)(".frame-card-title-container .card-title")],l=[(0,o.P)(".frame-card-title-container .card-index")],e9(this,null,i,{kind:"accessor",name:"cardIndex",static:!1,private:!1,access:{has:e=>"cardIndex"in e,get:e=>e.cardIndex,set:(e,t)=>{e.cardIndex=t}},metadata:s},u,p),e9(this,null,r,{kind:"accessor",name:"frame",static:!1,private:!1,access:{has:e=>"frame"in e,get:e=>e.frame,set:(e,t)=>{e.frame=t}},metadata:s},f,g),e9(this,null,a,{kind:"accessor",name:"titleContainer",static:!1,private:!1,access:{has:e=>"titleContainer"in e,get:e=>e.titleContainer,set:(e,t)=>{e.titleContainer=t}},metadata:s},m,y),e9(this,null,n,{kind:"accessor",name:"titleContentElement",static:!1,private:!1,access:{has:e=>"titleContentElement"in e,get:e=>e.titleContentElement,set:(e,t)=>{e.titleContentElement=t}},metadata:s},b,w),e9(this,null,l,{kind:"accessor",name:"titleIndexElement",static:!1,private:!1,access:{has:e=>"titleIndexElement"in e,get:e=>e.titleIndexElement,set:(e,t)=>{e.titleIndexElement=t}},metadata:s},x,_),e9(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=tt}_setFrameDisposables(e){this._clearTitleDisposables(),e.observe(this._updateElement),this._titleDisposables=new e7.K,this._titleDisposables.add({dispose:()=>{e.unobserve(this._updateElement)}})}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._clearTitleDisposables()}render(){return(0,s.qy)`
    e.stopPropagation()} @dblclick=${e=>e.stopPropagation()} > ${this.cardIndex+1}
    e.stopPropagation()} @dblclick=${this._mountTitleEditor} >${this.frame.title}
    `}updated(e){e.has("frame")&&this._setFrameDisposables(this.frame.title.yText)}#c8;get cardIndex(){return this.#c8}set cardIndex(e){this.#c8=e}#ac;get frame(){return this.#ac}set frame(e){this.#ac=e}#c9;get titleContainer(){return this.#c9}set titleContainer(e){this.#c9=e}#c6;get titleContentElement(){return this.#c6}set titleContentElement(e){this.#c6=e}#de;get titleIndexElement(){return this.#de}set titleIndexElement(e){this.#de=e}constructor(){super(...arguments),this._clearTitleDisposables=()=>{this._titleDisposables?.dispose(),this._titleDisposables=null},this._mountTitleEditor=e=>{e.stopPropagation();let t=new e8;t.frameModel=this.frame,t.titleContentElement=this.titleContentElement;let i=this.titleIndexElement.offsetWidth+6;t.left=i,t.maxWidth=this.titleContainer.offsetWidth-i-6,this.titleContainer.append(t)},this._titleDisposables=null,this._updateElement=()=>{this.requestUpdate()},this.#c8=te(this,u,void 0),this.#ac=(te(this,p),te(this,f,void 0)),this.#c9=(te(this,g),te(this,m,void 0)),this.#c6=(te(this,y),te(this,b,void 0)),this.#de=(te(this,w),te(this,x,void 0)),te(this,_)}static{te(t,d)}})})();var ti=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},ts=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c,d,h,u,p,f,g,m=[(0,o.EM)("affine-frame-card")],b=[],w=(0,v.Tm)(v.ao),x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],P=[],H=[],A=[],L=[],D=[],Z=[],V=[],z=[],R=[],F=[],N=[],q=[];return class extends w{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(w[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.P)(".frame-card-container")],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],c=[(0,o.MZ)({attribute:!1})],d=[(0,o.MZ)({attribute:!1})],h=[(0,o.MZ)({attribute:!1})],u=[(0,o.MZ)({attribute:!1})],p=[(0,o.MZ)({attribute:!1})],f=[(0,o.MZ)({attribute:!1})],g=[(0,o.MZ)({attribute:!1})],ti(this,null,i,{kind:"accessor",name:"cardIndex",static:!1,private:!1,access:{has:e=>"cardIndex"in e,get:e=>e.cardIndex,set:(e,t)=>{e.cardIndex=t}},metadata:s},x,_),ti(this,null,r,{kind:"accessor",name:"containerElement",static:!1,private:!1,access:{has:e=>"containerElement"in e,get:e=>e.containerElement,set:(e,t)=>{e.containerElement=t}},metadata:s},C,k),ti(this,null,a,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:s},S,M),ti(this,null,n,{kind:"accessor",name:"draggingCardNumber",static:!1,private:!1,access:{has:e=>"draggingCardNumber"in e,get:e=>e.draggingCardNumber,set:(e,t)=>{e.draggingCardNumber=t}},metadata:s},E,I),ti(this,null,l,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:s},B,$),ti(this,null,c,{kind:"accessor",name:"frame",static:!1,private:!1,access:{has:e=>"frame"in e,get:e=>e.frame,set:(e,t)=>{e.frame=t}},metadata:s},T,O),ti(this,null,d,{kind:"accessor",name:"frameIndex",static:!1,private:!1,access:{has:e=>"frameIndex"in e,get:e=>e.frameIndex,set:(e,t)=>{e.frameIndex=t}},metadata:s},P,H),ti(this,null,h,{kind:"accessor",name:"host",static:!1,private:!1,access:{has:e=>"host"in e,get:e=>e.host,set:(e,t)=>{e.host=t}},metadata:s},A,L),ti(this,null,u,{kind:"accessor",name:"pos",static:!1,private:!1,access:{has:e=>"pos"in e,get:e=>e.pos,set:(e,t)=>{e.pos=t}},metadata:s},D,Z),ti(this,null,p,{kind:"accessor",name:"stackOrder",static:!1,private:!1,access:{has:e=>"stackOrder"in e,get:e=>e.stackOrder,set:(e,t)=>{e.stackOrder=t}},metadata:s},V,z),ti(this,null,f,{kind:"accessor",name:"status",static:!1,private:!1,access:{has:e=>"status"in e,get:e=>e.status,set:(e,t)=>{e.status=t}},metadata:s},R,F),ti(this,null,g,{kind:"accessor",name:"width",static:!1,private:!1,access:{has:e=>"width"in e,get:e=>e.width,set:(e,t)=>{e.width=t}},metadata:s},N,q),ti(null,e={value:t},m,{kind:"class",name:t.name,metadata:s},null,b),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=to}_DraggingCardNumber(){return void 0===this.draggingCardNumber?s.s6:(0,s.qy)`
    ${this.draggingCardNumber}
    `}_dispatchDragEvent(e){if(e.preventDefault(),0!==e.button)return;let{clientX:t,clientY:i}=e,s=(0,y.on)(this.ownerDocument,"mousemove",e=>{if(5>Math.abs(t-e.clientX)&&5>Math.abs(i-e.clientY))return;"selected"!==this.status&&this._dispatchSelectEvent(e);let o=new CustomEvent("drag",{detail:{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}});this.dispatchEvent(o),s()});(0,y.OoU)(this.ownerDocument,"mouseup",()=>{s()})}_dispatchFitViewEvent(e){e.stopPropagation();let t=new CustomEvent("fitview",{detail:{block:this.frame}});this.dispatchEvent(t)}_dispatchSelectEvent(e){e.stopPropagation();let t=new CustomEvent("select",{detail:{id:this.frame.id,selected:"selected"!==this.status,index:this.cardIndex,multiselect:e.shiftKey}});this.dispatchEvent(t)}_setFrameDisposables(e){this._clearFrameDisposables(),this._frameDisposables=new e7.K,this._frameDisposables.add(e.propsUpdated.on(this._updateElement))}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._clearFrameDisposables()}render(){let{pos:e,stackOrder:t,width:i}=this,o="dragging"===this.status?(0,j.W)({transform:`${0===t?`translate(${e.x-16}px, ${e.y-8}px)`:`translate(${e.x-10}px, ${e.y-16}px) scale(0.96)`}`,width:i?`${i}px`:void 0}):{};return(0,s.qy)`
    ${"dragging"===this.status?s.s6:(0,s.qy)``}
    ${"dragging"===this.status&&0!==t?s.s6:(0,s.qy)``} ${this._DraggingCardNumber()}
    `}updated(e){e.has("frame")&&this._setFrameDisposables(this.frame)}#c8;get cardIndex(){return this.#c8}set cardIndex(e){this.#c8=e}#dt;get containerElement(){return this.#dt}set containerElement(e){this.#dt=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}#di;get draggingCardNumber(){return this.#di}set draggingCardNumber(e){this.#di=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#ac;get frame(){return this.#ac}set frame(e){this.#ac=e}#ds;get frameIndex(){return this.#ds}set frameIndex(e){this.#ds=e}#n;get host(){return this.#n}set host(e){this.#n=e}#dr;get pos(){return this.#dr}set pos(e){this.#dr=e}#da;get stackOrder(){return this.#da}set stackOrder(e){this.#da=e}#cA;get status(){return this.#cA}set status(e){this.#cA=e}#tP;get width(){return this.#tP}set width(e){this.#tP=e}constructor(){super(...arguments),this._clearFrameDisposables=()=>{this._frameDisposables?.dispose(),this._frameDisposables=null},this._frameDisposables=null,this._updateElement=()=>{this.requestUpdate()},this.#c8=ts(this,x,void 0),this.#dt=(ts(this,_),ts(this,C,void 0)),this.#d=(ts(this,k),ts(this,S,void 0)),this.#di=(ts(this,M),ts(this,E,void 0)),this.#i_=(ts(this,I),ts(this,B,null)),this.#ac=(ts(this,$),ts(this,T,void 0)),this.#ds=(ts(this,O),ts(this,P,void 0)),this.#n=(ts(this,H),ts(this,A,void 0)),this.#dr=(ts(this,L),ts(this,D,void 0)),this.#da=(ts(this,Z),ts(this,V,void 0)),this.#cA=(ts(this,z),ts(this,R,"none")),this.#tP=(ts(this,F),ts(this,N,void 0)),ts(this,q)}static{ts(t,b)}},t})();var ta=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tn=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,n,l,c,d,h,u,p,f=[(0,o.EM)("affine-frame-panel-body")],g=[],m=(0,v.Tm)(v.ao),b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[],$=[],T=[],O=[],P=[],H=[],A=[],L=[];(class extends m{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(m[Symbol.metadata]??null):void 0;i=[(0,o.wk)()],r=[(0,o.wk)()],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],c=[(0,o.MZ)({attribute:!1})],d=[(0,o.MZ)({attribute:!1})],h=[(0,o.MZ)({attribute:!1})],u=[(0,o.P)(".frame-list-container")],p=[(0,o.MZ)({attribute:!1})],ta(this,null,i,{kind:"accessor",name:"_dragging",static:!1,private:!1,access:{has:e=>"_dragging"in e,get:e=>e._dragging,set:(e,t)=>{e._dragging=t}},metadata:s},b,w),ta(this,null,r,{kind:"accessor",name:"_selected",static:!1,private:!1,access:{has:e=>"_selected"in e,get:e=>e._selected,set:(e,t)=>{e._selected=t}},metadata:s},x,_),ta(this,null,n,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:s},C,k),ta(this,null,l,{kind:"accessor",name:"domHost",static:!1,private:!1,access:{has:e=>"domHost"in e,get:e=>e.domHost,set:(e,t)=>{e.domHost=t}},metadata:s},S,M),ta(this,null,c,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:s},E,I),ta(this,null,d,{kind:"accessor",name:"editorHost",static:!1,private:!1,access:{has:e=>"editorHost"in e,get:e=>e.editorHost,set:(e,t)=>{e.editorHost=t}},metadata:s},B,$),ta(this,null,h,{kind:"accessor",name:"fitPadding",static:!1,private:!1,access:{has:e=>"fitPadding"in e,get:e=>e.fitPadding,set:(e,t)=>{e.fitPadding=t}},metadata:s},T,O),ta(this,null,u,{kind:"accessor",name:"frameListContainer",static:!1,private:!1,access:{has:e=>"frameListContainer"in e,get:e=>e.frameListContainer,set:(e,t)=>{e.frameListContainer=t}},metadata:s},P,H),ta(this,null,p,{kind:"accessor",name:"insertIndex",static:!1,private:!1,access:{has:e=>"insertIndex"in e,get:e=>e.insertIndex,set:(e,t)=>{e.insertIndex=t}},metadata:s},A,L),ta(null,e={value:t},f,{kind:"class",name:t.name,metadata:s},null,g),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=tl}_drag(e){if(!this._selected.length)return;this._dragging=!0;let t=this._frameItems.reduce((e,t)=>(e.set(t.frame.id,{...t}),e),new Map),i=this._selected.slice(),s=i.map(e=>{let i=t.get(e);return{frame:i.frame,element:this.renderRoot.querySelector(`[data-frame-id="${i.frame.id}"]`),cardIndex:i.cardIndex,frameIndex:i.frameIndex}}),o=s[0].element.clientWidth;this._frameElementHeight=s[0].element.offsetHeight,function(e,t){let i,s;let{document:o,domHost:r,container:a,onDragMove:n,onDragEnd:l,frameElementHeight:c,framePanelBody:d,frameListContainer:h,start:u,edgeless:p,doc:f,editorHost:g}=t,m=e.slice(e.length-2,e.length).map((i,s,o)=>{let r=new tr;return r.edgeless=p,r.doc=f,r.host=g,r.frame=i.frame,r.cardIndex=i.cardIndex,r.frameIndex=i.frameIndex,r.status="dragging",r.stackOrder=o.length-1-s,r.pos=u,r.width=t.width,e.length>1&&0===r.stackOrder&&(r.draggingCardNumber=e.length),r}),v=function(e){let t=e.createElement("div");return t.style.height="100vh",t.style.width="100vw",t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.zIndex="calc(var(--affine-z-index-popover, 0) + 3)",t.style.cursor="grabbing",t}(o),b=d.getBoundingClientRect(),w=Array.from(h.children),x=parseInt(getComputedStyle(h).getPropertyValue("gap"))??16;a.renderRoot.append(v),a.renderRoot.append(...m);let _=e=>e.clientX>=b.left&&e.clientX<=b.right&&e.clientY>=b.top&&e.clientY<=b.bottom,C=(0,y.on)(a,"mousemove",e=>{if(m.forEach(t=>{t.pos={x:e.clientX,y:e.clientY}}),!_(e)){i=void 0,n?.(i,0);return}for(let t of(i=0,w)){if(!t.frame)break;let o=b.top+t.offsetTop-d.scrollTop-x/2,r=o+t.offsetHeight/2,a=o+t.offsetHeight+x;if(e.clientY>=o&&e.clientY<=a){s=(i=e.clientY>r?i+1:i)*(c+x)-x/2,n?.(i,s);return}++i}n?.(i)}),k=!1;(0,y.OoU)(r,"mouseup",()=>{k||(k=!0,m.forEach(e=>e.remove()),v.remove(),C(),l?.(i))})}(s,{width:o,container:this,document:this.ownerDocument,domHost:this.domHost??this.ownerDocument,start:{x:e.detail.clientX,y:e.detail.clientY},framePanelBody:this,frameListContainer:this.frameListContainer,frameElementHeight:this._frameElementHeight,edgeless:this.edgeless,doc:this.doc,editorHost:this.editorHost,onDragEnd:e=>{this._dragging=!1,this.insertIndex=void 0,void 0!==e&&this._reorderFrames(i,t,e)},onDragMove:(e,t)=>{this.insertIndex=e,this._indicatorTranslateY=t??0}})}_fitToElement(e){let{block:t}=e.detail,i=Z.z.deserialize(t.xywh);if(this.edgeless)this.edgeless.service.viewport.setViewportByBound(i,this.viewportPadding,!0);else{let e={xywh:t.xywh,referenceId:t.id,padding:this.viewportPadding},i=this.editorHost.spec.getService("affine:page");i.editPropsStore.setStorage("viewport",e),i.docModeService.setMode("edgeless")}}_renderEmptyContent(){return(0,s.qy)`
    Add frames to organize and present your Edgeless
    `}_renderFrameList(){let e=new Set(this._selected),t=(0,s.qy)`${(0,a.u)(this._frameItems,e=>[e.frame.id,e.cardIndex].join("-"),t=>{let{frame:i,frameIndex:o,cardIndex:r}=t;return(0,s.qy)``})}`;return(0,s.qy)`
    ${void 0!==this.insertIndex?(0,s.qy)`
    `:s.s6} ${t}
    `}_reorderFrames(e,t,i){if(i>=0&&i<=this._frameItems.length){let s=Array.from(t.values()).map(e=>e.frame),o=e.map(e=>t.get(e)).map(e=>e.frame).sort(this.compare),r=s[i-1]?.index||null,a=s[i]?.index||null;o.forEach(e=>{let t=(0,y.TUT)(r,a);e.doc.updateBlock(e,{index:t}),r=t}),this.doc.captureSync(),this._updateFrames()}}_setDocDisposables(e){this._clearDocDisposables(),this._docDisposables=new e7.K,this._docDisposables.add(e.slots.blockUpdated.on(({flavour:e})=>{"affine:frame"===e&&requestAnimationFrame(()=>{this._updateFrames()})}))}_updateFrames(){if(this._dragging)return;if(!this.frames.length){this._selected=[],this._frameItems=[];return}let e=[],t=new Set(this._selected),i=[];this.frames.sort(this.compare).forEach((s,o)=>{let r={frame:s,frameIndex:s.index,cardIndex:o};e.push(r),t.has(s.id)&&i.push(s.id)}),this._frameItems=e,this._selected=i,this.requestUpdate()}compare(e,t){return e.indext.index?1:0}connectedCallback(){super.connectedCallback(),this._updateFrameItems(),this.edgeless&&(this._lastEdgelessRootId=this.edgeless.model.id)}disconnectedCallback(){super.disconnectedCallback(),this._clearDocDisposables()}firstUpdated(){this.disposables.addFromEvent(this,"click",this._clickBlank)}render(){return this._updateFrameItems(),(0,s.qy)` ${this._frameItems.length?this._renderFrameList():this._renderEmptyContent()}`}updated(e){(e.has("doc")||e.has("edgeless"))&&this._setDocDisposables(this.doc),e.has("edgeless")&&this.edgeless&&(this.edgeless.model.id===this._lastEdgelessRootId?this.edgeless.service.selection.set({elements:this._selected,editing:!1}):this._selected=[],this._lastEdgelessRootId=this.edgeless.model.id)}get frames(){return this.doc.getBlockByFlavour("affine:frame").sort(this.compare)}get viewportPadding(){return this.fitPadding?[0,0,0,0].map((e,t)=>Number.isFinite(this.fitPadding[t])?this.fitPadding[t]:e):[0,0,0,0]}#sq;get _dragging(){return this.#sq}set _dragging(e){this.#sq=e}#dn;get _selected(){return this.#dn}set _selected(e){this.#dn=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}#dl;get domHost(){return this.#dl}set domHost(e){this.#dl=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#dc;get editorHost(){return this.#dc}set editorHost(e){this.#dc=e}#dd;get fitPadding(){return this.#dd}set fitPadding(e){this.#dd=e}#dh;get frameListContainer(){return this.#dh}set frameListContainer(e){this.#dh=e}#du;get insertIndex(){return this.#du}set insertIndex(e){this.#du=e}constructor(){super(...arguments),this._clearDocDisposables=()=>{this._docDisposables?.dispose(),this._docDisposables=null},this._clickBlank=e=>{e.stopPropagation(),e.target.closest("frame-card")||0===this._selected.length||(this._selected=[],this.edgeless?.service.selection.set({elements:this._selected,editing:!1}))},this._docDisposables=null,this._frameElementHeight=0,this._frameItems=[],this._indicatorTranslateY=0,this._lastEdgelessRootId="",this._selectFrame=e=>{let{selected:t,id:i,multiselect:s}=e.detail;t?s?this._selected=[...this._selected,i]:this._selected=[i]:this._selected=this._selected.filter(e=>e!==i),this.edgeless?.service.selection.set({elements:this._selected,editing:!1})},this._updateFrameItems=()=>{this._frameItems=this.frames.map((e,t)=>({frame:e,frameIndex:e.index,cardIndex:t}))},this.#sq=tn(this,b,!1),this.#dn=(tn(this,w),tn(this,x,[])),this.#d=(tn(this,_),tn(this,C,void 0)),this.#dl=(tn(this,k),tn(this,S,void 0)),this.#i_=(tn(this,M),tn(this,E,null)),this.#dc=(tn(this,I),tn(this,B,void 0)),this.#dd=(tn(this,$),tn(this,T,void 0)),this.#dh=(tn(this,O),tn(this,P,void 0)),this.#du=(tn(this,H),tn(this,A,void 0)),tn(this,L)}static{tn(t,g)}})})();var tc=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},td=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c=[(0,o.EM)("affine-frames-setting-menu")],d=[],h=(0,v.Tm)(s.WF),u=[],p=[],f=[],g=[],m=[],y=[],b=[],w=[],x=[],_=[];(class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.wk)()],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.wk)()],l=[(0,o.wk)()],tc(this,null,i,{kind:"accessor",name:"blackBackground",static:!1,private:!1,access:{has:e=>"blackBackground"in e,get:e=>e.blackBackground,set:(e,t)=>{e.blackBackground=t}},metadata:s},u,p),tc(this,null,r,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:s},f,g),tc(this,null,a,{kind:"accessor",name:"editorHost",static:!1,private:!1,access:{has:e=>"editorHost"in e,get:e=>e.editorHost,set:(e,t)=>{e.editorHost=t}},metadata:s},m,y),tc(this,null,n,{kind:"accessor",name:"fillScreen",static:!1,private:!1,access:{has:e=>"fillScreen"in e,get:e=>e.fillScreen,set:(e,t)=>{e.fillScreen=t}},metadata:s},b,w),tc(this,null,l,{kind:"accessor",name:"hideToolbar",static:!1,private:!1,access:{has:e=>"hideToolbar"in e,get:e=>e.hideToolbar,set:(e,t)=>{e.hideToolbar=t}},metadata:s},x,_),tc(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=th}get _rootService(){return this.editorHost.spec.getService("affine:page")}_tryRestoreSettings(){let{editPropsStore:e}=this._rootService,t=e.getStorage("presentBlackBackground");this.blackBackground=t??!0,this.fillScreen=e.getStorage("presentFillScreen")??!1,this.hideToolbar=e.getStorage("presentHideToolbar")??!1}connectedCallback(){super.connectedCallback(),this._tryRestoreSettings()}disconnectedCallback(){super.disconnectedCallback()}render(){return(0,s.qy)`
    {e.stopPropagation()}} >
    Preview Settings
    Fill Screen
    Playback Settings
    Dark background
    Hide toolbar
    `}updated(e){e.has("edgeless")&&(this.edgeless?this.disposables.add(this.edgeless.slots.navigatorSettingUpdated.on(({blackBackground:e,hideToolbar:t})=>{void 0!==e&&e!==this.blackBackground&&(this.blackBackground=e),void 0!==t&&t!==this.hideToolbar&&(this.hideToolbar=t)})):this.disposables.dispose())}#a7;get blackBackground(){return this.#a7}set blackBackground(e){this.#a7=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#dc;get editorHost(){return this.#dc}set editorHost(e){this.#dc=e}#l$;get fillScreen(){return this.#l$}set fillScreen(e){this.#l$=e}#a3;get hideToolbar(){return this.#a3}set hideToolbar(e){this.#a3=e}constructor(){super(...arguments),this._onBlackBackgroundChange=e=>{this.blackBackground=e,this.edgeless?.slots.navigatorSettingUpdated.emit({blackBackground:this.blackBackground})},this._onFillScreenChange=e=>{this.fillScreen=e,this.edgeless?.slots.navigatorSettingUpdated.emit({fillScreen:this.fillScreen}),this._rootService.editPropsStore.setStorage("presentFillScreen",this.fillScreen)},this._onHideToolBarChange=e=>{this.hideToolbar=e,this.edgeless?.slots.navigatorSettingUpdated.emit({hideToolbar:this.hideToolbar}),this._rootService.editPropsStore.setStorage("presentHideToolbar",this.hideToolbar)},this.#a7=td(this,u,!1),this.#i_=(td(this,p),td(this,f,void 0)),this.#dc=(td(this,g),td(this,m,void 0)),this.#l$=(td(this,y),td(this,b,!1)),this.#a3=(td(this,w),td(this,x,!1)),td(this,_)}static{td(t,d)}})})();var tu=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tp=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c=[(0,o.EM)("affine-frame-panel-header")],d=[],h=(0,v.Tm)(s.WF),u=[],p=[],f=[],g=[],m=[],b=[],w=[],x=[],_=[],C=[];(class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.P)(".all-frames-setting-button")],r=[(0,o.P)(".frames-setting-container")],a=[(0,o.wk)()],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],tu(this,null,i,{kind:"accessor",name:"_frameSettingButton",static:!1,private:!1,access:{has:e=>"_frameSettingButton"in e,get:e=>e._frameSettingButton,set:(e,t)=>{e._frameSettingButton=t}},metadata:s},u,p),tu(this,null,r,{kind:"accessor",name:"_frameSettingMenu",static:!1,private:!1,access:{has:e=>"_frameSettingMenu"in e,get:e=>e._frameSettingMenu,set:(e,t)=>{e._frameSettingMenu=t}},metadata:s},f,g),tu(this,null,a,{kind:"accessor",name:"_settingPopperShow",static:!1,private:!1,access:{has:e=>"_settingPopperShow"in e,get:e=>e._settingPopperShow,set:(e,t)=>{e._settingPopperShow=t}},metadata:s},m,b),tu(this,null,n,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:s},w,x),tu(this,null,l,{kind:"accessor",name:"editorHost",static:!1,private:!1,access:{has:e=>"editorHost"in e,get:e=>e.editorHost,set:(e,t)=>{e.editorHost=t}},metadata:s},_,C),tu(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=tf}_tryLoadNavigatorStateLocalRecord(){this._navigatorMode=this.editorHost.spec.getService("affine:page").editPropsStore.getStorage("presentFillScreen")?"fill":"fit"}connectedCallback(){super.connectedCallback(),this._tryLoadNavigatorStateLocalRecord()}disconnectedCallback(){super.disconnectedCallback(),this._edgelessDisposables&&this._clearEdgelessDisposables()}firstUpdated(){let e=this.disposables;this._framesSettingMenuPopper=(0,y.j0U)(this._frameSettingButton,this._frameSettingMenu,({display:e})=>{this._settingPopperShow="show"===e},{mainAxis:14,crossAxis:-100}),e.add(this._framesSettingMenuPopper)}render(){return(0,s.qy)`
    All frames this._framesSettingMenuPopper?.toggle()} > ${ex}
    ${ew}Presentation
    `}updated(e){e.has("edgeless")&&(this.edgeless?this._setEdgelessDisposables():this._clearEdgelessDisposables())}get rootService(){return this.editorHost.spec.getService("affine:page")}#dp;get _frameSettingButton(){return this.#dp}set _frameSettingButton(e){this.#dp=e}#df;get _frameSettingMenu(){return this.#df}set _frameSettingMenu(e){this.#df=e}#dg;get _settingPopperShow(){return this.#dg}set _settingPopperShow(e){this.#dg=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#dc;get editorHost(){return this.#dc}set editorHost(e){this.#dc=e}constructor(){super(...arguments),this._clearEdgelessDisposables=()=>{this._edgelessDisposables?.dispose(),this._edgelessDisposables=null},this._edgelessDisposables=null,this._enterPresentationMode=()=>{this.edgeless||this.rootService.docModeService.setMode("edgeless"),setTimeout(()=>{this.edgeless?.updateComplete.then(()=>{this.edgeless?.tools.setEdgelessTool({type:"frameNavigator",mode:this._navigatorMode})}).catch(console.error)},100)},this._framesSettingMenuPopper=null,this._navigatorMode="fit",this._setEdgelessDisposables=()=>{this.edgeless&&(this._clearEdgelessDisposables(),this._edgelessDisposables=new e7.K,this._edgelessDisposables.add(this.edgeless.slots.navigatorSettingUpdated.on(({fillScreen:e})=>{this._navigatorMode=e?"fill":"fit"})))},this.#dp=tp(this,u,void 0),this.#df=(tp(this,p),tp(this,f,void 0)),this.#dg=(tp(this,g),tp(this,m,!1)),this.#i_=(tp(this,b),tp(this,w,void 0)),this.#dc=(tp(this,x),tp(this,_,void 0)),tp(this,C)}static{tp(t,d)}})})();var tg=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tm=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a=[(0,o.EM)("affine-frame-panel")],n=[],l=(0,v.Tm)(v.ao),c=[],d=[],h=[],u=[];(class extends l{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],tg(this,null,i,{kind:"accessor",name:"editor",static:!1,private:!1,access:{has:e=>"editor"in e,get:e=>e.editor,set:(e,t)=>{e.editor=t}},metadata:s},c,d),tg(this,null,r,{kind:"accessor",name:"fitPadding",static:!1,private:!1,access:{has:e=>"fitPadding"in e,get:e=>e.fitPadding,set:(e,t)=>{e.fitPadding=t}},metadata:s},h,u),tg(null,e={value:t},a,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=tv}_clearEditorDisposables(){this._editorDisposables?.dispose(),this._editorDisposables=null}_setEditorDisposables(){this._clearEditorDisposables(),this._editorDisposables=new e7.K,this._editorDisposables.add(this.editor.slots.editorModeSwitched.on(()=>{this.editor.updateComplete.then(()=>this.requestUpdate()).catch(console.error)})),this._editorDisposables.add(this.editor.slots.docUpdated.on(()=>{this.editor.updateComplete.then(()=>{this.requestUpdate()}).catch(console.error)}))}connectedCallback(){super.connectedCallback(),customElements.get("frame-preview")||customElements.define("frame-preview",y.irK)}disconnectedCallback(){super.disconnectedCallback(),this._clearEditorDisposables()}render(){return(0,s.qy)`
    `}updated(e){e.has("editor")&&this._setEditorDisposables()}get doc(){return this.editor.doc}get edgeless(){return this.editor.querySelector("affine-edgeless-root")}get host(){return this.editor.host}#cq;get editor(){return this.#cq}set editor(e){this.#cq=e}#dd;get fitPadding(){return this.#dd}set fitPadding(e){this.#dd=e}constructor(){super(...arguments),this._editorDisposables=null,this.#cq=tm(this,c,void 0),this.#dd=(tm(this,d),tm(this,h,[50,380,50,50])),tm(this,u)}static{tm(t,n)}})})();var ty=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tb=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n=[(0,o.EM)("affine-outline-notice")],l=[],c=(0,v.Tm)(s.WF),d=[],h=[],u=[],p=[],f=[],g=[];(class extends c{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(c[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],ty(this,null,i,{kind:"accessor",name:"noticeVisible",static:!1,private:!1,access:{has:e=>"noticeVisible"in e,get:e=>e.noticeVisible,set:(e,t)=>{e.noticeVisible=t}},metadata:s},d,h),ty(this,null,r,{kind:"accessor",name:"setNoticeVisibility",static:!1,private:!1,access:{has:e=>"setNoticeVisibility"in e,get:e=>e.setNoticeVisibility,set:(e,t)=>{e.setNoticeVisibility=t}},metadata:s},u,p),ty(this,null,a,{kind:"accessor",name:"toggleNotesSorting",static:!1,private:!1,access:{has:e=>"toggleNotesSorting"in e,get:e=>e.toggleNotesSorting,set:(e,t)=>{e.toggleNotesSorting=t}},metadata:s},f,g),ty(null,e={value:t},n,{kind:"class",name:t.name,metadata:s},null,l),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=tw}_handleNoticeButtonClick(){this.toggleNotesSorting(),this.setNoticeVisibility(!1)}render(){return this.noticeVisible?(0,s.qy)`
    SOME CONTENTS HIDDEN this.setNoticeVisibility(!1)} >${eW}
    Some contents are not visible on edgeless.
    Click here or ${eR} to organize content.
    `:s.s6}#dm=tb(this,d,void 0);get noticeVisible(){return this.#dm}set noticeVisible(e){this.#dm=e}#dv=(tb(this,h),tb(this,u,void 0));get setNoticeVisibility(){return this.#dv}set setNoticeVisibility(e){this.#dv=e}#dy=(tb(this,p),tb(this,f,void 0));get toggleNotesSorting(){return this.#dy}set toggleNotesSorting(e){this.#dy=e}constructor(){super(...arguments),tb(this,g)}static{tb(t,l)}})})();let tx={quote:eT,text:eC,h1:ek,h2:eS,h3:eM,h4:eE,h5:eI,h6:eB,code:e$,numbered:eO,bulleted:eP,todo:eH,toggle:e_,bookmark:eA,image:eL,table:eD,kanban:eZ,attachment:ej},t_={quote:"Quote",text:"Text Block",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6"},tC={code:"Code Block",bulleted:"Bulleted List",numbered:"Numbered List",toggle:"Toggle List",todo:"Todo",bookmark:"Bookmark",image:"Image",database:"Database",attachment:"Attachment",...t_},tk=new Set(Object.keys(t_).filter(e=>e.startsWith("h"))),tS="outlinePanelSettings";function tM(e,t){let i=e.root;if(!i)return[];let s=[];return i.children.forEach((e,i)=>{["affine:note"].includes(e.flavour)&&t.includes(e.displayMode)&&s.push({note:e,index:i,number:i+1})}),s}function tE(e){return y.yYJ.matchFlavours(e,["affine:paragraph"])&&tk.has(e.type$.value)}function tI(e,t,i=!1){return tM(e,t).map(({note:e})=>(function(e,t=!1){return e.children.filter(e=>{let i=e.text&&e.text.length>0;return tE(e)&&(!t||i)})})(e,i)).flat()}var tB=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},t$=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c=[(0,o.EM)("affine-outline-block-preview")],d=[],h=(0,$.Jb)((0,v.Tm)(s.WF)),u=[],p=[],f=[],g=[],m=[],b=[],w=[],x=[],_=[],C=[];(class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],a=[(0,o.MZ)({attribute:!1})],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],tB(this,null,i,{kind:"accessor",name:"block",static:!1,private:!1,access:{has:e=>"block"in e,get:e=>e.block,set:(e,t)=>{e.block=t}},metadata:s},u,p),tB(this,null,r,{kind:"accessor",name:"cardNumber",static:!1,private:!1,access:{has:e=>"cardNumber"in e,get:e=>e.cardNumber,set:(e,t)=>{e.cardNumber=t}},metadata:s},f,g),tB(this,null,a,{kind:"accessor",name:"disabledIcon",static:!1,private:!1,access:{has:e=>"disabledIcon"in e,get:e=>e.disabledIcon,set:(e,t)=>{e.disabledIcon=t}},metadata:s},m,b),tB(this,null,n,{kind:"accessor",name:"enableNotesSorting",static:!1,private:!1,access:{has:e=>"enableNotesSorting"in e,get:e=>e.enableNotesSorting,set:(e,t)=>{e.enableNotesSorting=t}},metadata:s},w,x),tB(this,null,l,{kind:"accessor",name:"showPreviewIcon",static:!1,private:!1,access:{has:e=>"showPreviewIcon"in e,get:e=>e.showPreviewIcon,set:(e,t)=>{e.showPreviewIcon=t}},metadata:s},_,C),tB(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=tO}_TextBlockPreview(e){let t=e.text.yText.toDelta();if(!e.text.length)return s.s6;let i=this.disabledIcon?"icon disabled":"icon",o=t.map(t=>{if(!t.attributes?.reference)return t.insert.toString().trim().length>0?(0,s.qy)`${t.insert.toString()}`:s.s6;{let i=t.attributes.reference,o=e.doc.collection.meta.docMetas.find(e=>e.id===i.pageId),r=!o,a=r?"Deleted doc":o.title;return(0,s.qy)`${eV} ${a.length?a:"Untitled"}`}});return(0,s.qy)`${o} ${this.showPreviewIcon?(0,s.qy)`${tx[e.type]}`:s.s6}`}render(){return(0,s.qy)`
    ${this.renderBlockByFlavour()}
    `}renderBlockByFlavour(){let{block:e}=this,t=this.disabledIcon?"icon disabled":"icon";if(!this.enableNotesSorting&&!tE(e)&&!y.yYJ.matchFlavours(e,["affine:page"]))return s.s6;switch(e.flavour){case"affine:page":return tT(e),e.title.length>0?(0,s.qy)` ${e.title$.value} `:s.s6;case"affine:paragraph":case"affine:list":return tT(e),this._TextBlockPreview(e);case"affine:bookmark":return tT(e),(0,s.qy)` ${e.title||e.url||tC.bookmark} ${this.showPreviewIcon?(0,s.qy)`${tx.bookmark}`:s.s6} `;case"affine:code":return tT(e),(0,s.qy)` ${e.language??tC.code} ${this.showPreviewIcon?(0,s.qy)`${tx.code}`:s.s6} `;case"affine:database":return tT(e),(0,s.qy)` ${e.title.toString().length?e.title.toString():tC.database} ${this.showPreviewIcon?(0,s.qy)`${tx.table}`:s.s6} `;case"affine:image":return tT(e),(0,s.qy)` ${e.caption?.length?e.caption:tC.image} ${this.showPreviewIcon?(0,s.qy)`${tx.image}`:s.s6} `;case"affine:attachment":return tT(e),(0,s.qy)` ${e.name?.length?e.name:tC.attachment} ${this.showPreviewIcon?(0,s.qy)`${tx.attachment}`:s.s6} `;default:return s.s6}}#T=t$(this,u,void 0);get block(){return this.#T}set block(e){this.#T=e}#db=(t$(this,p),t$(this,f,void 0));get cardNumber(){return this.#db}set cardNumber(e){this.#db=e}#dw=(t$(this,g),t$(this,m,!1));get disabledIcon(){return this.#dw}set disabledIcon(e){this.#dw=e}#dx=(t$(this,b),t$(this,w,void 0));get enableNotesSorting(){return this.#dx}set enableNotesSorting(e){this.#dx=e}#d_=(t$(this,x),t$(this,_,void 0));get showPreviewIcon(){return this.#d_}set showPreviewIcon(e){this.#d_=e}constructor(){super(...arguments),t$(this,C)}static{t$(t,d)}})})();var tP=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tH=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,a,n,l,c,d,h,u,p,f,g,m,b,w=[(0,o.EM)("affine-outline-note-card")],x=[],_=(0,$.Jb)((0,v.Tm)(s.WF)),C=[],k=[],S=[],M=[],E=[],I=[],B=[],T=[],O=[],P=[],H=[],A=[],L=[],D=[],Z=[],j=[],V=[],z=[],R=[],F=[],N=[],q=[],U=[],W=[],G=[],Y=[];(class extends _{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(_[Symbol.metadata]??null):void 0;i=[(0,o.P)(".display-mode-button-group")],a=[(0,o.P)("note-display-mode-panel")],n=[(0,o.wk)()],l=[(0,o.MZ)({attribute:!1})],c=[(0,o.MZ)({attribute:!1})],d=[(0,o.MZ)({attribute:!1})],h=[(0,o.MZ)({attribute:!1})],u=[(0,o.MZ)({attribute:!1})],p=[(0,o.MZ)({attribute:!1})],f=[(0,o.MZ)({attribute:!1})],g=[(0,o.MZ)({attribute:!1})],m=[(0,o.MZ)({attribute:!1})],b=[(0,o.MZ)({attribute:!1})],tP(this,null,i,{kind:"accessor",name:"_displayModeButtonGroup",static:!1,private:!1,access:{has:e=>"_displayModeButtonGroup"in e,get:e=>e._displayModeButtonGroup,set:(e,t)=>{e._displayModeButtonGroup=t}},metadata:s},C,k),tP(this,null,a,{kind:"accessor",name:"_displayModePanel",static:!1,private:!1,access:{has:e=>"_displayModePanel"in e,get:e=>e._displayModePanel,set:(e,t)=>{e._displayModePanel=t}},metadata:s},S,M),tP(this,null,n,{kind:"accessor",name:"_showPopper",static:!1,private:!1,access:{has:e=>"_showPopper"in e,get:e=>e._showPopper,set:(e,t)=>{e._showPopper=t}},metadata:s},E,I),tP(this,null,l,{kind:"accessor",name:"activeHeadingId",static:!1,private:!1,access:{has:e=>"activeHeadingId"in e,get:e=>e.activeHeadingId,set:(e,t)=>{e.activeHeadingId=t}},metadata:s},B,T),tP(this,null,c,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:s},O,P),tP(this,null,d,{kind:"accessor",name:"editorMode",static:!1,private:!1,access:{has:e=>"editorMode"in e,get:e=>e.editorMode,set:(e,t)=>{e.editorMode=t}},metadata:s},H,A),tP(this,null,h,{kind:"accessor",name:"enableNotesSorting",static:!1,private:!1,access:{has:e=>"enableNotesSorting"in e,get:e=>e.enableNotesSorting,set:(e,t)=>{e.enableNotesSorting=t}},metadata:s},L,D),tP(this,null,u,{kind:"accessor",name:"index",static:!1,private:!1,access:{has:e=>"index"in e,get:e=>e.index,set:(e,t)=>{e.index=t}},metadata:s},Z,j),tP(this,null,p,{kind:"accessor",name:"invisible",static:!1,private:!1,access:{has:e=>"invisible"in e,get:e=>e.invisible,set:(e,t)=>{e.invisible=t}},metadata:s},V,z),tP(this,null,f,{kind:"accessor",name:"note",static:!1,private:!1,access:{has:e=>"note"in e,get:e=>e.note,set:(e,t)=>{e.note=t}},metadata:s},R,F),tP(this,null,g,{kind:"accessor",name:"number",static:!1,private:!1,access:{has:e=>"number"in e,get:e=>e.number,set:(e,t)=>{e.number=t}},metadata:s},N,q),tP(this,null,m,{kind:"accessor",name:"showPreviewIcon",static:!1,private:!1,access:{has:e=>"showPreviewIcon"in e,get:e=>e.showPreviewIcon,set:(e,t)=>{e.showPreviewIcon=t}},metadata:s},U,W),tP(this,null,b,{kind:"accessor",name:"status",static:!1,private:!1,access:{has:e=>"status"in e,get:e=>e.status,set:(e,t)=>{e.status=t}},metadata:s},G,Y),tP(null,e={value:t},w,{kind:"class",name:t.name,metadata:s},null,x),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=tA}_dispatchClickBlockEvent(e){let t=new CustomEvent("clickblock",{detail:{blockId:e.id}});this.dispatchEvent(t)}_dispatchDisplayModeChangeEvent(e,t){let i=new CustomEvent("displaymodechange",{detail:{note:e,newMode:t}});this.dispatchEvent(i)}_dispatchDragEvent(e){if(e.preventDefault(),0!==e.button||"page"===this.editorMode||!this.enableNotesSorting)return;let{clientX:t,clientY:i}=e,s=(0,y.on)(this.ownerDocument,"mousemove",e=>{if(5>Math.abs(t-e.clientX)&&5>Math.abs(i-e.clientY))return;"selected"!==this.status&&this._dispatchSelectEvent(e);let o=new CustomEvent("drag");this.dispatchEvent(o),s()});(0,y.OoU)(this.ownerDocument,"mouseup",()=>{s()})}_dispatchFitViewEvent(e){e.stopPropagation();let t=new CustomEvent("fitview",{detail:{block:this.note}});this.dispatchEvent(t)}_dispatchSelectEvent(e){e.stopPropagation();let t=new CustomEvent("select",{detail:{id:this.note.id,selected:"selected"!==this.status,number:this.number,multiselect:e.shiftKey}});this.dispatchEvent(t)}_getCurrentModeLabel(e){switch(e){case y.ko3.DocAndEdgeless:return"Both";case y.ko3.EdgelessOnly:return"Edgeless";case y.ko3.DocOnly:return"Page";default:return"Both"}}connectedCallback(){super.connectedCallback();let e=new MutationObserver(()=>this.requestUpdate());e.observe(this.ownerDocument.documentElement,{subtree:!1,childList:!1,attributes:!0,attributeFilter:["data-theme"]}),this._disposables.add(()=>e.disconnect())}firstUpdated(){this._displayModePopper=(0,y.j0U)(this._displayModeButtonGroup,this._displayModePanel,({display:e})=>{this._showPopper="show"===e},{mainAxis:8,crossAxis:-60}),this.disposables.add(this._displayModePopper)}render(){if(this.note.isEmpty.peek())return s.s6;let e=y.Qtn.mode,{children:t,displayMode:i}=this.note,o=this._getCurrentModeLabel(i),a=(0,r.H)({"card-header-container":!0,"enable-sorting":this.enableNotesSorting});return(0,s.qy)`
    ${(0,s.qy)`
    ${this.invisible?(0,s.qy)`${eq}`:(0,s.qy)`${this.number}`}
    Show in {e.stopPropagation(),this._displayModePopper?.toggle()}} @dblclick=${e=>e.stopPropagation()} >
    ${o} ${eU}
    {this._dispatchDisplayModeChangeEvent(this.note,e),this._displayModePopper?.hide()}} >
    `}
    ${t.map(e=>(0,s.qy)`{"edgeless"===this.editorMode||this.invisible||this._dispatchClickBlockEvent(e)}} >`)}
    `}#dC;get _displayModeButtonGroup(){return this.#dC}set _displayModeButtonGroup(e){this.#dC=e}#dk;get _displayModePanel(){return this.#dk}set _displayModePanel(e){this.#dk=e}#iV;get _showPopper(){return this.#iV}set _showPopper(e){this.#iV=e}#dS;get activeHeadingId(){return this.#dS}set activeHeadingId(e){this.#dS=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}#dM;get editorMode(){return this.#dM}set editorMode(e){this.#dM=e}#dx;get enableNotesSorting(){return this.#dx}set enableNotesSorting(e){this.#dx=e}#i;get index(){return this.#i}set index(e){this.#i=e}#dE;get invisible(){return this.#dE}set invisible(e){this.#dE=e}#dI;get note(){return this.#dI}set note(e){this.#dI=e}#dB;get number(){return this.#dB}set number(e){this.#dB=e}#d_;get showPreviewIcon(){return this.#d_}set showPreviewIcon(e){this.#d_=e}#cA;get status(){return this.#cA}set status(e){this.#cA=e}constructor(){super(...arguments),this._displayModePopper=null,this.#dC=tH(this,C,void 0),this.#dk=(tH(this,k),tH(this,S,void 0)),this.#iV=(tH(this,M),tH(this,E,!1)),this.#dS=(tH(this,I),tH(this,B,null)),this.#d=(tH(this,T),tH(this,O,void 0)),this.#dM=(tH(this,P),tH(this,H,"page")),this.#dx=(tH(this,A),tH(this,L,void 0)),this.#i=(tH(this,D),tH(this,Z,void 0)),this.#dE=(tH(this,j),tH(this,V,!1)),this.#dI=(tH(this,z),tH(this,R,void 0)),this.#dB=(tH(this,F),tH(this,N,void 0)),this.#d_=(tH(this,q),tH(this,U,void 0)),this.#cA=(tH(this,W),tH(this,G,void 0)),tH(this,Y)}static{tH(t,x)}})})();var tL=i(54702);function tD(e,t){let{host:i,mode:s}=e;if("edgeless"!==s&&i){if(e.doc.root?.id===t){let e=function(e){let t=e.closest(".affine-page-viewport");return t?t.querySelector("doc-title"):null}(i);if(!e)return;e.scrollIntoView({behavior:"smooth",block:"start"})}else{let e=i.view.getBlock(t);if(!e)return;e.scrollIntoView({behavior:"smooth",block:"center"})}}}let tZ=(e,t)=>{let i=e();t.value=i.doc.root?.id??null;let s=new e7.K;return s.addFromEvent(window,"scroll",()=>{let{host:i}=e();if(!i)return;let s=tI(i.doc,[y.ko3.DocAndEdgeless,y.ko3.DocOnly],!0),o=i.doc.root?.id??null;s.forEach(e=>{(function(e,t){let i=t.view.getBlock(e);if(!i)return!1;let s=(t.parentElement??t).getBoundingClientRect(),o=i.getBoundingClientRect(),r=(0,tL.qE)(s.top,0,document.documentElement.clientHeight)+Math.min(s.height,document.documentElement.clientHeight)/2;return o.top+o.height/2{null!==tz&&clearInterval(tz),tz=setInterval(()=>{if(null===tz){console.error("unreachable code");return}if(s>i){clearInterval(tz),o(()=>{});return}let{host:r}=e;if(!r){clearInterval(tz),o(()=>{});return}let a=r.view.getBlock(t);if(!a){clearInterval(tz),o(()=>{});return}let{top:n,bottom:l}=a.getBoundingClientRect();if(n<0||l>window.innerHeight){s+=100;return}clearInterval(tz),o(function(e,t){let i=()=>{},{host:s}=e;if(!s)return i;let o=s.querySelector("affine-page-root");if(!o)return i;if(!o.viewport)return console.error("viewport should exist"),i;let{top:r,left:a,scrollTop:n,scrollLeft:l}=o.viewport,c=s.view.getBlock(t);if(!c)return i;let{top:d,left:h,width:u,height:p}=c.getBoundingClientRect();return tj||(tj=document.createElement("div"),o.append(tj)),Object.assign(tj.style,{position:"absolute",top:`${d-r+n}px`,left:`${h-a+l}px`,width:`${u}px`,height:`${p}px`,background:"var(--affine-hover-color)",borderRadius:"4px",display:"block"}),null!==tV&&clearTimeout(tV),tV=setTimeout(()=>{tj&&(tj.style.display="none")},1e3),()=>{null!==tj&&(tj.remove(),tj=null),null!==tV&&(clearTimeout(tV),tV=null)}}(e,t))},100)})}var tF=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tN=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,n,l,c,d,h,u,p,f,g,m,b,w,x,_,C,k,S,M,E=[(0,o.EM)("affine-outline-panel-body")],I=[],B=(0,$.Jb)((0,v.Tm)(s.WF)),T=[],O=[],P=[],H=[],A=[],L=[],D=[],j=[],V=[],z=[],R=[],F=[],N=[],q=[],U=[],W=[],G=[],Y=[],K=[],X=[],Q=[],J=[],ee=[],et=[],ei=[],es=[],eo=[],er=[],ea=[],en=[],el=[],ec=[],ed=[],eh=[],eu=[],ep=[],ef=[],eg=[];(class extends B{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(B[Symbol.metadata]??null):void 0;i=[(0,o.wk)()],n=[(0,o.wk)()],l=[(0,o.wk)()],c=[(0,o.wk)()],d=[(0,o.P)(".outline-panel-body-container")],h=[(0,o.MZ)({attribute:!1})],u=[(0,o.MZ)({attribute:!1})],p=[(0,o.MZ)({attribute:!1})],f=[(0,o.MZ)({attribute:!1})],g=[(0,o.MZ)({attribute:!1})],m=[(0,o.MZ)({attribute:!1})],b=[(0,o.MZ)({attribute:!1})],w=[(0,o.MZ)({attribute:!1})],x=[(0,o.MZ)({attribute:!1})],_=[(0,o.P)(".panel-list")],C=[(0,o.MZ)({attribute:!1})],k=[(0,o.MZ)({attribute:!1})],S=[(0,o.MZ)({attribute:!1})],M=[(0,o.MZ)({attribute:!1})],tF(this,null,i,{kind:"accessor",name:"_dragging",static:!1,private:!1,access:{has:e=>"_dragging"in e,get:e=>e._dragging,set:(e,t)=>{e._dragging=t}},metadata:s},T,O),tF(this,null,n,{kind:"accessor",name:"_edgelessOnlyNotes",static:!1,private:!1,access:{has:e=>"_edgelessOnlyNotes"in e,get:e=>e._edgelessOnlyNotes,set:(e,t)=>{e._edgelessOnlyNotes=t}},metadata:s},P,H),tF(this,null,l,{kind:"accessor",name:"_pageVisibleNotes",static:!1,private:!1,access:{has:e=>"_pageVisibleNotes"in e,get:e=>e._pageVisibleNotes,set:(e,t)=>{e._pageVisibleNotes=t}},metadata:s},A,L),tF(this,null,c,{kind:"accessor",name:"_selected",static:!1,private:!1,access:{has:e=>"_selected"in e,get:e=>e._selected,set:(e,t)=>{e._selected=t}},metadata:s},D,j),tF(this,null,d,{kind:"accessor",name:"OutlinePanelContainer",static:!1,private:!1,access:{has:e=>"OutlinePanelContainer"in e,get:e=>e.OutlinePanelContainer,set:(e,t)=>{e.OutlinePanelContainer=t}},metadata:s},V,z),tF(this,null,h,{kind:"accessor",name:"activeHeadingId",static:!1,private:!1,access:{has:e=>"activeHeadingId"in e,get:e=>e.activeHeadingId,set:(e,t)=>{e.activeHeadingId=t}},metadata:s},R,F),tF(this,null,u,{kind:"accessor",name:"doc",static:!1,private:!1,access:{has:e=>"doc"in e,get:e=>e.doc,set:(e,t)=>{e.doc=t}},metadata:s},N,q),tF(this,null,p,{kind:"accessor",name:"domHost",static:!1,private:!1,access:{has:e=>"domHost"in e,get:e=>e.domHost,set:(e,t)=>{e.domHost=t}},metadata:s},U,W),tF(this,null,f,{kind:"accessor",name:"edgeless",static:!1,private:!1,access:{has:e=>"edgeless"in e,get:e=>e.edgeless,set:(e,t)=>{e.edgeless=t}},metadata:s},G,Y),tF(this,null,g,{kind:"accessor",name:"editor",static:!1,private:!1,access:{has:e=>"editor"in e,get:e=>e.editor,set:(e,t)=>{e.editor=t}},metadata:s},K,X),tF(this,null,m,{kind:"accessor",name:"enableNotesSorting",static:!1,private:!1,access:{has:e=>"enableNotesSorting"in e,get:e=>e.enableNotesSorting,set:(e,t)=>{e.enableNotesSorting=t}},metadata:s},Q,J),tF(this,null,b,{kind:"accessor",name:"fitPadding",static:!1,private:!1,access:{has:e=>"fitPadding"in e,get:e=>e.fitPadding,set:(e,t)=>{e.fitPadding=t}},metadata:s},ee,et),tF(this,null,w,{kind:"accessor",name:"insertIndex",static:!1,private:!1,access:{has:e=>"insertIndex"in e,get:e=>e.insertIndex,set:(e,t)=>{e.insertIndex=t}},metadata:s},ei,es),tF(this,null,x,{kind:"accessor",name:"noticeVisible",static:!1,private:!1,access:{has:e=>"noticeVisible"in e,get:e=>e.noticeVisible,set:(e,t)=>{e.noticeVisible=t}},metadata:s},eo,er),tF(this,null,_,{kind:"accessor",name:"panelListElement",static:!1,private:!1,access:{has:e=>"panelListElement"in e,get:e=>e.panelListElement,set:(e,t)=>{e.panelListElement=t}},metadata:s},ea,en),tF(this,null,C,{kind:"accessor",name:"renderEdgelessOnlyNotes",static:!1,private:!1,access:{has:e=>"renderEdgelessOnlyNotes"in e,get:e=>e.renderEdgelessOnlyNotes,set:(e,t)=>{e.renderEdgelessOnlyNotes=t}},metadata:s},el,ec),tF(this,null,k,{kind:"accessor",name:"setNoticeVisibility",static:!1,private:!1,access:{has:e=>"setNoticeVisibility"in e,get:e=>e.setNoticeVisibility,set:(e,t)=>{e.setNoticeVisibility=t}},metadata:s},ed,eh),tF(this,null,S,{kind:"accessor",name:"showPreviewIcon",static:!1,private:!1,access:{has:e=>"showPreviewIcon"in e,get:e=>e.showPreviewIcon,set:(e,t)=>{e.showPreviewIcon=t}},metadata:s},eu,ep),tF(this,null,M,{kind:"accessor",name:"toggleNotesSorting",static:!1,private:!1,access:{has:e=>"toggleNotesSorting"in e,get:e=>e.toggleNotesSorting,set:(e,t)=>{e.toggleNotesSorting=t}},metadata:s},ef,eg),tF(null,e={value:t},E,{kind:"class",name:t.name,metadata:s},null,I),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=tq}_EmptyPanel(){return(0,s.qy)`
    Use headings to create a table of contents.
    `}_PanelList(e){let t=new Set(this._selected);return(0,s.qy)`
    ${void 0!==this.insertIndex?(0,s.qy)`
    `:s.s6} ${this._renderDocTitle()} ${this._pageVisibleNotes.length?(0,a.u)(this._pageVisibleNotes,e=>e.note.id,(e,i)=>(0,s.qy)` `):(0,s.qy)`${s.s6}`} ${e?(0,s.qy)`
    Hidden Contents
    ${(0,a.u)(this._edgelessOnlyNotes,e=>e.note.id,(e,t)=>(0,s.qy)``)} `:s.s6}
    `}_clearDocDisposables(){this._docDisposables?.dispose(),this._docDisposables=null}_clickHandler(e){e.stopPropagation(),e.target.closest("outline-note-card")||0===this._selected.length||(this._selected=[],this.edgeless?.service.selection.set({elements:this._selected,editing:!1}))}_deSelectNoteInEdgelessMode(e){if(!this._isEdgelessMode()||!this.edgeless)return;let{selection:t}=this.edgeless.service;if(!t.has(e.id))return;let i=t.selectedIds.filter(t=>t!==e.id);t.set({elements:i,editing:!1})}_doubleClickHandler(e){e.stopPropagation(),e.target.closest("outline-note-card")||!this.enableNotesSorting||this.toggleNotesSorting()}_drag(){if(!this._selected.length||!this._pageVisibleNotes.length||!this.doc.root)return;this._dragging=!0;let e=this.doc.root.children.slice(),t=this._pageVisibleNotes,i=this._pageVisibleNotes.reduce((e,t,i)=>(e.set(t.note.id,{...t,number:i+1}),e),new Map),s=this._selected.slice();!function(e){let t,i;let{document:s,host:o,container:r,onDragMove:a,onDragEnd:n,outlineListContainer:l}=e,c=function(e){let t=e.createElement("div");return t.style.height="100vh",t.style.width="100vw",t.style.position="fixed",t.style.left="0",t.style.top="0",t.style.zIndex="calc(var(--affine-z-index-popover, 0) + 3)",t.style.cursor="grabbing",t}(s),d=l.getBoundingClientRect(),h=Array.from(l.children);r.renderRoot.append(c);let u=e=>e.clientX>=d.left&&e.clientX<=d.right&&e.clientY>=d.top&&e.clientY<=d.bottom,p=(0,y.on)(r,"mousemove",e=>{if(!u(e)){t=void 0,a?.(t,0);return}for(let s of(t=0,h)){if(s.invisible||!s.note)break;let o=d.top+s.offsetTop-l.scrollTop,r=o+s.offsetHeight/2,n=o+s.offsetHeight;if(e.clientY>=o&&e.clientY<=n){t=e.clientY>r?t+1:t,i=(e.clientY>r?n:o)-d.top,a?.(t,i);return}++t}a?.(t)}),f=!1;(0,y.OoU)(o,"mouseup",()=>{f||(f=!0,c.remove(),p(),n?.(t))})}({container:this,document:this.ownerDocument,host:this.domHost??this.ownerDocument,doc:this.doc,outlineListContainer:this.panelListElement,onDragEnd:o=>{this._dragging=!1,this.insertIndex=void 0,void 0!==o&&this._moveNotes(o,s,i,t,e)},onDragMove:(e,t)=>{this.insertIndex=e,this._indicatorTranslateY=t??0}})}_fitToElement(e){let t=this.edgeless;if(!t)return;let{block:i}=e.detail,s=Z.z.deserialize(i.xywh);t.service.viewport.setViewportByBound(s,this.viewportPadding,!0)}_handleDisplayModeChange(e){let{note:t,newMode:i}=e.detail,{displayMode:s}=t;if(i===s)return;this.doc.updateBlock(t,{displayMode:i});let o=this.doc.getParent(t);if(null===o){console.error(`Failed to get parent of note(id:${t.id})`);return}let r=o.children.filter(e=>y.yYJ.matchFlavours(e,["affine:note"])),a=r[r.length-1];s===y.ko3.EdgelessOnly&&t!==a&&this.doc.moveBlocks([t],o,a,!1),i===y.ko3.DocOnly&&this._deSelectNoteInEdgelessMode(t)}_isEdgelessMode(){return"edgeless"===this.editor.mode}_moveNotes(e,t,i,s,o){if(!this._isEdgelessMode()||!o.length||!this.doc.root)return;let r=t.map(e=>i.get(e).note),a=new Set(r),n=e===s.length?s[e-1].index+1:s[e].index,l=[...o.slice(0,n).filter(e=>!a.has(e)),...r,...o.slice(n).filter(e=>!a.has(e))];this._changedFlag=!0,this.doc.updateBlock(this.doc.root,{children:l})}_renderDocTitle(){return this.doc.root&&tI(this.doc,[y.ko3.DocOnly,y.ko3.DocAndEdgeless],!0).length>0?(0,s.qy)`{this.doc.root&&(tD(this.editor,this.doc.root.id),this.activeHeadingId.value=this.doc.root.id)}} >`:s.s6}async _scrollToBlock(e){this._clearHighlightMask=await tR(this.editor,e.detail.blockId),this.activeHeadingId.value=e.detail.blockId}_selectNote(e){if(!this._isEdgelessMode())return;let{selected:t,id:i,multiselect:s}=e.detail;t?s?this._selected=[...this._selected,i]:this._selected=[i]:this._selected=this._selected.filter(e=>e!==i);let o=this._pageVisibleNotes.reduce((e,t)=>{let i=t.note;return this._selected.includes(i.id)&&(!i.displayMode||i.displayMode===y.ko3.DocAndEdgeless)&&e.push(i.id),e},[]);this.edgeless?.service.selection.set({elements:o,editing:!1})}_setDocDisposables(){this._clearDocDisposables(),this._docDisposables=new e7.K,this._docDisposables.add((0,$.QZ)(()=>{this._updateNotes(),this._updateNoticeVisibility()}))}_shouldRenderNoteList(e){if(!e.length)return!1;let t=!1,i=!1;for(let s of e){for(let e of s.note.children)if(i=!0,tE(e)){t=!0;break}if(t)break}return t||this.enableNotesSorting&&i}_updateNotes(){let e=this.doc.root;if(this._dragging)return;if(!e){this._pageVisibleNotes=[];return}let t=this._selected.reduce((e,t)=>(e.add(t),e),new Set),i=[];e.children.forEach(e=>{["affine:note"].includes(e.flavour)&&e.displayMode!==y.ko3.EdgelessOnly&&t.has(e.id)&&i.push(e.id)}),this._pageVisibleNotes=tM(this.doc,[y.ko3.DocAndEdgeless,y.ko3.DocOnly]),this._edgelessOnlyNotes=tM(this.doc,[y.ko3.EdgelessOnly]),this._selected=i}_updateNoticeVisibility(){if(this.enableNotesSorting){this.noticeVisible&&this.setNoticeVisibility(!1);return}this._pageVisibleNotes.some(e=>e.note.displayMode===y.ko3.DocOnly)&&!this.noticeVisible&&this.setNoticeVisibility(!0)}_zoomToFit(){let e=this.edgeless;if(!e)return;let t=e.getElementsBound();t&&(this._oldViewport={zoom:e.service.viewport.zoom,center:{x:e.service.viewport.center.x,y:e.service.viewport.center.y}},e.service.viewport.setViewportByBound(new Z.z(t.x,t.y,t.w,t.h),this.viewportPadding,!0))}connectedCallback(){super.connectedCallback()}disconnectedCallback(){if(super.disconnectedCallback(),!this._changedFlag&&this._oldViewport){let e=this.edgeless;if(!e)return;e.service.viewport.setViewport(this._oldViewport.zoom,[this._oldViewport.center.x,this._oldViewport.center.y],!0)}this._clearDocDisposables(),this._clearHighlightMask()}firstUpdated(){this.disposables.addFromEvent(this,"click",this._clickHandler),this.disposables.addFromEvent(this,"dblclick",this._doubleClickHandler)}render(){let e=this._shouldRenderNoteList(this._pageVisibleNotes),t=this.renderEdgelessOnlyNotes&&this._shouldRenderNoteList(this._edgelessOnlyNotes),i=!e&&!t;return(0,s.qy)`
    ${i?this._EmptyPanel():this._PanelList(t)}
    `}willUpdate(e){(e.has("doc")||e.has("edgeless"))&&this._setDocDisposables(),e.has("mode")&&this.edgeless&&this._isEdgelessMode()&&(this._clearHighlightMask(),void 0!==e.get("mode"))&&requestAnimationFrame(()=>this._zoomToFit())}get viewportPadding(){return this.fitPadding?[0,0,0,0].map((e,t)=>Number.isFinite(this.fitPadding[t])?this.fitPadding[t]:e):[0,0,0,0]}#sq;get _dragging(){return this.#sq}set _dragging(e){this.#sq=e}#d$;get _edgelessOnlyNotes(){return this.#d$}set _edgelessOnlyNotes(e){this.#d$=e}#dT;get _pageVisibleNotes(){return this.#dT}set _pageVisibleNotes(e){this.#dT=e}#dn;get _selected(){return this.#dn}set _selected(e){this.#dn=e}#dO;get OutlinePanelContainer(){return this.#dO}set OutlinePanelContainer(e){this.#dO=e}#dS;get activeHeadingId(){return this.#dS}set activeHeadingId(e){this.#dS=e}#d;get doc(){return this.#d}set doc(e){this.#d=e}#dl;get domHost(){return this.#dl}set domHost(e){this.#dl=e}#i_;get edgeless(){return this.#i_}set edgeless(e){this.#i_=e}#cq;get editor(){return this.#cq}set editor(e){this.#cq=e}#dx;get enableNotesSorting(){return this.#dx}set enableNotesSorting(e){this.#dx=e}#dd;get fitPadding(){return this.#dd}set fitPadding(e){this.#dd=e}#du;get insertIndex(){return this.#du}set insertIndex(e){this.#du=e}#dm;get noticeVisible(){return this.#dm}set noticeVisible(e){this.#dm=e}#dP;get panelListElement(){return this.#dP}set panelListElement(e){this.#dP=e}#dH;get renderEdgelessOnlyNotes(){return this.#dH}set renderEdgelessOnlyNotes(e){this.#dH=e}#dv;get setNoticeVisibility(){return this.#dv}set setNoticeVisibility(e){this.#dv=e}#d_;get showPreviewIcon(){return this.#d_}set showPreviewIcon(e){this.#d_=e}#dy;get toggleNotesSorting(){return this.#dy}set toggleNotesSorting(e){this.#dy=e}constructor(){super(...arguments),this._changedFlag=!1,this._clearHighlightMask=()=>{},this._docDisposables=null,this._indicatorTranslateY=0,this.#sq=tN(this,T,!1),this.#d$=(tN(this,O),tN(this,P,[])),this.#dT=(tN(this,H),tN(this,A,[])),this.#dn=(tN(this,L),tN(this,D,[])),this.#dO=(tN(this,j),tN(this,V,void 0)),this.#dS=(tN(this,z),tN(this,R,void 0)),this.#d=(tN(this,F),tN(this,N,void 0)),this.#dl=(tN(this,q),tN(this,U,void 0)),this.#i_=(tN(this,W),tN(this,G,void 0)),this.#cq=(tN(this,Y),tN(this,K,void 0)),this.#dx=(tN(this,X),tN(this,Q,void 0)),this.#dd=(tN(this,J),tN(this,ee,void 0)),this.#du=(tN(this,et),tN(this,ei,void 0)),this.#dm=(tN(this,es),tN(this,eo,void 0)),this.#dP=(tN(this,er),tN(this,ea,void 0)),this.#dH=(tN(this,en),tN(this,el,!0)),this.#dv=(tN(this,ec),tN(this,ed,void 0)),this.#d_=(tN(this,eh),tN(this,eu,void 0)),this.#dy=(tN(this,ep),tN(this,ef,void 0)),tN(this,eg)}static{tN(t,I)}})})();var tU=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tW=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a=[(0,o.EM)("affine-outline-note-preview-setting-menu")],n=[],l=(0,v.Tm)(s.WF),c=[],d=[],h=[],u=[];(class extends l{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(l[Symbol.metadata]??null):void 0;i=[(0,o.MZ)({attribute:!1})],r=[(0,o.MZ)({attribute:!1})],tU(this,null,i,{kind:"accessor",name:"showPreviewIcon",static:!1,private:!1,access:{has:e=>"showPreviewIcon"in e,get:e=>e.showPreviewIcon,set:(e,t)=>{e.showPreviewIcon=t}},metadata:s},c,d),tU(this,null,r,{kind:"accessor",name:"toggleShowPreviewIcon",static:!1,private:!1,access:{has:e=>"toggleShowPreviewIcon"in e,get:e=>e.toggleShowPreviewIcon,set:(e,t)=>{e.toggleShowPreviewIcon=t}},metadata:s},h,u),tU(null,e={value:t},a,{kind:"class",name:t.name,metadata:s},null,n),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=tG}render(){return(0,s.qy)`
    e.stopPropagation()} >
    Settings
    Show type icon
    `}#d_=tW(this,c,void 0);get showPreviewIcon(){return this.#d_}set showPreviewIcon(e){this.#d_=e}#dA=(tW(this,d),tW(this,h,void 0));get toggleShowPreviewIcon(){return this.#dA}set toggleShowPreviewIcon(e){this.#dA=e}constructor(){super(...arguments),tW(this,u)}static{tW(t,n)}})})();var tY=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tK=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c,d,h=[(0,o.EM)("affine-outline-panel-header")],u=[],p=(0,v.Tm)(s.WF),f=[],g=[],m=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[],B=[];(class extends p{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;i=[(0,o.P)(".note-preview-setting-container")],r=[(0,o.P)(".note-setting-button")],a=[(0,o.wk)()],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],c=[(0,o.MZ)({attribute:!1})],d=[(0,o.MZ)({attribute:!1})],tY(this,null,i,{kind:"accessor",name:"_notePreviewSettingMenu",static:!1,private:!1,access:{has:e=>"_notePreviewSettingMenu"in e,get:e=>e._notePreviewSettingMenu,set:(e,t)=>{e._notePreviewSettingMenu=t}},metadata:s},f,g),tY(this,null,r,{kind:"accessor",name:"_noteSettingButton",static:!1,private:!1,access:{has:e=>"_noteSettingButton"in e,get:e=>e._noteSettingButton,set:(e,t)=>{e._noteSettingButton=t}},metadata:s},m,b),tY(this,null,a,{kind:"accessor",name:"_settingPopperShow",static:!1,private:!1,access:{has:e=>"_settingPopperShow"in e,get:e=>e._settingPopperShow,set:(e,t)=>{e._settingPopperShow=t}},metadata:s},w,x),tY(this,null,n,{kind:"accessor",name:"enableNotesSorting",static:!1,private:!1,access:{has:e=>"enableNotesSorting"in e,get:e=>e.enableNotesSorting,set:(e,t)=>{e.enableNotesSorting=t}},metadata:s},_,C),tY(this,null,l,{kind:"accessor",name:"showPreviewIcon",static:!1,private:!1,access:{has:e=>"showPreviewIcon"in e,get:e=>e.showPreviewIcon,set:(e,t)=>{e.showPreviewIcon=t}},metadata:s},k,S),tY(this,null,c,{kind:"accessor",name:"toggleNotesSorting",static:!1,private:!1,access:{has:e=>"toggleNotesSorting"in e,get:e=>e.toggleNotesSorting,set:(e,t)=>{e.toggleNotesSorting=t}},metadata:s},M,E),tY(this,null,d,{kind:"accessor",name:"toggleShowPreviewIcon",static:!1,private:!1,access:{has:e=>"toggleShowPreviewIcon"in e,get:e=>e.toggleShowPreviewIcon,set:(e,t)=>{e.toggleShowPreviewIcon=t}},metadata:s},I,B),tY(null,e={value:t},h,{kind:"class",name:t.name,metadata:s},null,u),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=tX}firstUpdated(){let e=this._disposables;this._notePreviewSettingMenuPopper=(0,y.j0U)(this._noteSettingButton,this._notePreviewSettingMenu,({display:e})=>{this._settingPopperShow="show"===e},{mainAxis:14,crossAxis:-30}),e.add(this._notePreviewSettingMenuPopper)}render(){return(0,s.qy)`
    Table of Contents this._notePreviewSettingMenuPopper?.toggle()} > ${ex}
    this.toggleNotesSorting()} > ${eR}
    `}#dL;get _notePreviewSettingMenu(){return this.#dL}set _notePreviewSettingMenu(e){this.#dL=e}#dD;get _noteSettingButton(){return this.#dD}set _noteSettingButton(e){this.#dD=e}#dg;get _settingPopperShow(){return this.#dg}set _settingPopperShow(e){this.#dg=e}#dx;get enableNotesSorting(){return this.#dx}set enableNotesSorting(e){this.#dx=e}#d_;get showPreviewIcon(){return this.#d_}set showPreviewIcon(e){this.#d_=e}#dy;get toggleNotesSorting(){return this.#dy}set toggleNotesSorting(e){this.#dy=e}#dA;get toggleShowPreviewIcon(){return this.#dA}set toggleShowPreviewIcon(e){this.#dA=e}constructor(){super(...arguments),this._notePreviewSettingMenuPopper=null,this.#dL=tK(this,f,void 0),this.#dD=(tK(this,g),tK(this,m,void 0)),this.#dg=(tK(this,b),tK(this,w,!1)),this.#dx=(tK(this,x),tK(this,_,void 0)),this.#d_=(tK(this,C),tK(this,k,void 0)),this.#dy=(tK(this,S),tK(this,M,void 0)),this.#dA=(tK(this,E),tK(this,I,void 0)),tK(this,B)}static{tK(t,u)}})})();var tQ=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tJ=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,r,a,n,l,c=[(0,o.EM)("affine-outline-panel")],d=[],h=(0,$.Jb)((0,v.Tm)(s.WF)),u=[],p=[],f=[],g=[],m=[],y=[],b=[],w=[],x=[],_=[];return class extends h{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;i=[(0,o.wk)()],r=[(0,o.wk)()],a=[(0,o.wk)()],n=[(0,o.MZ)({attribute:!1})],l=[(0,o.MZ)({attribute:!1})],tQ(this,null,i,{kind:"accessor",name:"_enableNotesSorting",static:!1,private:!1,access:{has:e=>"_enableNotesSorting"in e,get:e=>e._enableNotesSorting,set:(e,t)=>{e._enableNotesSorting=t}},metadata:s},u,p),tQ(this,null,r,{kind:"accessor",name:"_noticeVisible",static:!1,private:!1,access:{has:e=>"_noticeVisible"in e,get:e=>e._noticeVisible,set:(e,t)=>{e._noticeVisible=t}},metadata:s},f,g),tQ(this,null,a,{kind:"accessor",name:"_showPreviewIcon",static:!1,private:!1,access:{has:e=>"_showPreviewIcon"in e,get:e=>e._showPreviewIcon,set:(e,t)=>{e._showPreviewIcon=t}},metadata:s},m,y),tQ(this,null,n,{kind:"accessor",name:"editor",static:!1,private:!1,access:{has:e=>"editor"in e,get:e=>e.editor,set:(e,t)=>{e.editor=t}},metadata:s},b,w),tQ(this,null,l,{kind:"accessor",name:"fitPadding",static:!1,private:!1,access:{has:e=>"fitPadding"in e,get:e=>e.fitPadding,set:(e,t)=>{e.fitPadding=t}},metadata:s},x,_),tQ(null,e={value:t},c,{kind:"class",name:t.name,metadata:s},null,d),t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.styles=t1}_clearEditorDisposables(){this._editorDisposables?.dispose(),this._editorDisposables=null}_loadSettingsFromLocalStorage(){let e=localStorage.getItem(tS);e&&(this._settings=JSON.parse(e),this._showPreviewIcon=this._settings.showIcons,this._enableNotesSorting=this._settings.enableSorting)}_saveSettingsToLocalStorage(){localStorage.setItem(tS,JSON.stringify(this._settings))}_setEditorDisposables(){this._clearEditorDisposables(),this._editorDisposables=new e7.K,this._editorDisposables.add(this.editor.slots.editorModeSwitched.on(()=>{this.editor.updateComplete.then(()=>{this.requestUpdate()}).catch(console.error)})),this._editorDisposables.add(this.editor.slots.docUpdated.on(()=>{this.editor.updateComplete.then(()=>{this.requestUpdate()}).catch(console.error)}))}_updateAndSaveSettings(e){this._settings={...this._settings,...e},this._saveSettingsToLocalStorage()}connectedCallback(){super.connectedCallback(),this._loadSettingsFromLocalStorage(),this.disposables.add(tZ(()=>this.editor,this._activeHeadingId$))}disconnectedCallback(){super.disconnectedCallback(),this._clearEditorDisposables()}render(){if(this.host)return(0,s.qy)`
    `}updated(e){e.has("editor")&&this._setEditorDisposables()}get doc(){return this.editor.doc}get edgeless(){return this.editor.querySelector("affine-edgeless-root")}get host(){return this.editor.host}get mode(){return this.editor.mode}#dZ;get _enableNotesSorting(){return this.#dZ}set _enableNotesSorting(e){this.#dZ=e}#dj;get _noticeVisible(){return this.#dj}set _noticeVisible(e){this.#dj=e}#dV;get _showPreviewIcon(){return this.#dV}set _showPreviewIcon(e){this.#dV=e}#cq;get editor(){return this.#cq}set editor(e){this.#cq=e}#dd;get fitPadding(){return this.#dd}set fitPadding(e){this.#dd=e}constructor(){super(...arguments),this._activeHeadingId$=(0,$.vP)(null),this._editorDisposables=null,this._setNoticeVisibility=e=>{this._noticeVisible=e},this._settings={showIcons:!1,enableSorting:!1},this._toggleNotesSorting=()=>{this._enableNotesSorting=!this._enableNotesSorting,this._updateAndSaveSettings({enableSorting:this._enableNotesSorting})},this._toggleShowPreviewIcon=e=>{this._showPreviewIcon=e,this._updateAndSaveSettings({showIcons:e})},this.#dZ=tJ(this,u,!1),this.#dj=(tJ(this,p),tJ(this,f,!1)),this.#dV=(tJ(this,g),tJ(this,m,!1)),this.#cq=(tJ(this,y),tJ(this,b,void 0)),this.#dd=(tJ(this,w),tJ(this,x,void 0)),tJ(this,_)}static{tJ(t,d)}},t})();var t2=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},t5=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i,n,l,c,d,h,u=[(0,o.EM)("affine-outline-viewer")],p=[],f=(0,$.Jb)((0,v.Tm)(s.WF)),g=[],m=[],b=[],w=[],x=[],_=[],C=[],k=[],S=[],M=[],E=[],I=[];var B=class extends f{static{t=this}static{let s="function"==typeof Symbol&&Symbol.metadata?Object.create(f[Symbol.metadata]??null):void 0;i=[(0,o.wk)()],n=[(0,o.P)(".outline-viewer-indicator.active")],l=[(0,o.P)(".outline-viewer-root")],c=[(0,o.wk)()],d=[(0,o.MZ)({attribute:!1})],h=[(0,o.MZ)({attribute:!1})],t2(this,null,i,{kind:"accessor",name:"_activeHeadingId",static:!1,private:!1,access:{has:e=>"_activeHeadingId"in e,get:e=>e._activeHeadingId,set:(e,t)=>{e._activeHeadingId=t}},metadata:s},g,m),t2(this,null,n,{kind:"accessor",name:"_activeIndicator",static:!1,private:!1,access:{has:e=>"_activeIndicator"in e,get:e=>e._activeIndicator,set:(e,t)=>{e._activeIndicator=t}},metadata:s},b,w),t2(this,null,l,{kind:"accessor",name:"_root",static:!1,private:!1,access:{has:e=>"_root"in e,get:e=>e._root,set:(e,t)=>{e._root=t}},metadata:s},x,_),t2(this,null,c,{kind:"accessor",name:"_showViewer",static:!1,private:!1,access:{has:e=>"_showViewer"in e,get:e=>e._showViewer,set:(e,t)=>{e._showViewer=t}},metadata:s},C,k),t2(this,null,d,{kind:"accessor",name:"editor",static:!1,private:!1,access:{has:e=>"editor"in e,get:e=>e.editor,set:(e,t)=>{e.editor=t}},metadata:s},S,M),t2(this,null,h,{kind:"accessor",name:"toggleOutlinePanel",static:!1,private:!1,access:{has:e=>"toggleOutlinePanel"in e,get:e=>e.toggleOutlinePanel,set:(e,t)=>{e.toggleOutlinePanel=t}},metadata:s},E,I),t2(null,e={value:t},u,{kind:"class",name:t.name,metadata:s},null,p),B=t=e.value,s&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:s})}static{this.animationDuration=400}static{this.styles=(0,s.AH)` :host { display: flex; } .outline-viewer-root { --timing: cubic-bezier(0.2, 1.2, 0.41, 1); --duration: ${B.animationDuration}ms; position: relative; display: flex; flex-direction: column; align-items: flex-end; gap: 16px; max-height: 100%; box-sizing: border-box; border: 1px solid transparent; overflow-y: hidden; transition: all var(--duration) var(--timing); } .outline-viewer-indicator { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 20px; height: 2px; border-radius: 1px; overflow: hidden; background: var(--affine-black-10, rgba(0, 0, 0, 0.1)); transition: all var(--duration) var(--timing), background 0.8s var(--timing); } .outline-viewer-content { display: flex; transition: all var(--duration) var(--timing); width: 184px; opacity: 0; } .outline-viewer-indicator.header { background-color: transparent; } .outline-viewer-indicator.header { .outline-viewer-content { gap: 4px; padding: 6px 8px; span { flex: 1; overflow: hidden; color: var(--affine-text-secondary-color, #8e8d91); text-overflow: ellipsis; text-wrap: nowrap; font-family: var(--affine-font-family); font-size: 12px; font-style: normal; font-weight: 500; line-height: 20px; } } } .outline-viewer-indicator.active { width: 24px; background: var(--affine-text-primary-color); } .outline-viewer-root:hover { gap: 0px; padding: 8px 4px 8px 8px; background: var(--affine-background-overlay-panel-color); border-radius: 8px; border-color: var(--affine-border-color); box-shadow: 0px 6px 16px 0px rgba(0, 0, 0, 0.14); overflow-y: auto; transition: all var(--duration) var(--timing), max-height 0.1s ease; .outline-viewer-indicator { background: transparent; width: 180px; height: 30px; transition: all var(--duration) var(--timing), background 0.2s var(--timing); } .outline-viewer-content { opacity: 1; } } ${(0,y.kMM)(".outline-viewer-root:hover")} `}async _scrollToBlock(e){this._lockIndicatorsScroll=!0,this._unlockIndicatorsScrollTimeout&&clearTimeout(this._unlockIndicatorsScrollTimeout),this._unlockIndicatorsScrollTimeout=setTimeout(()=>{this._lockIndicatorsScroll=!1},1e3),this._clearHighlightMask=await tR(this.editor,e)}_toggleOutlinePanel(){this.toggleOutlinePanel&&(this._showViewer=!1,this.toggleOutlinePanel())}connectedCallback(){super.connectedCallback(),this.disposables.add(tZ(()=>this.editor,this._activeHeadingId$)),this.disposables.add((0,$.QZ)(()=>{this._activeHeadingId=this._activeHeadingId$.value}))}disconnectedCallback(){super.disconnectedCallback(),this._clearHighlightMask(),this._unlockIndicatorsScrollTimeout&&clearTimeout(this._unlockIndicatorsScrollTimeout)}render(){if(!this.editor||!this.editor.doc.root||"edgeless"===this.editor.mode)return s.s6;let e=tI(this.editor.doc,[y.ko3.DocAndEdgeless,y.ko3.DocOnly],!0);if(0===e.length)return s.s6;let t=[...this.editor.doc.meta?.title!==""?[this.editor.doc.root]:[],...e],i=()=>{setTimeout(this._scrollIndicator,B.animationDuration)};return(0,s.qy)`
    Table of Contents ${eG}
    ${(0,a.u)(t,e=>e.id,e=>{let t=this._activeHeadingId===e.id;return(0,s.qy)`
    {this._scrollToBlock(e.id).catch(console.error)}} >
    `})}
    `}updated(e){e.has("_activeHeadingId")&&this._scrollIndicator()}#dz;get _activeHeadingId(){return this.#dz}set _activeHeadingId(e){this.#dz=e}#dR;get _activeIndicator(){return this.#dR}set _activeIndicator(e){this.#dR=e}#dF;get _root(){return this.#dF}set _root(e){this.#dF=e}#dN;get _showViewer(){return this.#dN}set _showViewer(e){this.#dN=e}#cq;get editor(){return this.#cq}set editor(e){this.#cq=e}#dq;get toggleOutlinePanel(){return this.#dq}set toggleOutlinePanel(e){this.#dq=e}constructor(){super(...arguments),this._activeHeadingId$=(0,$.vP)(null),this._clearHighlightMask=()=>{},this._lockIndicatorsScroll=!1,this._scrollIndicator=()=>{if(this._lockIndicatorsScroll||!this._root)return;if(!this._activeIndicator){this._root.scrollTop=0;return}let{top:e,bottom:t}=this._activeIndicator.getBoundingClientRect(),{top:i,bottom:s}=this._root.getBoundingClientRect();es&&(this._root.scrollTop+=t-s+5)},this._unlockIndicatorsScrollTimeout=null,this.#dz=t5(this,g,null),this.#dR=(t5(this,m),t5(this,b,null)),this.#dF=(t5(this,w),t5(this,x,null)),this.#dN=(t5(this,_),t5(this,C,!1)),this.#cq=(t5(this,k),t5(this,S,void 0)),this.#dq=(t5(this,M),t5(this,E,null)),t5(this,I)}static{t5(t,p)}};return B=t})();i(77955);let t3="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},t4="__ $BLOCKSUITE_EDITOR$ __";if(!0===t3[t4]&&console.error("@blocksuite/presets was already imported. This breaks constructor checks and will lead to issues!"),"undefined"==typeof window)throw Error("Seems like you are importing @blocksuite/presets in SSR mode. Which is not supported for now.");t3[t4]=!0},73711:(e,t,i)=>{i.d(t,{PV:()=>m,Dy:()=>g,S4:()=>tB,zg:()=>U,T1:()=>tP,lv:()=>o,J5:()=>k,JA:()=>eF,rl:()=>tE,gE:()=>tD,jH:()=>n,_O:()=>tZ,Sj:()=>eY,Ji:()=>tO,DX:()=>A.D,EY:()=>M,O6:()=>H,A9:()=>F,yf:()=>h,rS:()=>tI,wm:()=>u,Ak:()=>t_,uS:()=>t$});var s,o,r,a,n,l=i(68419),c=i(73134);let d=new Map([["application/epub+zip","epub"],["application/gzip","gz"],["application/java-archive","jar"],["application/json","json"],["application/ld+json","jsonld"],["application/msword","doc"],["application/octet-stream","bin"],["application/ogg","ogx"],["application/pdf","pdf"],["application/rtf","rtf"],["application/vnd.amazon.ebook","azw"],["application/vnd.apple.installer+xml","mpkg"],["application/vnd.mozilla.xul+xml","xul"],["application/vnd.ms-excel","xls"],["application/vnd.ms-fontobject","eot"],["application/vnd.ms-powerpoint","ppt"],["application/vnd.oasis.opendocument.presentation","odp"],["application/vnd.oasis.opendocument.spreadsheet","ods"],["application/vnd.oasis.opendocument.text","odt"],["application/vnd.openxmlformats-officedocument.presentationml.presentation","pptx"],["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","xlsx"],["application/vnd.openxmlformats-officedocument.wordprocessingml.document","docx"],["application/vnd.rar","rar"],["application/vnd.visio","vsd"],["application/x-7z-compressed","7z"],["application/x-abiword","abw"],["application/x-bzip","bz"],["application/x-bzip2","bz2"],["application/x-cdf","cda"],["application/x-csh","csh"],["application/x-freearc","arc"],["application/x-httpd-php","php"],["application/x-sh","sh"],["application/x-tar","tar"],["application/xhtml+xml","xhtml"],["application/xml","xml"],["application/zip","zip"],["application/zstd","zst"],["audio/3gpp","3gp"],["audio/3gpp2","3g2"],["audio/aac","aac"],["audio/midi","mid"],["audio/mpeg","mp3"],["audio/ogg","oga"],["audio/opus","opus"],["audio/wav","wav"],["audio/webm","weba"],["audio/x-midi","midi"],["font/otf","otf"],["font/ttf","ttf"],["font/woff","woff"],["font/woff2","woff2"],["image/apng","apng"],["image/avif","avif"],["image/bmp","bmp"],["image/gif","gif"],["image/jpeg","jpeg"],["image/png","png"],["image/svg+xml","svg"],["image/tiff","tiff"],["image/vnd.microsoft.icon","ico"],["image/webp","webp"],["text/calendar","ics"],["text/css","css"],["text/csv","csv"],["text/html","html"],["text/javascript","js"],["text/plain","txt"],["text/xml","xml"],["video/3gpp","3gp"],["video/3gpp2","3g2"],["video/mp2t","ts"],["video/mp4","mp4"],["video/mpeg","mpeg"],["video/ogg","ogv"],["video/webm","webm"],["video/x-msvideo","avi"]]),h=new Map(Array.from(d.entries()).map(([e,t])=>[t,e]));function u(e,t){var i;let s=e.get(t);if(!s)throw new l.Ss(c.O.TransformerError,`blob not found for blobId: ${t}`);let o=s.name??void 0,r=void 0!==o&&o.includes(".")?o.split(".").at(-1):""===(i=s.type)?"blob":d.get(i)||(i.split("/").at(-1)??"blob");return`${o?.split(".").at(0)??t}.${r}`}var p=i(71006);class f{constructor(){this._defaultProp="children",this._globalContext=Object.create(null),this._skip=!1,this._skipChildrenNum=0,this._stack=[],this.setDefaultProp=e=>{this._defaultProp=e}}current(){return this._stack[this._stack.length-1]}closeNode(){let e=this._stack.pop();if(!e)return this;let t=this._stack.pop();return t?(t.node[e.prop]instanceof Array&&t.node[e.prop].push(e.node),this._stack.push(t)):this._stack.push(e),this}currentNode(){return this.current()?.node}getGlobalContext(e){return this._globalContext[e]}getGlobalContextStack(e){let t=this._globalContext[e];return t instanceof Array?t:[]}getNodeContext(e){return this.current().context[e]}getPreviousNodeContext(e){return this._stack[this._stack.length-2]?.context[e]}openNode(e,t){return this._stack.push({node:e,prop:t??this._defaultProp,context:Object.create(null)}),this}previousNode(){return this._stack[this._stack.length-2]?.node}pushGlobalContextStack(e,t){let i=this._globalContext[e];i instanceof Array?i.push(t):this._globalContext[e]=[t]}setGlobalContext(e,t){return this._globalContext[e]=t,this}setGlobalContextStack(e,t){this._globalContext[e]=t}setNodeContext(e,t){return this._stack[this._stack.length-1].context[e]=t,this}skipAllChildren(){this._skip=!0}skipChildren(e=1){this._skipChildrenNum=e}get stack(){return this._stack}}class g{constructor(e){this.job=e}async fromBlock(e){try{let t=await this.job.blockToSnapshot(e);if(!t)return;return await this.fromBlockSnapshot({snapshot:t,assets:this.job.assetsManager})}catch(e){console.error("Cannot convert block to snapshot"),console.error(e);return}}async fromDoc(e){try{let t=await this.job.docToSnapshot(e);if(!t)return;return await this.fromDocSnapshot({snapshot:t,assets:this.job.assetsManager})}catch(e){console.error("Cannot convert doc to snapshot"),console.error(e);return}}async fromSlice(e){try{let t=await this.job.sliceToSnapshot(e);if(!t)return;return await this.fromSliceSnapshot({snapshot:t,assets:this.job.assetsManager})}catch(e){console.error("Cannot convert slice to snapshot"),console.error(e);return}}async toBlock(e,t,i,s){try{let o=await this.toBlockSnapshot(e);if(!o)return;return await this.job.snapshotToBlock(o,t,i,s)}catch(e){console.error("Cannot convert block snapshot to block"),console.error(e);return}}async toDoc(e){try{let t=await this.toDocSnapshot(e);if(!t)return;return await this.job.snapshotToDoc(t)}catch(e){console.error("Cannot convert doc snapshot to doc"),console.error(e);return}}async toSlice(e,t,i,s){try{let o=await this.toSliceSnapshot(e);if(!o)return;return await this.job.snapshotToSlice(o,t,i,s)}catch(e){console.error("Cannot convert slice snapshot to slice"),console.error(e);return}}get configs(){return this.job.adapterConfigs}}class m{constructor(){this._visit=async e=>{if(e.node&&(this.context._skipChildrenNum=0,this.context._skip=!1,this._enter&&await this._enter(e,this.context),!this.context._skip)){for(let t in e.node){let i=e.node[t];if(i&&"object"==typeof i){if(Array.isArray(i))for(let s=this.context._skipChildrenNum;s{this._enter=e},this.setLeave=e=>{this._leave=e},this.setONodeTypeGuard=e=>{this._isONode=e},this.walk=async(e,t)=>(this.context.openNode(t),await this._visit({node:e,parent:null,prop:null,index:null}),(0,p.U2)(this.context.stack.length,1,"There are unclosed nodes"),this.context.currentNode()),this.walkONode=async e=>{await this._visit({node:e,parent:null,prop:null,index:null})},this.context=new f}}let v=[{desc:"add pageVersion in meta",condition:e=>2>e.getMap("meta").get("workspaceVersion"),migrate:e=>{let t=e.getMap("meta");t.set("pageVersion",1),t.set("workspaceVersion",2)}}];var y=i(16820);let b=[{desc:"frame element --> frame block (doc v1 --> v2)",condition:e=>e<2,migrate:(e,t)=>{let i,s;let o=t.getMap("blocks");o.forEach(e=>{let t=e.get("sys:flavour");"affine:page"===t&&(i=e),"affine:surface"===t&&(s=e)}),(0,p.Z1)(i),(0,p.Z1)(s);let r=s.get("prop:elements").get("value");r.forEach(e=>{if("frame"===e.get("type")){let t=new y.Map,s=e.get("id");t.set("sys:flavour","affine:frame"),t.set("sys:id",s),t.set("sys:children",new y.Array),t.set("prop:title",e.get("title").clone()),t.set("prop:xywh",e.get("xywh")),t.set("prop:index",e.get("index")),o.set(s,t),i.get("sys:children").push([s]),r.delete(s)}})}}],w="Schema not found. The block flavour may not be registered.",x="$blocksuite:internal:text$",_="$blocksuite:internal:native$",C=new Set(["id","flavour","children"]);class k{static{this.from=(e,t)=>new k(e.get("value"),t)}static{this.is=e=>e instanceof y.Map&&e.get("type")===_}constructor(e,t){this.getValue=()=>this._map.get("value"),this.setValue=e=>this._map.set("value",e),this._onChange=t,e instanceof y.Map&&e.get("type")===_?this._map=e:(this._map=new y.Map,this._map.set("type",_),this._map.set("value",e)),this._map.observeDeep(()=>{this._onChange?.(this.getValue())})}bind(e){this._onChange=e}get yMap(){return this._map}}var S=i(65282);class M{constructor(e,t){this._onChange=t;let i=0;if("string"==typeof e){let t=e.replaceAll("\r\n","\n");i=t.length,this._yText=new y.Text(t)}else if(e instanceof y.Text)this._yText=e,i=e.length;else if(e instanceof Array){for(let t of e)t.insert&&(t.insert=t.insert.replaceAll("\r\n","\n"),i+=t.insert.length);let t=new y.Text;t.applyDelta(e),this._yText=t}else this._yText=new y.Text;this._length$=(0,S.vP)(i),this._yText.observe(()=>{this._length$.value=this._yText.length,this._onChange?.(this._yText)})}static fromDelta(e,t){let i=new y.Text;return i.applyDelta(e),new M(i,t)}_transact(e){let t=this._yText.doc;if(!t)throw new l.Ss(c.O.ReactiveProxyError,"Failed to transact text! yText is not attached to a doc");t.transact(()=>{e()},t.clientID)}applyDelta(e){this._transact(()=>{this._yText?.applyDelta(e)})}bind(e){this._onChange=e}clear(){this._yText.length&&this._transact(()=>{this._yText.delete(0,this._yText.length)})}clone(){return new M(this._yText.clone(),this._onChange)}delete(e,t){if(0!==t){if(e<0||t<0||e+t>this._yText.length)throw new l.Ss(c.O.ReactiveProxyError,"Failed to delete text! Index or length out of range, index: "+e+", length: "+t+", text length: "+this._yText.length);this._transact(()=>{this._yText.delete(e,t)})}}format(e,t,i){if(0!==t){if(e<0||t<0||e+t>this._yText.length)throw new l.Ss(c.O.ReactiveProxyError,"Failed to format text! Index or length out of range, index: "+e+", length: "+t+", text length: "+this._yText.length);this._transact(()=>{this._yText.format(e,t,i)})}}insert(e,t,i){if(e.length){if(t<0||t>this._yText.length)throw new l.Ss(c.O.ReactiveProxyError,"Failed to insert text! Index or length out of range, index: "+t+", length: "+length+", text length: "+this._yText.length);this._transact(()=>{this._yText.insert(t,e,i)})}}join(e){e&&e.toDelta().length&&this._transact(()=>{let t=e._yText.toDelta();t.unshift({retain:this._yText.length}),this._yText.applyDelta(t)})}replace(e,t,i,s){if(e<0||t<0||e+t>this._yText.length)throw new l.Ss(c.O.ReactiveProxyError,"Failed to replace text! The length of the text is"+this._yText.length+", but you are trying to replace from"+e+"to"+e+t);this._transact(()=>{this._yText.delete(e,t),this._yText.insert(e,i,s)})}sliceToDelta(e,t){let i=[];if(t&&e>=t)return i;if(0===e&&0===t)return[];let s=this.toDelta();if(e<1&&!t)return s;if(s&&s instanceof Array){let o=0;for(let r=0;rt,d=o+l>e&&0===i.length;if(d&&c){n=n.slice(e-o,t-o),i.push({...a,insert:n});break}if(d||c?(n=c?n.slice(0,t-o):n.slice(e-o),i.push({...a,insert:n})):i.length>0&&i.push(a),t&&o+l>t)break;o+=l}}return i}split(e,t=0){if(e<0||t<0||e+t>this._yText.length)throw new l.Ss(c.O.ReactiveProxyError,"Failed to split text! Index or length out of range, index: "+e+", length: "+t+", text length: "+this._yText.length);let i=this._yText.toDelta();if(!(i instanceof Array))throw new l.Ss(c.O.ReactiveProxyError,"This text cannot be split because we failed to get the deltas of it.");let s=0,o=[];for(let r=0;r=e+t){let n=a.slice(e+t-s);o.push({insert:n,attributes:i[r].attributes}),o.push(...i.slice(r+1));break}s+=a.length}else throw new l.Ss(c.O.ReactiveProxyError,"This text cannot be split because it contains non-string insert.")}this.delete(e,this.length-e);let r=new y.Text;return r.applyDelta(o),new M(r,this._onChange)}toDelta(){return this._yText?.toDelta()||[]}toString(){return this._yText?.toString()||""}get length(){return this._length$.value}get yText(){return this._yText}}function E(e){return null!==e&&"object"==typeof e&&"[object Object]"===Object.prototype.toString.call(e)&&[Object,void 0,null].some(t=>t===e.constructor)}function I(e,{deep:t=!0,transform:i=e=>e}={}){if(e instanceof k)return e.yMap;if(e instanceof M)return e.yText.doc?e.yText.clone():e.yText;if(Array.isArray(e)){let s=new y.Array,o=e.map(e=>t?I(e,{deep:t,transform:i}):e);return s.insert(0,o),s}if(E(e)){let s=new y.Map;return Object.entries(e).forEach(([e,o])=>{s.set(e,t?I(o,{deep:t,transform:i}):o)}),s}return e}function B(e,{deep:t=!0,transform:i=e=>e}={}){if(k.is(e))return i(new k(e),e);if(e instanceof y.Text)return i(new M(e),e);if(e instanceof y.Array){let s=e.toArray().map(e=>t?B(e,{deep:t,transform:i}):e);return i(s,e)}if(e instanceof y.Map){let s=Object.fromEntries(Array.from(e.entries()).map(([e,s])=>[e,t?B(s,{deep:t,transform:i}):s]));return i(s,e)}return i(e,e)}class ${constructor(){this._getOrigin=e=>({doc:e,proxy:!0,target:this}),this._onObserve=(e,t)=>{e.transaction.origin?.proxy!==!0&&(!e.transaction.local||e.transaction.origin instanceof y.UndoManager)&&t(),this._options.onChange?.(this._proxy)},this._skipNext=!1,this._stashed=new Set,this._transact=(e,t)=>{e.transact(t,this._getOrigin(e))},this._updateWithSkip=e=>{this._skipNext=!0,e(),this._skipNext=!1}}get proxy(){return this._proxy}}let T=new WeakMap;class O extends ${constructor(e,t,i){super(),this._source=e,this._ySource=t,this._options=i,this._getProxy=()=>new Proxy(this._source,{has:(e,t)=>Reflect.has(e,t),set:(e,t,i,s)=>{if("string"!=typeof t)throw new l.Ss(c.O.ReactiveProxyError,"key cannot be a symbol");let o=Number(t);if(this._skipNext||Number.isNaN(o))return Reflect.set(e,t,i,s);if(this._stashed.has(o)){let o=Reflect.set(e,t,i,s);return this._options.onChange?.(this._proxy),o}if(!T.get(this._ySource))throw new l.Ss(c.O.ReactiveProxyError,"YData is not subscribed before changes");let r=this._ySource.doc;if(!r)throw new l.Ss(c.O.ReactiveProxyError,"YData is not bound to a Y.Doc");let a=I(i);return this._transact(r,()=>{oReflect.get(e,t,i),deleteProperty:(e,t)=>{if("string"!=typeof t)throw new l.Ss(c.O.ReactiveProxyError,"key cannot be a symbol");if(!T.get(this._ySource))throw new l.Ss(c.O.ReactiveProxyError,"YData is not subscribed before changes");let i=this._ySource.doc;if(!i)throw new l.Ss(c.O.ReactiveProxyError,"YData is not bound to a Y.Doc");let s=Number(t);return this._skipNext||Number.isNaN(s)||this._transact(i,()=>{this._ySource.delete(s,1)}),Reflect.deleteProperty(e,t)}}),this._observer=e=>{this._onObserve(e,()=>{let t=0;e.changes.delta.forEach(e=>{if(e.retain){t+=e.retain;return}if(e.delete){this._updateWithSkip(()=>{this._source.splice(t,e.delete)});return}if(e.insert){let i=[e.insert].flat().map(e=>H(e));this._updateWithSkip(()=>{this._source.splice(t,0,...i)}),t+=e.insert.length}})})},this._proxy=this._getProxy(),T.set(t,this),t.observe(this._observer)}pop(e){let t=this._source[e];this._stashed.delete(e),this._proxy[e]=t}stash(e){this._stashed.add(e)}}class P extends ${constructor(e,t,i){super(),this._source=e,this._ySource=t,this._options=i,this._getProxy=()=>new Proxy(this._source,{has:(e,t)=>Reflect.has(e,t),set:(e,t,i,s)=>{if("string"!=typeof t)throw new l.Ss(c.O.ReactiveProxyError,"key cannot be a symbol");if(this._skipNext)return Reflect.set(e,t,i,s);if(this._stashed.has(t)){let o=Reflect.set(e,t,i,s);return this._options.onChange?.(this._proxy),o}if(!T.get(this._ySource))throw new l.Ss(c.O.ReactiveProxyError,"YData is not subscribed before changes");let o=this._ySource.doc;if(!o)throw new l.Ss(c.O.ReactiveProxyError,"YData is not bound to a Y.Doc");let r=I(i);return this._transact(o,()=>{this._ySource.set(t,r)}),Reflect.set(e,t,H(r,this._options),s)},get:(e,t,i)=>Reflect.get(e,t,i),deleteProperty:(e,t)=>{if("string"!=typeof t)throw new l.Ss(c.O.ReactiveProxyError,"key cannot be a symbol");if(this._skipNext)return Reflect.deleteProperty(e,t);if(!T.get(this._ySource))throw new l.Ss(c.O.ReactiveProxyError,"YData is not subscribed before changes");let i=this._ySource.doc;if(!i)throw new l.Ss(c.O.ReactiveProxyError,"YData is not bound to a Y.Doc");return this._transact(i,()=>{this._ySource.delete(t)}),Reflect.deleteProperty(e,t)}}),this._observer=e=>{this._onObserve(e,()=>{e.keysChanged.forEach(t=>{let i=e.changes.keys.get(t);if(i){if("delete"===i.action)this._updateWithSkip(()=>{delete this._source[t]});else if("add"===i.action||"update"===i.action){let e=this._ySource.get(t);this._updateWithSkip(()=>{this._source[t]=T.has(e)?T.get(e):H(e,this._options)})}}})})},this._proxy=this._getProxy(),T.set(t,this),t.observe(this._observer)}pop(e){let t=this._source[e];this._stashed.delete(e),this._proxy[e]=t}stash(e){this._stashed.add(e)}}function H(e,t={}){return T.has(e)?T.get(e).proxy:B(e,{transform:(e,i)=>e instanceof M||k.is(i)?(e.bind(t.onChange),e):i instanceof y.Array?new O(e,i,t).proxy:i instanceof y.Map?new P(e,i,t).proxy:e})}var A=i(50620),L=i(67448);let D=L.z.string(),Z=L.z.array(L.z.string()).optional(),j=L.z.array(L.z.string()).optional(),V=L.z.enum(["root","hub","content"]),z=Object.freeze({Text:(e="")=>new M(e),Boxed:e=>new k(e)}),R=L.z.object({version:L.z.number(),model:L.z.object({role:V,flavour:D,parent:Z,children:j,props:L.z.function().args(L.z.custom()).returns(L.z.record(L.z.any())).optional(),toModel:L.z.function().args().returns(L.z.custom()).optional()}),transformer:L.z.function().args().returns(L.z.custom()).optional(),onUpgrade:L.z.function().args(L.z.any(),L.z.number(),L.z.number()).returns(L.z.void()).optional()});function F({flavour:e,props:t,metadata:i,onUpgrade:s,toModel:o,transformer:r}){let a={version:i.version,model:{role:i.role,parent:i.parent,children:i.children,flavour:e,props:t,toModel:o},onUpgrade:s,transformer:r};return R.parse(a),a}function N(){return class{}}let q=Symbol("model_label");class U extends N(){constructor(){super(),this._childModels=(0,S.EW)(()=>{let e=[];return this._children.value.map(t=>{let i=this.page.getBlock$(t);i&&e.push(i.model)}),e}),this._children=(0,S.vP)([]),this.childMap=(0,S.EW)(()=>this._children.value.reduce((e,t,i)=>(e.set(t,i),e),new Map)),this.created=new A.D,this.deleted=new A.D,this.isEmpty=(0,S.EW)(()=>0===this._children.value.length),this[s]="type_info_label",this.propsUpdated=new A.D,this._onCreated=this.created.once(()=>{this._children.value=this.yBlock.get("sys:children").toArray(),this.yBlock.get("sys:children").observe(e=>{this._children.value=e.target.toArray()}),this.yBlock.observe(e=>{e.keysChanged.has("sys:children")&&(this._children.value=this.yBlock.get("sys:children").toArray())})}),this._onDeleted=this.deleted.once(()=>{this._onCreated.dispose()})}[(s=q,Symbol.dispose)](){this._onCreated.dispose(),this._onDeleted.dispose()}dispose(){this.created.dispose(),this.deleted.dispose(),this.propsUpdated.dispose()}firstChild(){return this.children[0]||null}lastChild(){return this.children.length?this.children[this.children.length-1].lastChild():this}get children(){return this._childModels.value}get doc(){return this.page}set doc(e){this.page=e}}var W=i(56278);let G=e=>{if("string"!=typeof e)throw TypeError("invalid pattern");if(e.length>65536)throw TypeError("pattern is too long")},Y={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},K=e=>e.replace(/[[\]\\-]/g,"\\$&"),X=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Q=e=>e.join(""),J=(e,t)=>{if("["!==e.charAt(t))throw Error("not in a brace expression");let i=[],s=[],o=t+1,r=!1,a=!1,n=!1,l=!1,c=t,d="";e:for(;od?i.push(K(d)+"-"+K(h)):h===d&&i.push(K(h)),d="",o++;continue}if(e.startsWith("-]",o+1)){i.push(K(h+"-")),o+=2;continue}if(e.startsWith("-",o+1)){d=h,o+=2;continue}i.push(K(h)),o++}if(ct?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),et=new Set(["!","?","+","*","@"]),ei=e=>et.has(e),es="(?!\\.)",eo=new Set(["[","."]),er=new Set(["..","."]),ea=new Set("().*{}+?[]^$\\!"),en=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),el="[^/]",ec=el+"*?",ed=el+"+?";class eh{type;#eb;#ew;#ex=!1;#e_=[];#eC;#ek;#eS;#eM=!1;#eE;#eI;#eB=!1;constructor(e,t,i={}){this.type=e,e&&(this.#ew=!0),this.#eC=t,this.#eb=this.#eC?this.#eC.#eb:this,this.#eE=this.#eb===this?i:this.#eb.#eE,this.#eS=this.#eb===this?[]:this.#eb.#eS,"!"!==e||this.#eb.#eM||this.#eS.push(this),this.#ek=this.#eC?this.#eC.#e_.length:0}get hasMagic(){if(void 0!==this.#ew)return this.#ew;for(let e of this.#e_)if("string"!=typeof e&&(e.type||e.hasMagic))return this.#ew=!0;return this.#ew}toString(){return void 0!==this.#eI?this.#eI:this.type?this.#eI=this.type+"("+this.#e_.map(e=>String(e)).join("|")+")":this.#eI=this.#e_.map(e=>String(e)).join("")}#e$(){let e;if(this!==this.#eb)throw Error("should only call on root");if(this.#eM)return this;for(this.toString(),this.#eM=!0;e=this.#eS.pop();){if("!"!==e.type)continue;let t=e,i=t.#eC;for(;i;){for(let s=t.#ek+1;!i.type&&s"string"==typeof e?e:e.toJSON()):[this.type,...this.#e_.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#eb||this.#eb.#eM&&this.#eC?.type==="!")&&e.push({}),e}isStart(){if(this.#eb===this)return!0;if(!this.#eC?.isStart())return!1;if(0===this.#ek)return!0;let e=this.#eC;for(let t=0;t{let[s,o,r,a]="string"==typeof t?eh.#eO(t,this.#ew,i):t.toRegExpSource(e);return this.#ew=this.#ew||r,this.#ex=this.#ex||a,s}).join(""),o="";if(this.isStart()&&"string"==typeof this.#e_[0]&&!(1===this.#e_.length&&er.has(this.#e_[0]))){let i=t&&eo.has(s.charAt(0))||s.startsWith("\\.")&&eo.has(s.charAt(2))||s.startsWith("\\.\\.")&&eo.has(s.charAt(4)),r=!t&&!e&&eo.has(s.charAt(0));o=i?"(?!(?:^|/)\\.\\.?(?:$|/))":r?es:""}let r="";return this.isEnd()&&this.#eb.#eM&&this.#eC?.type==="!"&&(r="(?:$|\\/)"),[o+s+r,ee(s),this.#ew=!!this.#ew,this.#ex]}let i="*"===this.type||"+"===this.type,s="!"===this.type?"(?:(?!(?:":"(?:",o=this.#eP(t);if(this.isStart()&&this.isEnd()&&!o&&"!"!==this.type){let e=this.toString();return this.#e_=[e],this.type=null,this.#ew=void 0,[e,ee(this.toString()),!1,!1]}let r=!i||e||t||!es?"":this.#eP(!0);return r===o&&(r=""),r&&(o=`(?:${o})(?:${r})*?`),["!"===this.type&&this.#eB?(this.isStart()&&!t?es:"")+ed:s+o+("!"===this.type?"))"+(!this.isStart()||t||e?"":es)+ec+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&r?")":"*"===this.type&&r?")?":`)${this.type}`),ee(o),this.#ew=!!this.#ew,this.#ex]}#eP(e){return this.#e_.map(t=>{if("string"==typeof t)throw Error("string type in extglob ast??");let[i,s,o,r]=t.toRegExpSource(e);return this.#ex=this.#ex||r,i}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static #eO(e,t,i=!1){let s=!1,o="",r=!1;for(let a=0;a(G(t),(!!i.nocomment||"#"!==t.charAt(0))&&new ez(t,i).match(e)),ep=/^\*+([^+@!?\*\[\(]*)$/,ef=e=>t=>!t.startsWith(".")&&t.endsWith(e),eg=e=>t=>t.endsWith(e),em=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),ev=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),ey=/^\*+\.\*+$/,eb=e=>!e.startsWith(".")&&e.includes("."),ew=e=>"."!==e&&".."!==e&&e.includes("."),ex=/^\.\*+$/,e_=e=>"."!==e&&".."!==e&&e.startsWith("."),eC=/^\*+$/,ek=e=>0!==e.length&&!e.startsWith("."),eS=e=>0!==e.length&&"."!==e&&".."!==e,eM=/^\?+([^+@!?\*\[\(]*)?$/,eE=([e,t=""])=>{let i=eT([e]);return t?(t=t.toLowerCase(),e=>i(e)&&e.toLowerCase().endsWith(t)):i},eI=([e,t=""])=>{let i=eO([e]);return t?(t=t.toLowerCase(),e=>i(e)&&e.toLowerCase().endsWith(t)):i},eB=([e,t=""])=>{let i=eO([e]);return t?e=>i(e)&&e.endsWith(t):i},e$=([e,t=""])=>{let i=eT([e]);return t?e=>i(e)&&e.endsWith(t):i},eT=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(".")},eO=([e])=>{let t=e.length;return e=>e.length===t&&"."!==e&&".."!==e},eP="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",eH={win32:{sep:"\\"},posix:{sep:"/"}},eA="win32"===eP?eH.win32.sep:eH.posix.sep;eu.sep=eA;let eL=Symbol("globstar **");eu.GLOBSTAR=eL,eu.filter=(e,t={})=>i=>eu(i,e,t);let eD=(e,t={})=>Object.assign({},e,t);eu.defaults=e=>{if(!e||"object"!=typeof e||!Object.keys(e).length)return eu;let t=eu;return Object.assign((i,s,o={})=>t(i,s,eD(e,o)),{Minimatch:class extends t.Minimatch{constructor(t,i={}){super(t,eD(e,i))}static defaults(i){return t.defaults(eD(e,i)).Minimatch}},AST:class extends t.AST{constructor(t,i,s={}){super(t,i,eD(e,s))}static fromGlob(i,s={}){return t.AST.fromGlob(i,eD(e,s))}},unescape:(i,s={})=>t.unescape(i,eD(e,s)),escape:(i,s={})=>t.escape(i,eD(e,s)),filter:(i,s={})=>t.filter(i,eD(e,s)),defaults:i=>t.defaults(eD(e,i)),makeRe:(i,s={})=>t.makeRe(i,eD(e,s)),braceExpand:(i,s={})=>t.braceExpand(i,eD(e,s)),match:(i,s,o={})=>t.match(i,s,eD(e,o)),sep:t.sep,GLOBSTAR:eL})};let eZ=(e,t={})=>(G(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e))?[e]:W(e);eu.braceExpand=eZ,eu.makeRe=(e,t={})=>new ez(e,t).makeRe(),eu.match=(e,t,i={})=>{let s=new ez(t,i);return e=e.filter(e=>s.match(e)),s.options.nonull&&!e.length&&e.push(t),e};let ej=/[?*]|[+@!]\(.*?\)|\[|\]/,eV=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class ez{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){G(e),t=t||{},this.options=t,this.pattern=e,this.platform=t.platform||eP,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||!1===t.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==t.windowsNoMagicRoot?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if("string"!=typeof t)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0)){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let i=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(i),this.debug(this.pattern,this.globParts);let s=this.globParts.map((e,t,i)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=""===e[0]&&""===e[1]&&("?"===e[2]||!ej.test(e[2]))&&!ej.test(e[3]),i=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(i)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,s),this.set=s.filter(e=>-1===e.indexOf(!1)),this.isWindows)for(let e=0;e=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;-1!==(t=e.indexOf("**",t+1));){let i=t;for(;"**"===e[i+1];)i++;i!==t&&e.splice(t,i-t)}return e})}levelOneOptimize(e){return e.map(e=>0===(e=e.reduce((e,t)=>{let i=e[e.length-1];return"**"===t&&"**"===i||(".."===t&&i&&".."!==i&&"."!==i&&"**"!==i?e.pop():e.push(t)),e},[])).length?[""]:e)}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let i=1;is&&i.splice(s+1,o-s);let r=i[s+1],a=i[s+2],n=i[s+3];if(".."!==r||!a||"."===a||".."===a||!n||"."===n||".."===n)continue;t=!0,i.splice(s,1);let l=i.slice(0);l[s]="**",e.push(l),s--}if(!this.preserveMultipleSlashes){for(let e=1;ee.length)}partsMatch(e,t,i=!1){let s=0,o=0,r=[],a="";for(;sa?t=t.slice(n):a>n&&(e=e.slice(a)))}}let{optimizationLevel:o=1}=this.options;o>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var r=0,a=0,n=e.length,l=t.length;r>> no match, partial?",e,h,t,u),h===n))return!0;return!1}if("string"==typeof c?(o=d===c,this.debug("string match",c,d,o)):(o=c.test(d),this.debug("pattern match",c,d,o)),!o)return!1}if(r===n&&a===l)return!0;if(r===n)return i;if(a===l)return r===n-1&&""===e[r];throw Error("wtf?")}braceExpand(){return eZ(this.pattern,this.options)}parse(e){let t;G(e);let i=this.options;if("**"===e)return eL;if(""===e)return"";let s=null;(t=e.match(eC))?s=i.dot?eS:ek:(t=e.match(ep))?s=(i.nocase?i.dot?ev:em:i.dot?eg:ef)(t[1]):(t=e.match(eM))?s=(i.nocase?i.dot?eI:eE:i.dot?eB:e$)(t):(t=e.match(ey))?s=i.dot?ew:eb:(t=e.match(ex))&&(s=e_);let o=eh.fromGlob(e,this.options).toMMPattern();return s&&"object"==typeof o&&Reflect.defineProperty(o,"test",{value:s}),o}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,i=t.noglobstar?"[^/]*?":t.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",s=new Set(t.nocase?["i"]:[]),o=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(""))s.add(t);return"string"==typeof e?eV(e):e===eL?eL:e._src});return t.forEach((e,s)=>{let o=t[s+1],r=t[s-1];e===eL&&r!==eL&&(void 0===r?void 0!==o&&o!==eL?t[s+1]="(?:\\/|"+i+"\\/)?"+o:t[s]=i:void 0===o?t[s-1]=r+"(?:\\/|"+i+")?":o!==eL&&(t[s-1]=r+"(?:\\/|\\/"+i+"\\/)"+o,t[s+1]=eL))}),t.filter(e=>e!==eL).join("/")}).join("|"),[r,a]=e.length>1?["(?:",")"]:["",""];o="^"+r+o+a+"$",this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...s].join(""))}catch(e){this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;let i=this.options;this.isWindows&&(e=e.split("\\").join("/"));let s=this.slashSplit(e);this.debug(this.pattern,"split",s);let o=this.set;this.debug(this.pattern,"set",o);let r=s[s.length-1];if(!r)for(let e=s.length-2;!r&&e>=0;e--)r=s[e];for(let e=0;et?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),eu.unescape=ee;var eR=i(40901);!function(e){e.Bypass="bypass",e.Display="display",e.Hidden="hidden"}(o||(o={}));class eF{constructor({schema:e,blockCollection:t,crud:i,readonly:s,query:r}){this._blocks=(0,S.vP)({}),this._query={match:[],mode:"loose"},this._runQuery=e=>{!function(e,t){let i=function(e,t){let i=t.model.flavour,s=t.model.id,r=e.mode,a=t.model.keys.reduce((e,i)=>({...e,[i]:t.model[i]}),{}),n="loose"===r?o.Display:o.Hidden;return e.match.some(e=>{let{id:t,flavour:o,props:r,viewType:l}=e,c=null==r||eR(a,r);return(null==t||t===s)&&(null==o||o===i)&&!!c&&(n=l,!0)}),n}(e,t);t.blockViewType=i,i!==o.Hidden&&function(e,t){let i=t.model.doc,s=i.getParent(t.model);for(;s;){let t=i.getBlock(s.id);t&&t.blockViewType===o.Hidden&&(t.blockViewType="include"===e?o.Display:o.Bypass),s=i.getParent(s)}}(e.mode,t)}(this._query,e)},this._blockCollection=t,this.slots={ready:new A.D,rootAdded:new A.D,rootDeleted:new A.D,blockUpdated:new A.D,historyUpdated:this._blockCollection.slots.historyUpdated,yBlockUpdated:this._blockCollection.slots.yBlockUpdated},this._crud=i,this._schema=e,this._readonly=s,r&&(this._query=r),this._yBlocks.forEach((e,t)=>{t in this._blocks.peek()||this._onBlockAdded(t,!0)}),this._disposeBlockUpdated=this._blockCollection.slots.yBlockUpdated.on(({type:e,id:t})=>{switch(e){case"add":this._onBlockAdded(t);return;case"delete":this._onBlockRemoved(t);return}})}_getSiblings(e,t){let i=this.getParent(e);if(!i)return null;let s="string"==typeof e?this.getBlock(e)?.model:e;if(!s)return null;let o=i.children.indexOf(s);return -1===o?null:t(i,o)}_onBlockAdded(e,t=!1){try{if(e in this._blocks.peek())return;let i=this._yBlocks.get(e);if(!i){console.warn(`Could not find block with id ${e}`);return}let s=new eU(this._schema,i,this,{onChange:(t,i)=>{i&&t.model.propsUpdated.emit({key:i}),this.slots.blockUpdated.emit({type:"update",id:e,flavour:t.flavour,props:{key:i}})}});this._runQuery(s),this._blocks.value={...this._blocks.value,[e]:s},s.model.created.emit(),"root"===s.model.role&&this.slots.rootAdded.emit(e),this.slots.blockUpdated.emit({type:"add",id:e,init:t,flavour:s.model.flavour,model:s.model})}catch(e){console.error("An error occurred while adding block:"),console.error(e)}}_onBlockRemoved(e){try{let t=this.getBlock(e);if(!t)return;"root"===t.model.role&&this.slots.rootDeleted.emit(e),this.slots.blockUpdated.emit({type:"delete",id:e,flavour:t.model.flavour,parent:this.getParent(t.model)?.id??"",model:t.model});let{[e]:i,...s}=this._blocks.peek();this._blocks.value=s,t.model.deleted.emit(),t.model.dispose()}catch(e){console.error("An error occurred while removing block:"),console.error(e)}}get _yBlocks(){return this._blockCollection.yBlocks}addBlock(e,t={},i,s){if(this.readonly)throw new l.Ss(c.O.ModelCRUDError,"cannot modify data in readonly mode");let o=t.id??this._blockCollection.generateBlockId();return this.transact(()=>{this._crud.addBlock(o,e,{...t},"string"==typeof i?i:i?.id,s)}),o}addBlocks(e,t,i){let s=[];return e.forEach(e=>{let o=this.addBlock(e.flavour,e.blockProps??{},t,i);s.push(o),"number"==typeof i&&i++}),s}addSiblingBlocks(e,t,i="after"){if(!t.length)return[];let s=this.getParent(e);if(!s)return[];let o=s.children.findIndex(({id:t})=>t===e.id)??0,r="before"===i?o:o+1;if(t.length<=1){if(!t[0]?.flavour)return[];let{flavour:e,...i}=t[0];return[this.addBlock(e,i,s.id,r)]}let a=[];return t.forEach(e=>{let{flavour:t,...i}=e;t&&a.push({flavour:t,blockProps:i})}),this.addBlocks(a,s.id,r)}deleteBlock(e,t={deleteChildren:!0}){if(this.readonly){console.error("cannot modify data in readonly mode");return}let i=t&&t.bringChildrenTo?{...t,bringChildrenTo:t.bringChildrenTo.id}:t;this.transact(()=>{this._crud.deleteBlock(e.id,i)})}dispose(){this._disposeBlockUpdated.dispose(),this.slots.ready.dispose(),this.slots.blockUpdated.dispose(),this.slots.rootAdded.dispose(),this.slots.rootDeleted.dispose()}getBlock(e){return this._blocks.peek()[e]}getBlock$(e){return this._blocks.value[e]}getBlockByFlavour(e){return this.getBlocksByFlavour(e).map(e=>e.model)}getBlockById(e){return this.getBlock(e)?.model??null}getBlocks(){return Object.values(this._blocks.peek()).map(e=>e.model)}getBlocksByFlavour(e){let t="string"==typeof e?[e]:e;return Object.values(this._blocks.peek()).filter(({flavour:e})=>t.includes(e))}getNext(e){return this._getSiblings(e,(e,t)=>e.children[t+1]??null)}getNexts(e){return this._getSiblings(e,(e,t)=>e.children.slice(t+1))??[]}getParent(e){let t="string"==typeof e?e:e.id,i=this._crud.getParent(t);if(!i)return null;let s=this._blocks.peek()[i];return s?s.model:null}getPrev(e){return this._getSiblings(e,(e,t)=>e.children[t-1]??null)}getPrevs(e){return this._getSiblings(e,(e,t)=>e.children.slice(0,t))??[]}getSchemaByFlavour(e){return this._schema.flavourSchemaMap.get(e)}hasBlock(e){return e in this._blocks.peek()}hasBlockById(e){return this.hasBlock(e)}load(e){return this._blockCollection.load(e),this.slots.ready.emit(),this}moveBlocks(e,t,i=null,s=!0){if(this.readonly){console.error("Cannot modify data in read-only mode");return}this.transact(()=>{this._crud.moveBlocks(e.map(e=>e.id),t.id,i?.id??null,s)})}updateBlock(e,t){if(this.readonly){console.error("cannot modify data in readonly mode");return}let i="function"==typeof t;if(!i){let i=this.getParent(e);this.schema.validate(e.flavour,i?.flavour,t.children?.map(e=>e.flavour))}let s=this._yBlocks.get(e.id);if(!s)throw new l.Ss(c.O.ModelCRUDError,`updating block: ${e.id} not found`);let o=this.getBlock(e.id);this.transact(()=>{if(i){t(),this._runQuery(o);return}t.children&&this._crud.updateBlockChildren(e.id,t.children.map(e=>e.id));let r=this.schema.flavourSchemaMap.get(e.flavour);if(!r)throw new l.Ss(c.O.ModelCRUDError,`schema for flavour: ${e.flavour} not found`);!function(e,t,i,s){let o=e.model.props?.(z)??{};Object.entries(s).forEach(([e,i])=>{C.has(e)||void 0===i||(t[e]=i)}),Object.entries(o).forEach(([e,s])=>{i.has(`prop:${e}`)&&void 0!==i.get(`prop:${e}`)||(t[e]=I(s))})}(r,e,s,t),this._runQuery(o)})}get Text(){return this._blockCollection.Text}get awarenessStore(){return this._blockCollection.awarenessStore}get awarenessSync(){return this.collection.awarenessSync}get blobSync(){return this.collection.blobSync}get blockCollection(){return this._blockCollection}get blockSize(){return Object.values(this._blocks.peek()).length}get blocks(){return this._blocks}get canRedo(){return this._blockCollection.canRedo}get canUndo(){return this._blockCollection.canUndo}get captureSync(){return this._blockCollection.captureSync.bind(this._blockCollection)}get clear(){return this._blockCollection.clear.bind(this._blockCollection)}get collection(){return this._blockCollection.collection}get docSync(){return this.collection.docSync}get generateBlockId(){return this._blockCollection.generateBlockId.bind(this._blockCollection)}get history(){return this._blockCollection.history}get id(){return this._blockCollection.id}get isEmpty(){return 0===Object.values(this._blocks.peek()).length}get loaded(){return this._blockCollection.loaded}get meta(){return this._blockCollection.meta}get readonly(){return!!this._blockCollection.readonly||!0===this._readonly}get ready(){return this._blockCollection.ready}get redo(){return this._blockCollection.redo.bind(this._blockCollection)}get resetHistory(){return this._blockCollection.resetHistory.bind(this._blockCollection)}get root(){let e=this._crud.root;return e?this.getBlock(e)?.model??null:null}get rootDoc(){return this._blockCollection.rootDoc}get schema(){return this._schema}get spaceDoc(){return this._blockCollection.spaceDoc}get transact(){return this._blockCollection.transact.bind(this._blockCollection)}get undo(){return this._blockCollection.undo.bind(this._blockCollection)}get withoutTransact(){return this._blockCollection.withoutTransact.bind(this._blockCollection)}}var eN=i(41149);class eq{constructor(e,t,i,s){this.schema=e,this.yBlock=t,this.doc=i,this.onChange=s,this._byPassProxy=!1,this._byPassUpdate=e=>{this._byPassProxy=!0,e(),this._byPassProxy=!1},this._mutex=(0,eN.i)(),this._observeYBlockChanges=()=>{this.yBlock.observe(e=>{e.keysChanged.forEach(t=>{let i=e.changes.keys.get(t);if(i){if("update"===i.action||"add"===i.action){let e=this.yBlock.get(t),i=t.replace("prop:",""),s=this._getPropsProxy(i,e);this._byPassUpdate(()=>{this.model[i]=s;let t=`${i}$`;this._mutex(()=>{t in this.model&&(this.model[t].value=B(e))})}),this.onChange?.(i,e);return}if("delete"===i.action){let e=t.replace("prop:","");this._byPassUpdate(()=>{delete this.model[e],`${e}$` in this.model&&(this.model[`${e}$`].value=void 0)}),this.onChange?.(e,void 0);return}}})})},this._stashed=new Set,this.pop=e=>{this._stashed.has(e)&&this._popProp(e)},this.stash=e=>{this._stashed.has(e)||(this._stashed.add(e),this._stashProp(e))};let{id:o,flavour:r,version:a,yChildren:n,props:l}=this._parseYBlock();this.id=o,this.flavour=r,this.yChildren=n,this.version=a,this.model=this._createModel(l),this._observeYBlockChanges()}_createModel(e){let t=this._mutex,i=this.schema.flavourSchemaMap.get(this.flavour);if(!i)throw new l.Ss(c.O.ModelCRUDError,`schema for flavour: ${this.flavour} not found`);let s=i.model.toModel?.()??new U,o=Object.entries(e).reduce((e,[i,o])=>{let r=(0,S.vP)(o),a=(0,S.QZ)(()=>{let e=r.value;this.model&&t(()=>{this.model[i]=e})});return s.deleted.once(a),{...e,[`${i}$`]:r,[i]:o}},{});function r(e,i,s){t(()=>{e[`${i}$`].value=s})}return Object.assign(s,o),s.id=this.id,s.version=this.version,s.keys=Object.keys(e),s.flavour=i.model.flavour,s.role=i.model.role,s.yBlock=this.yBlock,s.stash=this.stash,s.pop=this.pop,this.doc&&(s.doc=this.doc),new Proxy(s,{has:(e,t)=>Reflect.has(e,t),set:(e,t,i,o)=>{if(!this._byPassProxy&&"string"==typeof t&&s.keys.includes(t)){if(this._stashed.has(t)){r(e,t,i);let s=Reflect.set(e,t,i,o);return this.onChange?.(t,i),s}let s=I(i);this.yBlock.set(`prop:${t}`,s);let a=this._getPropsProxy(t,s);return r(e,t,i),Reflect.set(e,t,a,o)}return Reflect.set(e,t,i,o)},get:(e,t,i)=>Reflect.get(e,t,i),deleteProperty:(e,t)=>(!this._byPassProxy&&"string"==typeof t&&s.keys.includes(t)&&(this.yBlock.delete(`prop:${t}`),r(e,t,void 0)),Reflect.deleteProperty(e,t))})}_getPropsProxy(e,t){return H(t,{onChange:()=>{this.onChange?.(e,t);let i=`${e}$`;i in this.model&&this._mutex(()=>{this.model[i].value=this.model[e]})}})}_parseYBlock(){let e,t,i,s;let o={};if(this.yBlock.forEach((r,a)=>{if(a.startsWith("prop:")){let e=a.replace("prop:","");o[e]=this._getPropsProxy(e,r);return}if("sys:id"===a&&"string"==typeof r){e=r;return}if("sys:flavour"===a&&"string"==typeof r){t=r;return}if("sys:children"===a&&r instanceof y.Array){s=r;return}if("sys:version"===a&&"number"==typeof r){i=r;return}}),!e)throw new l.Ss(c.O.ModelCRUDError,"block id is not found when creating model");if(!t)throw new l.Ss(c.O.ModelCRUDError,"block flavour is not found when creating model");if(!s)throw new l.Ss(c.O.ModelCRUDError,"block children is not found when creating model");let r=this.schema.flavourSchemaMap.get(t);if(!r)throw new l.Ss(c.O.ModelCRUDError,`schema for flavour: ${t} not found`);let a=r.model.props?.(z);return"number"!=typeof i&&(i=r.version),a&&Object.entries(a).forEach(([e,t])=>{if(e in o)return;let i=I(t);this.yBlock.set(`prop:${e}`,i),o[e]=this._getPropsProxy(e,i)}),{id:e,flavour:t,version:i,props:o,yChildren:s}}_popProp(e){let t=this.model,i=t[e];this._stashed.delete(e),t[e]=i}_stashProp(e){this.model[e]=B(this.yBlock.get(`prop:${e}`),{transform:(t,i)=>k.is(i)?t:i instanceof y.Map?new Proxy(t,{get:(e,t,i)=>Reflect.get(e,t,i),set:(t,i,s,o)=>{let r=Reflect.set(t,i,s,o);return this.onChange?.(e,s),r},deleteProperty:(t,i)=>{let s=Reflect.deleteProperty(t,i);return this.onChange?.(e,void 0),s}}):i instanceof y.Array?new Proxy(t,{get:(e,t,i)=>Reflect.get(e,t,i),set:(t,i,s,o)=>{if(Number.isNaN(Number(i)))return Reflect.set(t,i,s,o);let r=Reflect.set(t,i,s,o);return this.onChange?.(e,s),r},deleteProperty:(e,t)=>{let i=Reflect.deleteProperty(e,t);return this.onChange?.(t,void 0),i}}):t})}}class eU{constructor(e,t,i,s={}){this.schema=e,this.yBlock=t,this.doc=i,this.options=s,this.blockViewType=o.Display;let r=s.onChange?(e,t)=>{s.onChange?.(this,e,t)}:void 0;this._syncController=new eq(e,t,i,r)}get flavour(){return this._syncController.flavour}get id(){return this._syncController.id}get model(){return this._syncController.model}get pop(){return this._syncController.pop}get stash(){return this._syncController.stash}get version(){return this._syncController.version}}class eW extends l.Ss{constructor(e){super(c.O.MigrationError,`Migration failed. Please report to https://github.com/toeverything/blocksuite/issues ${e}`)}}class eG extends l.Ss{constructor(e,t){super(c.O.SchemaValidateError,`Invalid schema for ${e}: ${t}`)}}class eY{constructor(){this._upgradeBlockVersions=e=>{let t=e.getMap("meta").get("blockVersions");t&&t.forEach((e,i)=>{let s=this.flavourSchemaMap.get(i);s&&e!==s.version&&t.set(i,s.version)})},this.flavourSchemaMap=new Map,this.upgradeBlock=(e,t,i)=>{try{let s=this.flavourSchemaMap.get(e);if(!s)throw new eW(`schema for flavour: ${e} not found`);let{onUpgrade:o,version:r}=s;if(!o)return;let a=new eU(this,i);return o(a.model,t,r)}catch(t){throw new eW(`upgrade block ${e} failed. ${t}`)}},this.upgradeCollection=e=>{this._upgradeBlockVersions(e),v.forEach(t=>{try{t.condition(e)&&t.migrate(e)}catch(e){throw console.error(e),new eW(t.desc)}})},this.upgradeDoc=(e,t,i)=>{Array.from(i.getMap("blocks").values()).forEach(e=>{let i=e.get("sys:flavour"),s=e.get("sys:version")??t[i]??0;if(null==s)throw new eW(`version for flavour ${i} not found in block`);this.upgradeBlock(i,s,e)}),b.forEach(t=>{try{t.condition(e,i)&&t.migrate(e,i)}catch(e){throw new eW(`${t.desc} ${e}`)}})},this.validate=(e,t,i)=>{let s=this.flavourSchemaMap.get(e);if(!s)throw new eG(e,w);let o=()=>{i?.forEach(e=>{let t=this.flavourSchemaMap.get(e);if(!t)throw new eG(e,w);this.validateSchema(t,s)})};if("root"===s.model.role){if(t)throw new eG(s.model.flavour,"Root block cannot have parent.");o();return}if(!t)throw new eG(s.model.flavour,"Hub/Content must have parent.");let r=this.flavourSchemaMap.get(t);if(!r)throw new eG(t,w);this.validateSchema(s,r),o()}}_matchFlavour(e,t){return eu(e,t)||eu(t,e)}_validateParent(e,t){let i=e.model.flavour,s=t.model.flavour,o=e.model.parent||["*"];return(t.model.children||["*"]).some(e=>o.some(t=>"*"===e&&"*"===t||("*"===e?this._matchFlavour(t,s):"*"===t?this._matchFlavour(i,e):this._matchFlavour(i,e)&&this._matchFlavour(t,s))))}_validateRole(e,t){let i=e.model.role,s=t.model.role,o=e.model.flavour,r=t.model.flavour;if("root"===i)throw new eG(o,`Root block cannot have parent: ${r}.`);if("hub"===i&&"content"===s)throw new eG(o,`Hub block cannot be child of content block: ${r}.`);if("content"===i&&"root"===s)throw new eG(o,`Content block can only be child of hub block or itself. But get: ${r}.`)}register(e){return e.forEach(e=>{R.parse(e),this.flavourSchemaMap.set(e.model.flavour,e)}),this}toJSON(){return Object.fromEntries(Array.from(this.flavourSchemaMap.values()).map(e=>[e.model.flavour,{role:e.model.role,parent:e.model.parent,children:e.model.children}]))}validateSchema(e,t){if(this._validateRole(e,t),!this._validateParent(e,t))throw new eG(e.model.flavour,`Block cannot have parent: ${t.model.flavour}.`)}get versions(){return Object.fromEntries(Array.from(this.flavourSchemaMap.values()).map(e=>[e.model.flavour,e.version]))}}class eK{debug(){}error(){}info(){}warn(){}}class eX{constructor(e,t){this.awareness=e,this.sources=t}connect(){this.sources.forEach(e=>e.connect(this.awareness))}disconnect(){this.sources.forEach(e=>e.disconnect())}}var eQ=i(61382),eJ=i(96509);class e1{constructor(e,t,i){this.main=e,this.shadows=t,this.logger=i,this._abort=null}async delete(e){this.logger.error("You are trying to delete a blob. We do not support this feature yet. We need to wait until we implement the indexer, which will inform us which doc is using a particular blob so that we can safely delete it.")}async get(e){for(let t of(this.logger.debug("get blob",e),this.sources)){let i=await t.get(e);if(i)return i}return null}async list(){let e=new Set;for(let t of this.sources)for(let i of(await t.list()))e.add(i);return Array.from(e)}async set(e,t){if(this.main.readonly)throw Error("main peer is readonly");let i="string"==typeof e?e:await (0,eJ.h)(await e.arrayBuffer()),s="string"==typeof e?t:e;if(!s)throw Error("value is empty");return await this.main.set(i,s),Promise.allSettled(this.shadows.filter(e=>!e.readonly).map(e=>e.set(i,s).catch(e=>{this.logger.error("Error when uploading to peer",e)}))).then(e=>{e.some(({status:e})=>"rejected"===e)?this.logger.error(`blob ${i} update finish, but some peers failed to update`):this.logger.debug(`blob ${i} update finish`)}).catch(()=>{}),i}start(){if(this._abort)return;this._abort=new AbortController;let e=this._abort.signal,t=()=>{e.aborted||this.sync().catch(e=>{this.logger.error("sync blob error",e)}).finally(()=>{setTimeout(t,6e4)})};t()}stop(){this._abort?.abort(),this._abort=null}async sync(){if(!this.main.readonly){for(let e of(this.logger.debug("start syncing blob..."),this.shadows)){let t=[],i=[];if(!e.readonly){try{t=await this.main.list(),i=await e.list()}catch(e){this.logger.error("error when sync",e);continue}for(let s of t.filter(e=>!i.includes(e)))try{let t=await this.main.get(s);t?await e.set(s,t):this.logger.error("data not found when trying upload from main to shadow")}catch(t){this.logger.error(`error when sync ${s} from [${this.main.name}] to [${e.name}]`,t)}}for(let s of i.filter(e=>!t.includes(e)))try{let t=await e.get(s);t?await this.main.set(s,t):this.logger.error("data not found when trying download from shadow to main")}catch(t){this.logger.error(`error when sync ${s} from [${e.name}] to [${this.main.name}]`,t)}}this.logger.debug("finish syncing blob")}}get sources(){return[this.main,...this.shadows]}}class e0{constructor(){this.map=new Map,this.name="memory",this.readonly=!1}delete(e){return this.map.delete(e),Promise.resolve()}get(e){return Promise.resolve(this.map.get(e)??null)}list(){return Promise.resolve(Array.from(this.map.keys()))}set(e,t){return this.map.set(e,t),Promise.resolve(e)}}!function(e){e[e.Stopped=0]="Stopped",e[e.Synced=2]="Synced",e[e.Syncing=1]="Syncing"}(r||(r={})),function(e){e[e.Loaded=4.5]="Loaded",e[e.LoadingRootDoc=2]="LoadingRootDoc",e[e.LoadingSubDoc=3]="LoadingSubDoc",e[e.Retrying=1]="Retrying",e[e.Stopped=0]="Stopped",e[e.Synced=6]="Synced",e[e.Syncing=5]="Syncing"}(a||(a={}));class e2{constructor(e=[]){this._resolveUpdate=null,this._waitForUpdate=null,this._queue=e}clear(){this._queue=[]}find(e){return this._queue.find(e)}async next(e,t=e=>e.shift()){return t(this._queue)||(this._waitForUpdate||(this._waitForUpdate=new Promise(e=>{this._resolveUpdate=e})),await Promise.race([this._waitForUpdate,new Promise((t,i)=>{e?.aborted&&i(e?.reason),e?.addEventListener("abort",()=>{i(e.reason)})})]),this.next(e,t))}push(...e){if(this._queue.push(...e),this._resolveUpdate){let e=this._resolveUpdate;this._resolveUpdate=null,this._waitForUpdate=null,e()}}remove(e){let t=this._queue.findIndex(e);-1!==t&&this._queue.splice(t,1)}get length(){return this._queue.length}}class e5 extends e2{constructor(e=[],t=new e7){super(e),this.priorityTarget=t}next(e){return super.next(e,e=>{if(null!==this.priorityTarget.priorityRule){let t=e.findIndex(e=>this.priorityTarget.priorityRule?.(e.id));if(-1!==t)return e.splice(t,1)[0]}return e.shift()})}}class e7{constructor(){this.priorityRule=null}}function e3(e){if(e?.aborted)throw Error(e.reason);return!0}let e4="manually-stop";class e6{constructor(e,t,i=new e7,s){this.rootDoc=e,this.source=t,this.priorityTarget=i,this.logger=s,this._status={step:a.LoadingRootDoc,totalDocs:1,loadedDocs:0,pendingPullUpdates:0,pendingPushUpdates:0},this.abort=new AbortController,this.handleStorageUpdates=(e,t)=>{this.state.pullUpdatesQueue.push({id:e,data:t}),this.updateSyncStatus()},this.handleSubdocsUpdate=({added:e,removed:t})=>{for(let t of e)this.state.subdocsLoadQueue.push({id:t.guid,doc:t});for(let e of t)this.disconnectDoc(e),this.state.subdocsLoadQueue.remove(t=>t.doc===e);this.updateSyncStatus()},this.handleYDocUpdates=(e,t,i)=>{if(t===this.name)return;let s=this.state.pushUpdatesQueue.find(({id:e})=>e===i.guid);s?s.data.push(e):this.state.pushUpdatesQueue.push({id:i.guid,data:[e]}),this.updateSyncStatus()},this.onStatusChange=new A.D,this.state={connectedDocs:new Map,pushUpdatesQueue:new e5([],this.priorityTarget),pushingUpdate:!1,pullUpdatesQueue:new e5([],this.priorityTarget),subdocLoading:!1,subdocsLoadQueue:new e5([],this.priorityTarget)},this.logger.debug(`doc-peer:${this.name} start`),this.syncRetryLoop(this.abort.signal).catch(e=>{console.error(e)})}set status(e){(0,p.n4)(e,this._status)||(this.logger.debug(`doc-peer:${this.name} status change`,e),this._status=e,this.onStatusChange.emit(e))}async connectDoc(e,t){let{data:i,state:s}=await this.source.pull(e.guid,(0,y.encodeStateVector)(e))??{};e3(t),i&&i.length>0&&(0,y.applyUpdate)(e,i,"load"),this.state.pushUpdatesQueue.push({id:e.guid,data:[(0,y.encodeStateAsUpdate)(e,s)]}),this.state.connectedDocs.set(e.guid,e),e.on("update",this.handleYDocUpdates),e.emit("sync",[!0,e]),this.updateSyncStatus()}disconnectDoc(e){e.off("update",this.handleYDocUpdates),this.state.connectedDocs.delete(e.guid),this.updateSyncStatus()}initState(){this.state.connectedDocs.clear(),this.state.pushUpdatesQueue.clear(),this.state.pullUpdatesQueue.clear(),this.state.subdocsLoadQueue.clear(),this.state.pushingUpdate=!1,this.state.subdocLoading=!1}stop(){this.logger.debug(`doc-peer:${this.name} stop`),this.abort.abort(e4)}async sync(e){this.initState();let t=new AbortController;e.addEventListener("abort",e=>{t.abort(e)});let i=null;try{this.updateSyncStatus(),i=await this.source.subscribe(this.handleStorageUpdates,e=>{t.abort("subscribe disconnect:"+e)}),e3(t.signal),await this.connectDoc(this.rootDoc,t.signal),this.state.subdocsLoadQueue.push(...Array.from(this.rootDoc.getSubdocs()).map(e=>({id:e.guid,doc:e}))),this.updateSyncStatus(),this.rootDoc.on("subdocs",this.handleSubdocsUpdate),await Promise.all([(async()=>{for(;e3(t.signal);){let e=await this.state.subdocsLoadQueue.next(t.signal);this.state.subdocLoading=!0,this.updateSyncStatus(),await this.connectDoc(e.doc,t.signal),this.state.subdocLoading=!1,this.updateSyncStatus()}})(),(async()=>{for(;e3(t.signal);){let{id:e,data:i}=await this.state.pullUpdatesQueue.next(t.signal);if(!(0===i.byteLength||2===i.byteLength&&0===i[0]&&0===i[1])){let t=this.state.connectedDocs.get(e);t&&(0,y.applyUpdate)(t,i,this.name)}this.updateSyncStatus()}})(),(async()=>{for(;e3(t.signal);){let{id:e,data:i}=await this.state.pushUpdatesQueue.next(t.signal);this.state.pushingUpdate=!0,this.updateSyncStatus();let s=(0,y.mergeUpdates)(i);0===s.byteLength||2===s.byteLength&&0===s[0]&&0===s[1]||await this.source.push(e,s),this.state.pushingUpdate=!1,this.updateSyncStatus()}})()])}finally{for(let e of(i?.(),this.state.connectedDocs.values()))this.disconnectDoc(e);this.rootDoc.off("subdocs",this.handleSubdocsUpdate)}}async syncRetryLoop(e){for(;!1===e.aborted;){try{await this.sync(e)}catch(t){if(t===e4||e.aborted)return;this.logger.error(`doc-peer:${this.name} sync error`,t)}try{this.logger.error(`doc-peer:${this.name} retry after 5 seconds`),this.status={step:a.Retrying,totalDocs:1,loadedDocs:0,pendingPullUpdates:0,pendingPushUpdates:0},await Promise.race([new Promise(e=>{setTimeout(e,5e3)}),new Promise((t,i)=>{e.aborted&&i(e.reason),e.addEventListener("abort",()=>{i(e.reason)})})])}catch(t){if(t===e4||e.aborted)return;throw t}}}updateSyncStatus(){let e;e=0===this.state.connectedDocs.size?a.LoadingRootDoc:this.state.subdocsLoadQueue.length||this.state.subdocLoading?a.LoadingSubDoc:this.state.pullUpdatesQueue.length||this.state.pushUpdatesQueue.length||this.state.pushingUpdate?a.Syncing:a.Synced,this.status={step:e,totalDocs:this.state.connectedDocs.size+this.state.subdocsLoadQueue.length,loadedDocs:this.state.connectedDocs.size,pendingPullUpdates:this.state.pullUpdatesQueue.length+(this.state.subdocLoading?1:0),pendingPushUpdates:this.state.pushUpdatesQueue.length+(this.state.pushingUpdate?1:0)}}async waitForLoaded(e){if(!(this.status.step>a.Loaded))return Promise.race([new Promise(e=>{this.onStatusChange.on(t=>{t.step>a.Loaded&&e()})}),new Promise((t,i)=>{e?.aborted&&i(e?.reason),e?.addEventListener("abort",()=>{i(e.reason)})})])}async waitForSynced(e){if(!(this.status.step>=a.Synced))return Promise.race([new Promise(e=>{this.onStatusChange.on(t=>{t.step>=a.Synced&&e()})}),new Promise((t,i)=>{e?.aborted&&i(e?.reason),e?.addEventListener("abort",()=>{i(e.reason)})})])}get name(){return this.source.name}get status(){return this._status}}class e8{constructor(e,t,i,s){this.rootDoc=e,this.main=t,this.shadows=i,this.logger=s,this._abort=new AbortController,this.onStatusChange=new A.D,this.priorityTarget=new e7,this._status={step:r.Stopped,main:null,shadows:i.map(()=>null),retrying:!1},this.logger.debug(`syne-engine:${this.rootDocId} status init`,this.status)}setStatus(e){this.logger.debug(`syne-engine:${this.rootDocId} status change`,e),this._status=e,this.onStatusChange.emit(e)}canGracefulStop(){return!!this.status.main&&0===this.status.main.pendingPushUpdates}forceStop(){this._abort.abort(e4),this.setStatus({step:r.Stopped,main:null,shadows:this.shadows.map(()=>null),retrying:!1})}setPriorityRule(e){this.priorityTarget.priorityRule=e}start(){this.status.step!==r.Stopped&&this.forceStop(),this._abort=new AbortController,this.sync(this._abort.signal).catch(e=>{this.logger.error(`syne-engine:${this.rootDocId}`,e)})}async sync(e){let t={mainPeer:null,shadowPeers:this.shadows.map(()=>null)},i=[];try{t.mainPeer=new e6(this.rootDoc,this.main,this.priorityTarget,this.logger),i.push(t.mainPeer.onStatusChange.on(()=>{e.aborted||this.updateSyncingState(t.mainPeer,t.shadowPeers)}).dispose),this.updateSyncingState(t.mainPeer,t.shadowPeers),await t.mainPeer.waitForLoaded(e),t.shadowPeers=this.shadows.map(s=>{let o=new e6(this.rootDoc,s,this.priorityTarget,this.logger);return i.push(o.onStatusChange.on(()=>{e.aborted||this.updateSyncingState(t.mainPeer,t.shadowPeers)}).dispose),o}),this.updateSyncingState(t.mainPeer,t.shadowPeers),await new Promise((t,i)=>{e.aborted&&i(e.reason),e.addEventListener("abort",()=>{i(e.reason)})})}catch(t){if(t===e4||e.aborted)return;throw t}finally{for(let e of(t.mainPeer?.stop(),t.shadowPeers))e?.stop();for(let e of i)e()}}updateSyncingState(e,t){let i=r.Synced,s=[e,...t];for(let e of s)if(!e||e.status.step!==a.Synced){i=r.Syncing;break}this.setStatus({step:i,main:e?.status??null,shadows:t.map(e=>e?.status??null),retrying:s.some(e=>e?.status.step===a.Retrying)})}async waitForGracefulStop(e){await Promise.race([new Promise((t,i)=>{e?.aborted&&i(e?.reason),e?.addEventListener("abort",()=>{i(e.reason)})}),new Promise(e=>{this.onStatusChange.on(()=>{this.canGracefulStop()&&e()})})]),e3(e),this.forceStop()}async waitForLoadedRootDoc(e){function t(e){return![e.main,...e.shadows].some(e=>!e||e.step<=a.LoadingRootDoc)}if(!t(this.status))return Promise.race([new Promise(e=>{this.onStatusChange.on(i=>{t(i)&&e()})}),new Promise((t,i)=>{e?.aborted&&i(e?.reason),e?.addEventListener("abort",()=>{i(e.reason)})})])}async waitForSynced(e){if(this.status.step!==r.Synced)return Promise.race([new Promise(e=>{this.onStatusChange.on(t=>{t.step===r.Synced&&e()})}),new Promise((t,i)=>{e?.aborted&&i(e?.reason),e?.addEventListener("abort",()=>{i(e.reason)})})])}get rootDocId(){return this.rootDoc.guid}get status(){return this._status}}i(48862);class e9{constructor(){this.name="noop"}pull(e,t){return null}push(e,t){}subscribe(e,t){return()=>{}}}var te=i(79996);class tt{constructor(e,t){this._onAwarenessChange=e=>{this._flags.value=this.awareness.getLocalState()?.flags??{};let{added:t,removed:i,updated:s}=e,o=this.awareness.getStates();t.forEach(e=>{this.slots.update.emit({id:e,type:"add",state:o.get(e)})}),s.forEach(e=>{this.slots.update.emit({id:e,type:"update",state:o.get(e)})}),i.forEach(e=>{this.slots.update.emit({id:e,type:"remove"})})},this.slots={update:new A.D},this._flags=(0,S.vP)(t),this.awareness=e,this.awareness.on("change",this._onAwarenessChange),this.awareness.setLocalStateField("selectionV2",{}),this._initFlags(t)}_initFlags(e){let t=this.awareness.getLocalState()?.flags,i=t?(0,te.merge)(!0,e,t):{...e};this.awareness.setLocalStateField("flags",i)}destroy(){this.awareness&&(this.awareness.off("change",this._onAwarenessChange),this.slots.update.dispose())}getFlag(e){return this._flags.value[e]}getLocalSelection(e){return(this.awareness.getLocalState()?.selectionV2??{})[e.id]??[]}getStates(){return this.awareness.getStates()}isReadonly(e){let t=this.getFlag("readonly");return!!t&&"object"==typeof t&&!!t[e.id]}setFlag(e,t){let i=this.awareness.getLocalState()?.flags??{};this.awareness.setLocalStateField("flags",{...i,[e]:t})}setLocalSelection(e,t){let i=this.awareness.getLocalState()?.selectionV2??{};this.awareness.setLocalStateField("selectionV2",{...i,[e.id]:t})}setReadonly(e,t){let i=this.getFlag("readonly")??{};this.setFlag("readonly",{...i,[e.id]:t})}}class ti extends y.Doc{constructor(){super(...arguments),this._spaces=this.getMap("spaces")}getArrayProxy(e){return H(super.getArray(e))}getMapProxy(e){return H(super.getMap(e))}toJSON(){let e=super.toJSON();delete e.spaces;let t={};return this.spaces.forEach((e,i)=>{t[i]=e.toJSON()}),{...e,spaces:t}}transact(e,t){return super.transact(e,t)}get spaces(){return this._spaces}}var ts=i(69050);class to{constructor(e){this._backlinkIndexMapCache=null,this._disposables=new ts.K,this._linkIndexMap={},this.slots={indexUpdated:new A.D},this._disposables.add(e.slots.refreshIndex.on(()=>this._onRefreshIndex())),this._disposables.add(e.slots.docRemoved.on(e=>this._onDocRemoved(e))),this._disposables.add(e.slots.blockUpdated.on(e=>this._onBlockUpdated(e))),this.slots.indexUpdated.on(()=>{this._backlinkIndexMapCache=null})}_indexDelta({action:e,docId:t,blockId:i,links:s}){(function(e,t,i=(e,t)=>e===t){let s=[],o=[],r=[];for(let s of e)t.some(e=>i(e,s))?r.push(s):o.push(s);for(let o of t)e.some(e=>i(e,o))||s.push(o);return{changed:s.length||o.length,add:s,remove:o,unchanged:r}})(this._linkIndexMap[t]?.[i]??[],s).changed&&(this._linkIndexMap[t]={...this._linkIndexMap[t],[i]:s},this.slots.indexUpdated.emit({action:e,docId:t,blockId:i}))}_onBlockUpdated({action:e,docId:t,block:i,blockId:s}){switch(e){case"add":case"update":{let o=[],r=i.get("prop:text");r&&(r instanceof y.Text?o=[...o,...r.toDelta().filter(e=>e.attributes&&e.attributes.reference).map(e=>({...e.attributes.reference,blockId:s}))]:console.warn("Unexpected prop:text type",r));let a=i.get("sys:flavour");if("affine:embed-linked-doc"===a||"affine:embed-synced-doc"===a){let e=i.get("prop:pageId");"string"==typeof e?o=[...o,{pageId:e,blockId:s,type:"LinkedPage"}]:console.warn("Unexpected prop:pageId type",e)}this._indexDelta({action:e,docId:t,blockId:s,links:o});return}case"delete":this._removeIndex(t,s)}}_onDocRemoved(e){this._linkIndexMap[e]&&(this._linkIndexMap[e]={},this.slots.indexUpdated.emit({action:"delete",docId:e}))}_onRefreshIndex(){this._linkIndexMap={}}_removeIndex(e,t){if(!this._linkIndexMap[e]||!this._linkIndexMap[e][t])return;let i=this._linkIndexMap[e][t];delete this._linkIndexMap[e][t],i.length&&this.slots.indexUpdated.emit({action:"delete",docId:e,blockId:t})}dispose(){this._disposables.dispose()}getBacklink(e){if(this._backlinkIndexMapCache)return this._backlinkIndexMapCache[e]??[];let t={};for(let[e,i]of Object.entries(this._linkIndexMap))for(let[s,o]of Object.entries(i))o.forEach(({pageId:i,type:o})=>{i in t||(t[i]=[]),t[i].push({pageId:e,blockId:s,type:o})});return this._backlinkIndexMapCache=t,this._backlinkIndexMapCache[e]??[]}get linkIndexMap(){return this._linkIndexMap}}class tr{constructor(e,{immediately:t=!1,slots:i}){if(this._disposables=new ts.K,this._yDocObserver=(e,t,{docId:i,yDoc:s})=>{e.forEach(e=>{if(!(e instanceof y.YArrayEvent)){if(e instanceof y.YMapEvent){if(e.target!==e.currentTarget){if(e.keysChanged.has("prop:text")){let t=e.path[0],o=s.get(t);(0,p.Z1)(o),this._indexBlock({action:"update",docId:i,blockId:t,block:o})}return}Array.from(e.changes.keys.entries()).forEach(([e,{action:t}])=>{if("delete"===t){this._indexBlock({action:t,docId:i,blockId:e});return}let o=s.get(e);(0,p.Z1)(o),this._indexBlock({action:t,docId:i,blockId:e,block:o})});return}if(e instanceof y.YTextEvent){let t=e.path[0];if(!t||"string"!=typeof t)throw Error("Failed to update index! Unexpected YText Event!");let o=s.get(t);(0,p.Z1)(o),this._indexBlock({action:"update",docId:i,blockId:t,block:o});return}}})},this.slots={docRemoved:new A.D,blockUpdated:new A.D,refreshIndex:new A.D},this._doc=e,this._collectionSlots=i,t){this._initIndex();return}setTimeout(()=>{this._initIndex()},0)}_getDoc(e){return this._doc.spaces.get(e)}_indexBlock(e){this.slots.blockUpdated.emit(e)}_indexDoc(e,t){let i=t.getMap("blocks");i.forEach((t,i)=>{this._indexBlock({action:"add",docId:e,blockId:i,block:t})});let s=(t,s)=>this._yDocObserver(t,s,{docId:e,yDoc:i});return i.observeDeep(s),()=>{i.unobserveDeep(s)}}_initIndex(){let e=this._doc;if(!e.share.has("meta"))throw Error("Failed to initialize indexer: collection meta not found");let t={};this._disposables.add(()=>{Object.values(t).forEach(e=>e?.()),t={}}),Array.from(e.spaces.keys()).map(e=>({docId:e,doc:this._getDoc(e)})).forEach(({docId:e,doc:i})=>{if((0,p.Z1)(i,`Failed to find doc '${e}'`),t[e]){console.warn(`Duplicated docAdded event! ${e} already observed`,t);return}let s=this._indexDoc(e,i);t[e]=s}),this._collectionSlots.docAdded.on(e=>{let i=this._getDoc(e);if((0,p.Z1)(i,`Failed to find doc '${e}'`),t[e])return;let s=this._indexDoc(e,i);t[e]=s}),this._collectionSlots.docRemoved.on(e=>{t[e]?.(),t[e]=null,this.slots.docRemoved.emit(e)})}dispose(){this._disposables.dispose()}refreshIndex(){this.slots.refreshIndex.emit(),this._initIndex()}}var ta=i(63820),tn=i(97880);let tl=tn.A.Document,tc=tn.A.Index;class td{constructor(e,t="en-US"){this._reindex=()=>{if(this._reindexMap){for(let e of this._reindexMap.keys()){let t=this._reindexMap.get(e);t&&(this._reindexMap.delete(e),this._indexer.add(e,t))}setTimeout(()=>{this._reindexMap&&(ta.bE?requestIdleCallback(this._reindex,{timeout:1e3}):setTimeout(this._reindex,1e3))},200)}},this._reindexMap=null,this._doc=e,this._indexer=new tl({document:{id:"id",index:["content","reference","space"],tag:"tags",store:["space","content"]},encode:function(e){let t=Intl.Segmenter;if(t){let i=new tc({charset:"latin:advanced"}),s=i.encode.bind(i),o=/^[\p{Script=Latin}\p{Mark}\d]+$/u,r=new t([e],{granularity:"word"});return e=>{let t=[];return[...Array.from(r.segment(e)).filter(e=>{if(e.isWordLike){if(!o.test(e.segment))return!0;t.push(e.segment)}return!1}).map(e=>e.segment),...s(t.join(" "))]}}return e=>e.replace(/[\x00-\x7F]/g,"").split("")}(t),tokenize:"forward",context:!0}),this._reindexMap=new Map,this._reindex(),e.spaces.observe(e=>{e.keysChanged.forEach(e=>{let t=this._getDoc(e);null!=t&&this._handleDocIndexing(e,t)})}),ta.u2&&window.addEventListener("beforeunload",()=>{this._reindexMap=null}),ta.A_&&process.on("exit",()=>{this._reindexMap=null})}_getDoc(e){try{return this._doc.spaces.get(e)}catch(e){return}}_handleDocIndexing(e,t){if(!t)return;let i=t.getMap("blocks");this.refreshDocIndex(e,t),i.observeDeep(t=>{let s=t.flatMap(e=>(e.path?.length|0)>0?[[e.path[0],"update"]]:Array.from(e.changes.keys.entries()).map(([e,{action:t}])=>[e,t]));s.length&&s.forEach(([t,s])=>{this._refreshIndex(e,t,s,i.get(t))})})}_refreshIndex(e,t,i,s){switch(i){case"add":case"update":if(s){let i=this._toContent(s.get("prop:title")||s.get("prop:text"));i&&this._reindexMap?.set(t,{content:i,space:e,tags:[e]})}break;case"delete":this._reindexMap?.delete(t),this._indexer.remove(t)}}_search(e){return"object"==typeof e?this._indexer.search({...e,enrich:!0}):this._indexer.search(e,{enrich:!0})}_toContent(e){if(e){if("string"==typeof e)return e;if(e instanceof y.Text)return e.toJSON()}}refreshDocIndex(e,t){let i=t.getMap("blocks");i.forEach((t,s)=>{this._refreshIndex(e,s,"add",i.get(s))})}search(e){return new Map(this._search(e).flatMap(({result:e})=>e.map(e=>[e.id,{space:e.doc.space,content:e.doc.content}])))}}let th=e=>class extends e{constructor(e){super(e);let t=new tr(this.doc,{slots:this.slots});this.indexer={search:e.disableSearchIndex?null:new td(this.doc),backlink:new to(t)}}search(e){return this.indexer.search?.search(e)??new Map}},tu=Symbol.for("react.test.json"),tp=["sys:id","sys:version","sys:flavour","sys:children","prop:xywh","prop:cells","prop:elements"];function tf(e){return e.length?1!==e.length||e[0].attributes?{$$typeof:tu,type:"",props:{},children:e?.map(({insert:e,attributes:t})=>({$$typeof:tu,type:"text",props:{insert:e,...t}}))}:e[0].insert:void 0}let tg=e=>class extends e{exportJSX(e,t=this.meta.docMetas.at(0)?.id){(0,p.Z1)(t);let i=this.doc.spaces.get(t);(0,p.Z1)(i);let s=function e(t){let i={};return t.share.forEach((t,s)=>{t instanceof y.Map?i[s]=function t(i){let s={};return i.forEach((i,o)=>{s[o]=function i(s){return s instanceof y.Doc?e(s):s instanceof y.Map?t(s):s instanceof y.Text?s.toDelta():s instanceof y.Array?s.toArray().map(e=>i(e)):s instanceof y.AbstractType?s.toJSON():s}(i)}),s}(t):i[s]=t.toJSON()}),i}(i);if(!s)throw Error(`Doc ${t} doesn't exist`);let o=s.blocks;if(!e){let t=Object.keys(o).at(0);if(!t)return null;e=t}return o[e]?function e(t,i){if(!("object"==typeof t&&null!==t))throw Error("Failed to parse doc record! Invalid data.");let s=t[i];if(!s)throw Error(`Failed to parse doc record! Node not found! id: ${i}.`);let o=s["sys:flavour"],r=s["sys:children"],a=Object.fromEntries(Object.entries(s).filter(([e])=>!tp.includes(e)));return"prop:text"in a&&a["prop:text"]instanceof Array&&(a["prop:text"]=tf(a["prop:text"])),"prop:title"in a&&a["prop:title"]instanceof Array&&(a["prop:title"]=tf(a["prop:title"])),"prop:columns"in a&&a["prop:columns"]instanceof Array&&(a["prop:columns"]=`Array [${a["prop:columns"].length}]`),"prop:views"in a&&a["prop:views"]instanceof Array&&(a["prop:views"]=`Array [${a["prop:views"].length}]`),{$$typeof:tu,type:o,props:a,children:r?.map(i=>e(t,i))??[]}}(o,e):null}};class tm{}var tv=i(47754);class ty{constructor(e,t){this._yBlocks=e,this._schema=t}_getSiblings(e,t){let i=this.getParent(e);if(!i)return null;let s=this._yBlocks.get(i);if(!s)return null;let o=s.get("sys:children").toArray().indexOf(e);return -1===o?null:t(o,s)}addBlock(e,t,i={},s,o){let r=this._schema.flavourSchemaMap.get(t);if(!r)throw new l.Ss(c.O.ModelCRUDError,`schema for flavour: ${t} not found`);let a=s?this._yBlocks.get(s)?.get("sys:flavour"):void 0;this._schema.validate(t,a);let n=new y.Map;this._yBlocks.set(e,n);let d=r.version,h=i.children?.map(e=>"string"==typeof e?e:e.id);n.set("sys:id",e),n.set("sys:flavour",t),n.set("sys:version",d),n.set("sys:children",y.Array.from(h??[]));let u={...r.model.props?.(z)??{},...i};delete u.id,delete u.flavour,delete u.children,Object.entries(u).forEach(([e,t])=>{void 0!==t&&n.set(`prop:${e}`,I(t))});let p=s??("root"===r.model.role?null:this.root);if(!p)return;let f=this._yBlocks.get(p);if(!f)return;let g=f.get("sys:children"),m=o??g.length;g.insert(m,[e])}deleteBlock(e,t={deleteChildren:!0}){let{bringChildrenTo:i,deleteChildren:s}=t;if(i&&s){console.error("Cannot bring children to another block and delete them at the same time");return}let o=this._yBlocks.get(e);if(!o)return;let r=o.get("sys:children"),a=this.getParent(e);if(!a)return;let n=this._yBlocks.get(a).get("sys:children"),d=n.toArray().indexOf(e);d>-1&&n.delete(d,1),(()=>{if(i){(()=>{if(!i)throw new l.Ss(c.O.ModelCRUDError,"bringChildrenTo is not provided when deleting block");let e=this._yBlocks.get(i);if(!e)return;let t=e.get("sys:flavour");if(r.forEach(e=>{let i=this._yBlocks.get(e);i&&this._schema.validate(i.get("sys:flavour"),t)}),i===a){n.insert(d,r.toArray());return}let s=this._yBlocks.get(i);s&&s.get("sys:children").push(r.toArray())})();return}if(s){let e=t=>{this._yBlocks.get(t).get("sys:children").forEach(t=>e(t)),this._yBlocks.delete(t)};r.forEach(t=>e(t))}})(),this._yBlocks.delete(e)}getNext(e){return this._getSiblings(e,(e,t)=>t.get("sys:children").toArray().at(e+1)??null)}getParent(e){let t=this.root;if(!t||t===e)return null;let i=t=>{let s=this._yBlocks.get(t);if(!s)return null;for(let o of s.get("sys:children").toArray()){if(o===e)return t;let s=i(o);if(null!=s)return s}return null};return i(t)}getPrev(e){return this._getSiblings(e,(e,t)=>t.get("sys:children").toArray().at(e-1)??null)}moveBlocks(e,t,i=null,s=!0){let o=new Map,r=this._yBlocks.get(t);if(!r)return;let a=r.get("sys:flavour");e.forEach(e=>{let t=this.getParent(e);if(!t)return;let i=this._yBlocks.get(e);if(!i)return;this._schema.validate(i.get("sys:flavour"),a);let s=o.get(t);if(!s){o.set(t,[e]);return}let r=s[s.length-1];if(this.getNext(r)!==e)throw new l.Ss(c.O.ModelCRUDError,"The blocks to move are not contiguous under their parent");s.push(e)});let n=0;Array.from(o.entries()).forEach(([e,o],r)=>{let a=this._yBlocks.get(t);if(!a)return;let d=a.get("sys:children"),h=this._yBlocks.get(e);if(!h)return;let u=h.get("sys:children"),p=u.toArray().findIndex(e=>e===o[0]);u.delete(p,o.length),(()=>{if(0!==r){n++;return}if(!i){n=d.length;return}let e=d.toArray().findIndex(e=>e===i);if(-1===e)throw new l.Ss(c.O.ModelCRUDError,"Target sibling not found");n=s?e:e+1})(),d.insert(n,o)})}updateBlockChildren(e,t){let i=this._yBlocks.get(e);if(!i)return;let s=i.get("sys:children");s.delete(0,s.length),s.push(t)}get root(){let e=null;return this._yBlocks.forEach(t=>{let i=t.get("sys:flavour"),s=this._schema.flavourSchemaMap.get(i);s&&"root"===s.model.role&&(e=t.get("sys:id"))}),e}}class tb{constructor({id:e,collection:t,doc:i,awarenessStore:s,idGenerator:o=tv.gZ}){this._docMap={undefined:new Map,true:new Map,false:new Map},this._handleYEvents=e=>{e.forEach(e=>this._handleYEvent(e))},this._historyObserver=()=>{this.slots.historyUpdated.emit()},this._initSubDoc=()=>{let e=this.rootDoc.spaces.get(this.id);return e?(this._loaded=!1,this.rootDoc.on("subdocs",this._onSubdocEvent)):(e=new y.Doc({guid:this.id}),this.rootDoc.spaces.set(this.id,e),this._loaded=!0,this._onLoadSlot.emit()),e},this._onLoadSlot=new A.D,this._onSubdocEvent=({loaded:e})=>{Array.from(e).find(e=>e.guid===this._ySpaceDoc.guid)&&(this.rootDoc.off("subdocs",this._onSubdocEvent),this._loaded=!0,this._onLoadSlot.emit())},this._ready=!1,this._shouldTransact=!0,this.slots={historyUpdated:new A.D,yBlockUpdated:new A.D},this.id=e,this.rootDoc=i,this.awarenessStore=s,this._ySpaceDoc=this._initSubDoc(),this._yBlocks=this._ySpaceDoc.getMap("blocks"),this._collection=t,this._idGenerator=o,this._docCRUD=new ty(this._yBlocks,t.schema)}_getReadonlyKey(e){return e?.toString()??"undefined"}_handleVersion(){this.collection.meta.hasVersion?this.awarenessStore.getFlag("enable_legacy_validation")&&this.collection.meta.validateVersion(this.collection):this.collection.meta.writeVersion(this.collection)}_handleYBlockAdd(e){this.slots.yBlockUpdated.emit({type:"add",id:e})}_handleYBlockDelete(e){this.slots.yBlockUpdated.emit({type:"delete",id:e})}_handleYEvent(e){e.target===this._yBlocks&&e.keys.forEach((e,t)=>{try{if("add"===e.action){this._handleYBlockAdd(t);return}if("delete"===e.action){this._handleYBlockDelete(t);return}}catch(e){console.error("An error occurred while handling Yjs event:"),console.error(e)}})}_initYBlocks(){let{_yBlocks:e}=this;e.observeDeep(this._handleYEvents),this._history=new y.UndoManager([e],{trackedOrigins:new Set([this._ySpaceDoc.clientID])}),this._history.on("stack-cleared",this._historyObserver),this._history.on("stack-item-added",this._historyObserver),this._history.on("stack-item-popped",this._historyObserver),this._history.on("stack-item-updated",this._historyObserver)}captureSync(){this._history.stopCapturing()}clear(){this._yBlocks.clear()}clearQuery(e,t){let i=this._getReadonlyKey(t);this._docMap[i].delete(JSON.stringify(e))}destroy(){this._ySpaceDoc.destroy(),this._onLoadSlot.dispose(),this._loaded=!1}dispose(){this.slots.historyUpdated.dispose(),this.ready&&(this._yBlocks.unobserveDeep(this._handleYEvents),this._yBlocks.clear())}generateBlockId(){return this._idGenerator()}getDoc({readonly:e,query:t}={}){let i=this._getReadonlyKey(e),s=JSON.stringify(t);if(this._docMap[i].has(s))return this._docMap[i].get(s);let o=new eF({blockCollection:this,crud:this._docCRUD,schema:this.collection.schema,readonly:e,query:t});return this._docMap[i].set(s,o),o}load(e){return this.ready||(this._ySpaceDoc.load(),(this.collection.meta.docs?.length??0)<=1&&this._handleVersion(),this._initYBlocks(),this._yBlocks.forEach((e,t)=>{this._handleYBlockAdd(t)}),e?.(),this._ready=!0),this}redo(){if(this.readonly){console.error("cannot modify data in readonly mode");return}this._history.redo()}remove(){this.destroy(),this.rootDoc.spaces.delete(this.id)}resetHistory(){this._history.clear()}transact(e,t=this._shouldTransact){this._ySpaceDoc.transact(()=>{try{e()}catch(e){console.error(`An error occurred while Y.doc ${this._ySpaceDoc.guid} transacting:`),console.error(e)}},t?this.rootDoc.clientID:null)}undo(){if(this.readonly){console.error("cannot modify data in readonly mode");return}this._history.undo()}withoutTransact(e){this._shouldTransact=!1,e(),this._shouldTransact=!0}get Text(){return M}get awarenessSync(){return this.collection.awarenessSync}get blobSync(){return this.collection.blobSync}get canRedo(){return!this.readonly&&this._history.canRedo()}get canUndo(){return!this.readonly&&this._history.canUndo()}get collection(){return this._collection}get crud(){return this._docCRUD}get docSync(){return this.collection.docSync}get history(){return this._history}get isEmpty(){return 0===this._yBlocks.size}get loaded(){return this._loaded}get meta(){return this.collection.meta.getDocMeta(this.id)}get readonly(){return this.awarenessStore.isReadonly(this)}get ready(){return this._ready}get schema(){return this.collection.schema}get spaceDoc(){return this._ySpaceDoc}get yBlocks(){return this._yBlocks}}var tw=i(30397);let tx=()=>(0,tv.gZ)(),t_=()=>(0,tw.Ak)(10);!function(e){e.AutoIncrement="autoIncrement",e.AutoIncrementByClientId="autoIncrementByClientId",e.NanoID="nanoID",e.UUIDv4="uuidV4"}(n||(n={}));class tC{constructor(e){this._handleDocCollectionMetaEvents=e=>{e.forEach(e=>{let t=t=>e.target===this._yMap&&e.changes.keys.has(t);(e.target===this.yDocs||e.target.parent===this.yDocs||t("pages"))&&this._handleDocMetaEvent(),(t("name")||t("avatar"))&&this._handleCommonFieldsEvent()})},this._prevDocs=new Set,this.commonFieldsUpdated=new A.D,this.docMetaAdded=new A.D,this.docMetaRemoved=new A.D,this.docMetaUpdated=new A.D,this.id="meta",this.doc=e,this._yMap=e.getMap(this.id),this._proxy=e.getMapProxy(this.id),this._yMap.observeDeep(this._handleDocCollectionMetaEvents)}_handleCommonFieldsEvent(){this.commonFieldsUpdated.emit()}_handleDocMetaEvent(){let{docMetas:e,_prevDocs:t}=this,i=new Set;e.forEach(e=>{t.has(e.id)||this.docMetaAdded.emit(e.id),i.add(e.id)}),t.forEach(e=>{!1===i.has(e)&&this.docMetaRemoved.emit(e)}),this._prevDocs=i,this.docMetaUpdated.emit()}addDocMeta(e,t){this.doc.transact(()=>{if(!this.docs)return;let i=this.docs;void 0===t?i.push(e):i.splice(t,0,e)},this.doc.clientID)}getDocMeta(e){return this.docMetas.find(t=>t.id===e)}initialize(){this._proxy.pages||(this._proxy.pages=[])}removeDocMeta(e){if(!this.docs)return;let t=this.docMetas.findIndex(t=>e===t.id);-1!==t&&this.doc.transact(()=>{this.docs&&this.docs.splice(t,1)},this.doc.clientID)}setAvatar(e){this.doc.transact(()=>{this._proxy.avatar=e},this.doc.clientID)}setDocMeta(e,t){let i=(this.docs??[]).findIndex(t=>e===t.id);this.doc.transact(()=>{if(!this.docs||-1===i)return;let e=this.docs[i];Object.entries(t).forEach(([t,i])=>{e[t]=i})},this.doc.clientID)}setName(e){this.doc.transact(()=>{this._proxy.name=e},this.doc.clientID)}setProperties(e){this._proxy.properties=e,this.docMetaUpdated.emit()}updateVersion(e){this._proxy.workspaceVersion=2,this._proxy.pageVersion=2;let t={};e.schema.flavourSchemaMap.forEach((e,i)=>{t[i]=e.version}),this._proxy.blockVersions=t}validateVersion(e){let t=this._proxy.workspaceVersion;if(!t)throw new l.Ss(c.O.DocCollectionError,"Invalid workspace data, workspace version is missing. Please make sure the data is valid.");if(t<2)throw new l.Ss(c.O.DocCollectionError,`Workspace version ${t} is outdated. Please upgrade the editor.`);let i=this._proxy.pageVersion;if(!i)throw new l.Ss(c.O.DocCollectionError,"Invalid workspace data, page version is missing. Please make sure the data is valid.");if(i<2)throw new l.Ss(c.O.DocCollectionError,`Doc version ${i} is outdated. Please upgrade the editor.`);let s={...this._proxy.blockVersions};if(!s)throw new l.Ss(c.O.DocCollectionError,"Invalid workspace data, versions data is missing. Please make sure the data is valid");let o=Object.keys(s);if(0===o.length)throw new l.Ss(c.O.DocCollectionError,"Invalid workspace data, missing versions field. Please make sure the data is valid.");o.forEach(t=>{let i=s[t],o=e.schema.flavourSchemaMap.get(t)?.version;if(o){if(i>o)throw new l.Ss(c.O.DocCollectionError,`Editor doesn't support ${t}@${i}. Please upgrade the editor.`);if(i{t[i]=e.version}),this._proxy.blockVersions=t}}get avatar(){return this._proxy.avatar}get blockVersions(){return this._proxy.blockVersions}get docMetas(){return this._proxy.pages?this._proxy.pages:[]}get docs(){return this._proxy.pages}get hasVersion(){return!!this.blockVersions&&!!this.pageVersion&&!!this.workspaceVersion&&Object.keys(this.blockVersions).length>0}get name(){return this._proxy.name}get pageVersion(){return this._proxy.pageVersion}get properties(){return this._proxy.properties||{tags:{options:[]}}}get workspaceVersion(){return this._proxy.workspaceVersion}get yDocs(){return this._yMap.get("pages")}}var tk=function(e,t,i,s,o,r){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var n,l=s.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?s.static?e:e.prototype:null,h=t||(d?Object.getOwnPropertyDescriptor(d,s.name):{}),u=!1,p=i.length-1;p>=0;p--){var f={};for(var g in s)f[g]="access"===g?{}:s[g];for(var g in s.access)f.access[g]=s.access[g];f.addInitializer=function(e){if(u)throw TypeError("Cannot add initializers after decoration has completed");r.push(a(e||null))};var m=(0,i[p])("accessor"===l?{get:h.get,set:h.set}:h[c],f);if("accessor"===l){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(n=a(m.get))&&(h.get=n),(n=a(m.set))&&(h.set=n),(n=a(m.init))&&o.unshift(n)}else(n=a(m))&&("field"===l?o.unshift(n):h[c]=n)}d&&Object.defineProperty(d,s.name,h),u=!0},tS=function(e,t,i){for(var s=arguments.length>2,o=0;o{let e,t,i=[th,tg],s=[],o=tm;return class extends o{static{t=this}static{let r="function"==typeof Symbol&&Symbol.metadata?Object.create(o[Symbol.metadata]??null):void 0;tk(null,e={value:t},i,{kind:"class",name:t.name,metadata:r},null,s),t=e.value,r&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}static{this.Y=y}constructor({id:e,schema:t,idGenerator:i,defaultFlags:s,awarenessSources:o=[],docSources:r={main:new e9},blobSources:a={main:new e0},logger:l=new eK}){super(),this.blockCollections=new Map,this.slots={docAdded:new A.D,docUpdated:new A.D,docRemoved:new A.D},this._schema=t,this.id=e||"",this.doc=new ti({guid:e}),this.awarenessStore=new tt(new eQ.ww(this.doc),(0,te.merge)(!0,tM,s)),this.awarenessSync=new eX(this.awarenessStore.awareness,o),this.docSync=new e8(this.doc,r.main,r.shadows??[],l),this.blobSync=new e1(a.main,a.shadows??[],l),this.idGenerator=function(e,t){if("function"==typeof e)return e;switch(e){case n.AutoIncrement:let i;return i=0,()=>(i++).toString();case n.AutoIncrementByClientId:let s;return s=0,()=>`${t}:${s++}`;case n.UUIDv4:return tx;case n.NanoID:default:return t_}}(i,this.doc.clientID),this.meta=new tC(this.doc),this._bindDocMetaEvents()}_bindDocMetaEvents(){this.meta.docMetaAdded.on(e=>{let t=new tb({id:e,collection:this,doc:this.doc,awarenessStore:this.awarenessStore,idGenerator:this.idGenerator});this.blockCollections.set(t.id,t),this.slots.docAdded.emit(t.id)}),this.meta.docMetaUpdated.on(()=>this.slots.docUpdated.emit()),this.meta.docMetaRemoved.on(e=>{let t=this.getBlockCollection(e);t&&(this.blockCollections.delete(e),t.remove(),this.slots.docRemoved.emit(e))})}_hasDoc(e){return this.docs.has(e)}canGracefulStop(){this.docSync.canGracefulStop()}createDoc(e={}){let{id:t=this.idGenerator(),query:i}=e;if(this._hasDoc(t))throw new l.Ss(c.O.DocCollectionError,"doc already exists");return this.meta.addDocMeta({id:t,title:"",createDate:Date.now(),tags:[]}),this.getDoc(t,{query:i})}forceStop(){this.docSync.forceStop(),this.blobSync.stop(),this.awarenessSync.disconnect()}getBlockCollection(e){return this.docs.get(e)??null}getDoc(e,t){let i=this.getBlockCollection(e);return i?.getDoc(t)??null}removeDoc(e){if(!this.meta.getDocMeta(e))throw new l.Ss(c.O.DocCollectionError,`doc meta not found: ${e}`);let t=this.getBlockCollection(e);t&&(t.dispose(),this.meta.removeDocMeta(e),this.blockCollections.delete(e))}setDocMeta(e,t){this.meta.setDocMeta(e,t)}start(){this.docSync.start(),this.blobSync.start(),this.awarenessSync.connect()}waitForGracefulStop(e){return this.docSync.waitForGracefulStop(e)}waitForSynced(){return this.docSync.waitForSynced()}get docs(){return this.blockCollections}get isEmpty(){if(0===this.doc.store.clients.size)return!0;let e=!1;return 1===this.doc.store.clients.size&&Array.from(this.doc.store.clients.values())[0].length<=2&&(e=!0),e}get schema(){return this._schema}static{tS(t,s)}},t})();function tI(e){return Array.isArray(e)?e.map(tI):"object"==typeof e&&null!=e?Reflect.has(e,_)?new k(Reflect.get(e,"value")):Reflect.has(e,x)?new M(Reflect.get(e,"delta")):Object.fromEntries(Object.entries(e).map(([e,t])=>[e,tI(t)])):e}class tB{constructor(){this._internal=z}_propsFromSnapshot(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,tI(t)]))}_propsToSnapshot(e){return Object.fromEntries(e.keys.map(t=>{let i=e[t];return[t,function e(t){return t instanceof k?{[_]:!0,value:t.getValue()}:t instanceof M?{[x]:!0,delta:t.yText.toDelta()}:Array.isArray(t)?t.map(e):E(t)?Object.fromEntries(Object.entries(t).map(([t,i])=>[t,e(i)])):t}(i)]}))}fromSnapshot({json:e}){let{flavour:t,id:i,version:s,props:o}=e;return{id:i,flavour:t,version:s??-1,props:this._propsFromSnapshot(o)}}toSnapshot({model:e}){let{id:t,flavour:i,version:s}=e;return{id:t,flavour:i,version:s,props:this._propsToSnapshot(e)}}}function t$(e){let{id:t,version:i,flavour:s,role:o,keys:r,text:a,children:n}=e,l=e.keys.reduce((t,i)=>({...t,[i]:e[i]}),{});return{id:t,version:i,flavour:s,role:o,keys:r,text:a,children:n.map(t$),...l}}class tT{constructor(e){this._assetsMap=new Map,this._blob=e.blob}cleanup(){this._assetsMap.clear()}getAssets(){return this._assetsMap}isEmpty(){return 0===this._assetsMap.size}async readFromBlob(e){let t=await this._blob.get(e);(0,p.Z1)(t,`Blob ${e} not found in blob manager`),this._assetsMap.set(e,t)}async writeToBlob(e){let t=this._assetsMap.get(e);(0,p.Z1)(t),await this._blob.get(e)===null&&await this._blob.set(e,t)}}class tO{constructor(e){this.data=e}static fromModels(e,t){let{pageVersion:i,workspaceVersion:s}=e.collection.meta;if(!i||!s)throw new l.Ss(c.O.ModelCRUDError,"pageVersion or workspaceVersion not found when creating slice");return new tO({content:t,workspaceId:e.collection.id,pageId:e.id,pageVersion:i,workspaceVersion:s})}get content(){return this.data.content}get docId(){return this.data.pageId}get pageVersion(){return this.data.pageVersion}get workspaceId(){return this.data.workspaceId}get workspaceVersion(){return this.data.workspaceVersion}}let tP=L.z.object({type:L.z.literal("block"),id:L.z.string(),flavour:L.z.string(),version:L.z.number().optional(),props:L.z.record(L.z.unknown()),children:L.z.lazy(()=>tP.array())}),tH=L.z.object({type:L.z.literal("slice"),content:tP.array(),pageVersion:L.z.number(),workspaceVersion:L.z.number(),workspaceId:L.z.string(),pageId:L.z.string()}),tA=L.z.object({id:L.z.string(),type:L.z.literal("info"),pageVersion:L.z.number(),workspaceVersion:L.z.number(),properties:L.z.record(L.z.any())}),tL=L.z.object({id:L.z.string(),title:L.z.string(),createDate:L.z.number(),tags:L.z.array(L.z.string())}),tD=L.z.object({type:L.z.literal("page"),meta:tL,blocks:tP});class tZ{constructor({collection:e,middlewares:t=[]}){this._adapterConfigs=new Map,this._batchCounter=0,this._pendingOperations=[],this._slots={beforeImport:new A.D,afterImport:new A.D,beforeExport:new A.D,afterExport:new A.D},this.blockToSnapshot=async e=>{try{let t=await this._blockToSnapshot(e);return tP.parse(t),t}catch(e){console.error("Error when transforming block to snapshot:"),console.error(e);return}},this.collectionInfoToSnapshot=()=>{try{this._slots.beforeExport.emit({type:"info"});let e=this._getCollectionMeta(),t={type:"info",id:this._collection.id,...e};return this._slots.afterExport.emit({type:"info",snapshot:t}),tA.parse(t),t}catch(e){console.error("Error when transforming collection info to snapshot:"),console.error(e);return}},this.docToSnapshot=async e=>{try{this._slots.beforeExport.emit({type:"page",page:e});let t=e.root,i=this._exportDocMeta(e);if(!t)throw new l.Ss(c.O.TransformerError,"Root block not found in doc");let s=await this.blockToSnapshot(t);if(!s)return;let o={type:"page",meta:i,blocks:s};return this._slots.afterExport.emit({type:"page",page:e,snapshot:o}),tD.parse(o),o}catch(e){console.error("Error when transforming doc to snapshot:"),console.error(e);return}},this.sliceToSnapshot=async e=>{try{this._slots.beforeExport.emit({type:"slice",slice:e});let{content:t,pageVersion:i,workspaceVersion:s,pageId:o,workspaceId:r}=e.data,a=[];for(let e of t){let t=await this.blockToSnapshot(e);if(!t)return;a.push(t)}let n={type:"slice",workspaceId:r,pageId:o,pageVersion:i,workspaceVersion:s,content:a};return this._slots.afterExport.emit({type:"slice",slice:e,snapshot:n}),tH.parse(n),n}catch(e){console.error("Error when transforming slice to snapshot:"),console.error(e);return}},this.snapshotToBlock=async(e,t,i,s)=>{try{return tP.parse(e),await this._batchSnapshotToBlock(e,t,i,s)}catch(e){console.error("Error when transforming snapshot to block:"),console.error(e);return}},this.snapshotToDoc=async e=>{try{this._slots.beforeImport.emit({type:"page",snapshot:e}),tD.parse(e);let{meta:t,blocks:i}=e,s=this._collection.createDoc({id:t.id});return s.load(),await this.snapshotToBlock(i,s),this._slots.afterImport.emit({type:"page",snapshot:e,page:s}),s}catch(e){console.error("Error when transforming snapshot to doc:"),console.error(e);return}},this.snapshotToModelData=async e=>{try{let{children:t,flavour:i,props:s,id:o}=e,r=this._getSchema(i),a=this._getTransformer(r);return await a.fromSnapshot({json:{id:o,flavour:i,props:s},assets:this._assetsManager,children:t})}catch(e){console.error("Error when transforming snapshot to model data:"),console.error(e);return}},this.snapshotToSlice=async(e,t,i,s)=>{try{this._slots.beforeImport.emit({type:"slice",snapshot:e}),tH.parse(e);let{content:o,pageVersion:r,workspaceVersion:a,workspaceId:n,pageId:l}=e,c=[];for(let[e,r]of o.entries())c.push(await this._batchSnapshotToBlock(r,t,i,(s??0)+e));let d=new tO({content:c.map(e=>t$(e)),pageVersion:r,workspaceVersion:a,workspaceId:n,pageId:l});return this._slots.afterImport.emit({type:"slice",snapshot:e,slice:d}),d}catch(e){console.error("Error when transforming snapshot to slice:"),console.error(e);return}},this.walk=(e,t)=>{let i=e=>{try{t(e)}catch(e){console.error("Error when walking snapshot:"),console.error(e)}e.children&&e.children.forEach(i)};i(e.blocks)},this._collection=e,this._assetsManager=new tT({blob:e.blobSync}),t.forEach(e=>{e({slots:this._slots,assetsManager:this._assetsManager,collection:this._collection,adapterConfigs:this._adapterConfigs})})}_batchSnapshotToBlock(e,t,i,s){return new Promise(o=>{this._batchCounter<100?o(this._snapshotToBlock(e,t,i,s)):this._pendingOperations.push(()=>o(this._snapshotToBlock(e,t,i,s))),this._batchCounter++,clearTimeout(this._unblockTimer),this._unblockTimer=setTimeout(()=>{for(;this._pendingOperations.length>0;)this._pendingOperations.shift()?.();this._unblockTimer=void 0,this._batchCounter=0},10)})}async _blockToSnapshot(e){this._slots.beforeExport.emit({type:"block",model:e});let t=this._getSchema(e.flavour),i=this._getTransformer(t),s=await i.toSnapshot({model:e,assets:this._assetsManager}),o=await Promise.all(e.children.map(e=>this._blockToSnapshot(e))),r={type:"block",...s,children:o};return this._slots.afterExport.emit({type:"block",model:e,snapshot:r}),r}_exportDocMeta(e){let t=e.meta;if(!t)throw new l.Ss(c.O.TransformerError,"Doc meta not found");return{id:t.id,title:t.title,createDate:t.createDate,tags:[]}}_getCollectionMeta(){let{meta:e}=this._collection,{pageVersion:t,workspaceVersion:i,docs:s}=e;if(!t)throw new l.Ss(c.O.TransformerError,"Page version not found");if(!i)throw new l.Ss(c.O.TransformerError,"Workspace version not found");if(!s)throw new l.Ss(c.O.TransformerError,"Docs not found");return{pageVersion:t,workspaceVersion:i,properties:{},pages:JSON.parse(JSON.stringify(s))}}_getSchema(e){let t=this._collection.schema.flavourSchemaMap.get(e);if(!t)throw new l.Ss(c.O.TransformerError,`Flavour schema not found for ${e}`);return t}_getTransformer(e){return e.transformer?.()??new tB}async _snapshotToBlock(e,t,i,s){this._slots.beforeImport.emit({type:"block",snapshot:e,parent:i,index:s});let{children:o,flavour:r,props:a,id:n}=e,d=this._getSchema(r),h=this._getTransformer(d),u=await h.fromSnapshot({json:{id:n,flavour:r,props:a},assets:this._assetsManager,children:o}),p="undefined"!=typeof window?window.requestAnimationFrame:setImmediate;for(let[e,r]of(await new Promise(e=>p(()=>e(void 0))),t.addBlock(u.flavour,{...u.props,id:u.id},i,s),o.entries()))await this._batchSnapshotToBlock(r,t,n,e);let f=t.getBlockById(n);if(!f)throw new l.Ss(c.O.TransformerError,`Block not found by id ${n}`);return this._slots.afterImport.emit({type:"block",snapshot:e,model:f,parent:i,index:s}),f}reset(){this._assetsManager.cleanup()}get adapterConfigs(){return this._adapterConfigs}get assets(){return this._assetsManager.getAssets()}get assetsManager(){return this._assetsManager}get collection(){return this._collection}}let tj="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},tV="__ $BLOCKSUITE_STORE$ __";!0===tj[tV]&&console.error("@blocksuite/store was already imported. This breaks constructor checks and will lead to issues!"),tj[tV]=!0}}]); //# sourceMappingURL=npm-blocksuite.a7036128.js.map