@zipify/wysiwyg 4.9.2 → 4.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,4 @@
1
1
  import { defineConfig } from 'vite';
2
- import type { PreRenderedAsset } from 'rollup';
3
2
  import vue from '@vitejs/plugin-vue';
4
3
  import { optimizeLodashImports } from '@optimize-lodash/rollup-plugin';
5
4
  import { aliases, resolvePath } from './settings';
@@ -12,17 +11,11 @@ export default defineConfig({
12
11
  lib: {
13
12
  entry: resolvePath('./lib/entryLib.ts'),
14
13
  fileName: 'wysiwyg',
14
+ cssFileName: 'wysiwyg',
15
15
  formats: ['es']
16
16
  },
17
17
 
18
18
  rollupOptions: {
19
- output: {
20
- assetFileNames: (asset: PreRenderedAsset): string => {
21
- const isStyles = asset.names?.some((name) => name === 'style.css');
22
-
23
- return isStyles ? 'wysiwyg.css' : 'assets/[name]-[hash][extname]';
24
- }
25
- },
26
19
  external: ['vue', '@zipify/colorpicker', 'simplebar']
27
20
  }
28
21
  },
package/dist/cli.js CHANGED
@@ -56,4 +56,4 @@ __p += '`),he&&(F+=`' +
56
56
  function print() { __p += __j.call(arguments, '') }
57
57
  `:`;
58
58
  `)+F+`return __p
59
- }`;var se=Vp(function(){return be(w,J+"return "+F).apply(t,C)});if(se.source=F,Du(se))throw se;return se}function lx(s){return _e(s).toLowerCase()}function ux(s){return _e(s).toUpperCase()}function cx(s,l,c){if(s=_e(s),s&&(c||l===t))return Xh(s);if(!s||!(l=At(l)))return s;var d=sn(s),y=sn(l),w=Zh(d,y),C=Qh(d,y)+1;return lr(d,w,C).join("")}function fx(s,l,c){if(s=_e(s),s&&(c||l===t))return s.slice(0,td(s)+1);if(!s||!(l=At(l)))return s;var d=sn(s),y=Qh(d,sn(l))+1;return lr(d,0,y).join("")}function hx(s,l,c){if(s=_e(s),s&&(c||l===t))return s.replace(Dl,"");if(!s||!(l=At(l)))return s;var d=sn(s),y=Zh(d,sn(l));return lr(d,y).join("")}function dx(s,l){var c=Et,d=yt;if(Me(l)){var y="separator"in l?l.separator:y;c="length"in l?re(l.length):c,d="omission"in l?At(l.omission):d}s=_e(s);var w=s.length;if(li(s)){var C=sn(s);w=C.length}if(c>=w)return s;var M=c-ui(d);if(M<1)return d;var O=C?lr(C,0,M).join(""):s.slice(0,M);if(y===t)return O+d;if(C&&(M+=O.length-M),Fu(y)){if(s.slice(M).search(y)){var P,D=O;for(y.global||(y=Ql(y.source,_e(_h.exec(y))+"g")),y.lastIndex=0;P=y.exec(D);)var F=P.index;O=O.slice(0,F===t?M:F)}}else if(s.indexOf(At(y),M)!=M){var W=O.lastIndexOf(y);W>-1&&(O=O.slice(0,W))}return O+d}function px(s){return s=_e(s),s&&Cy.test(s)?s.replace(gh,Wb):s}var mx=gi(function(s,l,c){return s+(c?" ":"")+l.toUpperCase()}),$u=Wd("toUpperCase");function Hp(s,l,c){return s=_e(s),l=c?t:l,l===t?zb(s)?Kb(s):Tb(s):s.match(l)||[]}var Vp=oe(function(s,l){try{return Ct(s,t,l)}catch(c){return Du(c)?c:new te(c)}}),gx=Pn(function(s,l){return $t(l,function(c){c=_n(c),Rn(s,c,Lu(s[c],s))}),s});function yx(s){var l=s==null?0:s.length,c=X();return s=l?ke(s,function(d){if(typeof d[1]!="function")throw new Ht(a);return[c(d[0]),d[1]]}):[],oe(function(d){for(var y=-1;++y<l;){var w=s[y];if(Ct(w[0],this,d))return Ct(w[1],this,d)}})}function bx(s){return W2(Wt(s,p))}function Hu(s){return function(){return s}}function _x(s,l){return s==null||s!==s?l:s}var vx=qd(),wx=qd(!0);function wt(s){return s}function Vu(s){return wd(typeof s=="function"?s:Wt(s,p))}function Sx(s){return xd(Wt(s,p))}function xx(s,l){return Ed(s,Wt(l,p))}var Ex=oe(function(s,l){return function(c){return ds(c,s,l)}}),Cx=oe(function(s,l){return function(c){return ds(s,c,l)}});function Wu(s,l,c){var d=Ke(l),y=Co(l,d);c==null&&!(Me(l)&&(y.length||!d.length))&&(c=l,l=s,s=this,y=Co(l,Ke(l)));var w=!(Me(c)&&"chain"in c)||!!c.chain,C=Fn(s);return $t(y,function(M){var O=l[M];s[M]=O,C&&(s.prototype[M]=function(){var P=this.__chain__;if(w||P){var D=s(this.__wrapped__),F=D.__actions__=bt(this.__actions__);return F.push({func:O,args:arguments,thisArg:s}),D.__chain__=P,D}return O.apply(s,nr([this.value()],arguments))})}),s}function kx(){return Qe._===this&&(Qe._=Zb),this}function Uu(){}function Ax(s){return s=re(s),oe(function(l){return Cd(l,s)})}var Mx=wu(ke),Tx=wu(Kh),Ox=wu(Kl);function Wp(s){return Mu(s)?Gl(_n(s)):o_(s)}function Ix(s){return function(l){return s==null?t:Rr(s,l)}}var Nx=Gd(),Rx=Gd(!0);function qu(){return[]}function Ku(){return!1}function Lx(){return{}}function Px(){return""}function Dx(){return!0}function Fx(s,l){if(s=re(s),s<1||s>Ue)return[];var c=qe,d=ot(s,qe);l=X(l),s-=qe;for(var y=Yl(d,l);++c<s;)l(c);return y}function zx(s){return ne(s)?ke(s,_n):Mt(s)?[s]:bt(up(_e(s)))}function Bx(s){var l=++Yb;return _e(s)+l}var $x=Io(function(s,l){return s+l},0),Hx=Su("ceil"),Vx=Io(function(s,l){return s/l},1),Wx=Su("floor");function Ux(s){return s&&s.length?Eo(s,wt,au):t}function qx(s,l){return s&&s.length?Eo(s,X(l,2),au):t}function Kx(s){return jh(s,wt)}function Gx(s,l){return jh(s,X(l,2))}function Jx(s){return s&&s.length?Eo(s,wt,fu):t}function jx(s,l){return s&&s.length?Eo(s,X(l,2),fu):t}var Yx=Io(function(s,l){return s*l},1),Xx=Su("round"),Zx=Io(function(s,l){return s-l},0);function Qx(s){return s&&s.length?jl(s,wt):0}function e5(s,l){return s&&s.length?jl(s,X(l,2)):0}return v.after=Sw,v.ary=vp,v.assign=uS,v.assignIn=Lp,v.assignInWith=Uo,v.assignWith=cS,v.at=fS,v.before=wp,v.bind=Lu,v.bindAll=gx,v.bindKey=Sp,v.castArray=Lw,v.chain=yp,v.chunk=W_,v.compact=U_,v.concat=q_,v.cond=yx,v.conforms=bx,v.constant=Hu,v.countBy=Qv,v.create=hS,v.curry=xp,v.curryRight=Ep,v.debounce=Cp,v.defaults=dS,v.defaultsDeep=pS,v.defer=xw,v.delay=Ew,v.difference=K_,v.differenceBy=G_,v.differenceWith=J_,v.drop=j_,v.dropRight=Y_,v.dropRightWhile=X_,v.dropWhile=Z_,v.fill=Q_,v.filter=tw,v.flatMap=iw,v.flatMapDeep=sw,v.flatMapDepth=ow,v.flatten=dp,v.flattenDeep=ev,v.flattenDepth=tv,v.flip=Cw,v.flow=vx,v.flowRight=wx,v.fromPairs=nv,v.functions=wS,v.functionsIn=SS,v.groupBy=aw,v.initial=iv,v.intersection=sv,v.intersectionBy=ov,v.intersectionWith=av,v.invert=ES,v.invertBy=CS,v.invokeMap=uw,v.iteratee=Vu,v.keyBy=cw,v.keys=Ke,v.keysIn=vt,v.map=zo,v.mapKeys=AS,v.mapValues=MS,v.matches=Sx,v.matchesProperty=xx,v.memoize=$o,v.merge=TS,v.mergeWith=Pp,v.method=Ex,v.methodOf=Cx,v.mixin=Wu,v.negate=Ho,v.nthArg=Ax,v.omit=OS,v.omitBy=IS,v.once=kw,v.orderBy=fw,v.over=Mx,v.overArgs=Aw,v.overEvery=Tx,v.overSome=Ox,v.partial=Pu,v.partialRight=kp,v.partition=hw,v.pick=NS,v.pickBy=Dp,v.property=Wp,v.propertyOf=Ix,v.pull=fv,v.pullAll=mp,v.pullAllBy=hv,v.pullAllWith=dv,v.pullAt=pv,v.range=Nx,v.rangeRight=Rx,v.rearg=Mw,v.reject=mw,v.remove=mv,v.rest=Tw,v.reverse=Nu,v.sampleSize=yw,v.set=LS,v.setWith=PS,v.shuffle=bw,v.slice=gv,v.sortBy=ww,v.sortedUniq=xv,v.sortedUniqBy=Ev,v.split=ix,v.spread=Ow,v.tail=Cv,v.take=kv,v.takeRight=Av,v.takeRightWhile=Mv,v.takeWhile=Tv,v.tap=Uv,v.throttle=Iw,v.thru=Fo,v.toArray=Ip,v.toPairs=Fp,v.toPairsIn=zp,v.toPath=zx,v.toPlainObject=Rp,v.transform=DS,v.unary=Nw,v.union=Ov,v.unionBy=Iv,v.unionWith=Nv,v.uniq=Rv,v.uniqBy=Lv,v.uniqWith=Pv,v.unset=FS,v.unzip=Ru,v.unzipWith=gp,v.update=zS,v.updateWith=BS,v.values=_i,v.valuesIn=$S,v.without=Dv,v.words=Hp,v.wrap=Rw,v.xor=Fv,v.xorBy=zv,v.xorWith=Bv,v.zip=$v,v.zipObject=Hv,v.zipObjectDeep=Vv,v.zipWith=Wv,v.entries=Fp,v.entriesIn=zp,v.extend=Lp,v.extendWith=Uo,Wu(v,v),v.add=$x,v.attempt=Vp,v.camelCase=US,v.capitalize=Bp,v.ceil=Hx,v.clamp=HS,v.clone=Pw,v.cloneDeep=Fw,v.cloneDeepWith=zw,v.cloneWith=Dw,v.conformsTo=Bw,v.deburr=$p,v.defaultTo=_x,v.divide=Vx,v.endsWith=qS,v.eq=an,v.escape=KS,v.escapeRegExp=GS,v.every=ew,v.find=nw,v.findIndex=fp,v.findKey=mS,v.findLast=rw,v.findLastIndex=hp,v.findLastKey=gS,v.floor=Wx,v.forEach=bp,v.forEachRight=_p,v.forIn=yS,v.forInRight=bS,v.forOwn=_S,v.forOwnRight=vS,v.get=zu,v.gt=$w,v.gte=Hw,v.has=xS,v.hasIn=Bu,v.head=pp,v.identity=wt,v.includes=lw,v.indexOf=rv,v.inRange=VS,v.invoke=kS,v.isArguments=Dr,v.isArray=ne,v.isArrayBuffer=Vw,v.isArrayLike=_t,v.isArrayLikeObject=Ne,v.isBoolean=Ww,v.isBuffer=ur,v.isDate=Uw,v.isElement=qw,v.isEmpty=Kw,v.isEqual=Gw,v.isEqualWith=Jw,v.isError=Du,v.isFinite=jw,v.isFunction=Fn,v.isInteger=Ap,v.isLength=Vo,v.isMap=Mp,v.isMatch=Yw,v.isMatchWith=Xw,v.isNaN=Zw,v.isNative=Qw,v.isNil=tS,v.isNull=eS,v.isNumber=Tp,v.isObject=Me,v.isObjectLike=Ie,v.isPlainObject=_s,v.isRegExp=Fu,v.isSafeInteger=nS,v.isSet=Op,v.isString=Wo,v.isSymbol=Mt,v.isTypedArray=bi,v.isUndefined=rS,v.isWeakMap=iS,v.isWeakSet=sS,v.join=lv,v.kebabCase=JS,v.last=qt,v.lastIndexOf=uv,v.lowerCase=jS,v.lowerFirst=YS,v.lt=oS,v.lte=aS,v.max=Ux,v.maxBy=qx,v.mean=Kx,v.meanBy=Gx,v.min=Jx,v.minBy=jx,v.stubArray=qu,v.stubFalse=Ku,v.stubObject=Lx,v.stubString=Px,v.stubTrue=Dx,v.multiply=Yx,v.nth=cv,v.noConflict=kx,v.noop=Uu,v.now=Bo,v.pad=XS,v.padEnd=ZS,v.padStart=QS,v.parseInt=ex,v.random=WS,v.reduce=dw,v.reduceRight=pw,v.repeat=tx,v.replace=nx,v.result=RS,v.round=Xx,v.runInContext=T,v.sample=gw,v.size=_w,v.snakeCase=rx,v.some=vw,v.sortedIndex=yv,v.sortedIndexBy=bv,v.sortedIndexOf=_v,v.sortedLastIndex=vv,v.sortedLastIndexBy=wv,v.sortedLastIndexOf=Sv,v.startCase=sx,v.startsWith=ox,v.subtract=Zx,v.sum=Qx,v.sumBy=e5,v.template=ax,v.times=Fx,v.toFinite=zn,v.toInteger=re,v.toLength=Np,v.toLower=lx,v.toNumber=Kt,v.toSafeInteger=lS,v.toString=_e,v.toUpper=ux,v.trim=cx,v.trimEnd=fx,v.trimStart=hx,v.truncate=dx,v.unescape=px,v.uniqueId=Bx,v.upperCase=mx,v.upperFirst=$u,v.each=bp,v.eachRight=_p,v.first=pp,Wu(v,function(){var s={};return yn(v,function(l,c){we.call(v.prototype,c)||(s[c]=l)}),s}(),{chain:!1}),v.VERSION=r,$t(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){v[s].placeholder=v}),$t(["drop","take"],function(s,l){ce.prototype[s]=function(c){c=c===t?1:Be(re(c),0);var d=this.__filtered__&&!l?new ce(this):this.clone();return d.__filtered__?d.__takeCount__=ot(c,d.__takeCount__):d.__views__.push({size:ot(c,qe),type:s+(d.__dir__<0?"Right":"")}),d},ce.prototype[s+"Right"]=function(c){return this.reverse()[s](c).reverse()}}),$t(["filter","map","takeWhile"],function(s,l){var c=l+1,d=c==en||c==Ve;ce.prototype[s]=function(y){var w=this.clone();return w.__iteratees__.push({iteratee:X(y,3),type:c}),w.__filtered__=w.__filtered__||d,w}}),$t(["head","last"],function(s,l){var c="take"+(l?"Right":"");ce.prototype[s]=function(){return this[c](1).value()[0]}}),$t(["initial","tail"],function(s,l){var c="drop"+(l?"":"Right");ce.prototype[s]=function(){return this.__filtered__?new ce(this):this[c](1)}}),ce.prototype.compact=function(){return this.filter(wt)},ce.prototype.find=function(s){return this.filter(s).head()},ce.prototype.findLast=function(s){return this.reverse().find(s)},ce.prototype.invokeMap=oe(function(s,l){return typeof s=="function"?new ce(this):this.map(function(c){return ds(c,s,l)})}),ce.prototype.reject=function(s){return this.filter(Ho(X(s)))},ce.prototype.slice=function(s,l){s=re(s);var c=this;return c.__filtered__&&(s>0||l<0)?new ce(c):(s<0?c=c.takeRight(-s):s&&(c=c.drop(s)),l!==t&&(l=re(l),c=l<0?c.dropRight(-l):c.take(l-s)),c)},ce.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},ce.prototype.toArray=function(){return this.take(qe)},yn(ce.prototype,function(s,l){var c=/^(?:filter|find|map|reject)|While$/.test(l),d=/^(?:head|last)$/.test(l),y=v[d?"take"+(l=="last"?"Right":""):l],w=d||/^find/.test(l);y&&(v.prototype[l]=function(){var C=this.__wrapped__,M=d?[1]:arguments,O=C instanceof ce,P=M[0],D=O||ne(C),F=function(le){var he=y.apply(v,nr([le],M));return d&&W?he[0]:he};D&&c&&typeof P=="function"&&P.length!=1&&(O=D=!1);var W=this.__chain__,J=!!this.__actions__.length,Z=w&&!W,se=O&&!J;if(!w&&D){C=se?C:new ce(this);var Q=s.apply(C,M);return Q.__actions__.push({func:Fo,args:[F],thisArg:t}),new Vt(Q,W)}return Z&&se?s.apply(this,M):(Q=this.thru(F),Z?d?Q.value()[0]:Q.value():Q)})}),$t(["pop","push","shift","sort","splice","unshift"],function(s){var l=lo[s],c=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",d=/^(?:pop|shift)$/.test(s);v.prototype[s]=function(){var y=arguments;if(d&&!this.__chain__){var w=this.value();return l.apply(ne(w)?w:[],y)}return this[c](function(C){return l.apply(ne(C)?C:[],y)})}}),yn(ce.prototype,function(s,l){var c=v[l];if(c){var d=c.name+"";we.call(di,d)||(di[d]=[]),di[d].push({name:l,func:c})}}),di[Oo(t,x).name]=[{name:"wrapper",func:t}],ce.prototype.clone=p2,ce.prototype.reverse=m2,ce.prototype.value=g2,v.prototype.at=qv,v.prototype.chain=Kv,v.prototype.commit=Gv,v.prototype.next=Jv,v.prototype.plant=Yv,v.prototype.reverse=Xv,v.prototype.toJSON=v.prototype.valueOf=v.prototype.value=Zv,v.prototype.first=v.prototype.head,ss&&(v.prototype[ss]=jv),v},ci=Gb();Mr?((Mr.exports=ci)._=ci,Vl._=ci):Qe._=ci}).call(sI)}(js,js.exports)),js.exports}var ay=oI();function ih(n){return n.type.create(ay.cloneDeep(n.attrs))}const aI=De.create({name:"node_processor",addCommands(){return{setBlockAttributes:B(({commands:n,state:e},t,r,i={})=>{const o=H(n.getBlockAttributes(t))??{},{doc:a,tr:u}=e,{from:f,to:h}=u.selection;a.nodesBetween(f,h,(m,p)=>{ie.blocks.includes(m.type.name)&&u.setNodeAttribute(p,t,{...i,...o,...r})})}),getBlockAttributes:B(({editor:n},e,t)=>me(()=>{let r=Object.assign({},t||{});for(const i of ie.blocks)Object.assign(r,n.getAttributes(i)?.[e]||{});return Object.keys(r).length?r:null})),removeBlockAttributes:B(({commands:n},e)=>{for(const t of ie.blocks)n.resetAttributes(t,e)}),applyMark:B(({state:n,commands:e},t,r,i={})=>{const{tr:o,doc:a,schema:u}=n,{$from:f,$to:h}=o.selection,m=wn(de.LINK,u),p=wn(t,u);if(!(p.spec.group||"").includes(dn.SETTINGS))return e.setMark(t,r);if(f.pos===h.pos)return;const S=E=>{if(!i.onAppliedToParent||i.onAppliedToParent(E)===!1){const{tr:g,node:_,position:x,mark:k}=E;e._removeNodeMark({tr:g,node:_,position:x,mark:k.type})}};a.nodesBetween(f.pos,h.pos,(E,g)=>{if(E.type.name===ie.LIST)return;const _=iI(E.marks,t),x=p.create({..._?.attrs||{},...r}),k=iy(f,h,E,g);if(!m.isInSet(E.marks)&&rI(o.doc,g,x,i.isAppliedToParent))return S({tr:o,node:E,position:g,mark:x});if(E.isText){o.addMark(k.from,k.to,x);return}tI(o.doc,o.selection,E,g)&&o.addNodeMark(g,x)})}),getMarks:B(({editor:n},e)=>{const t=xi(n,"state");return me(()=>{const{selection:r,doc:i}=H(t),{from:o,to:a}=H(r),u=[];return i.nodesBetween(o,a,f=>{for(const h of f.marks)h.type.name===e&&u.unshift(h.attrs)}),u})}),getMark:B(({commands:n},e)=>{const t=n.getMarks(e);return me(()=>H(t)[0]??null)}),hasMark:B(({commands:n},e)=>{const t=n.getMark(e);return me(()=>!!H(t))}),getCommonSettingMark:B(({commands:n},e,t)=>{const r=n.getMark(e);return me(()=>H(r)?.value??H(t))}),getDeviceSettingMark:B(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return me(()=>{for(const o of H(r)){const a=o[H(i)];if(a)return a}return H(t)})}),removeAllMarks:B(({state:n,commands:e})=>{const{tr:t,doc:r}=n,{from:i,to:o}=t.selection;r.nodesBetween(i,o,(a,u)=>{for(const f of a.marks)e._removeNodeMark({tr:t,node:a,position:u,mark:f})})}),removeMarks:B(({state:n,commands:e},t)=>{const{tr:r,doc:i}=n,{from:o,to:a}=r.selection;i.nodesBetween(o,a,(u,f)=>{const h=u.marks.filter(m=>t.includes(m.type.name));for(const m of h)e._removeNodeMark({tr:r,node:u,position:f,mark:m})})}),_removeNodeMark:B((n,{tr:e,node:t,position:r,mark:i})=>t.isText?e.removeMark(r,r+t.nodeSize,i):e.removeNodeMark(r,i))}}}),lI=De.create({name:"text_processor",addCommands(){return{getSelectedText:B(({state:n})=>{const{from:e,to:t}=n.selection;return n.doc.textBetween(e,t," ")}),transformText:B(({state:n},e)=>{const{$from:t,$to:r}=n.tr.selection;t.pos!==r.pos&&n.doc.nodesBetween(t.pos,r.pos,(i,o)=>{if(!i.isText)return;const a=iy(t,r,i,o),u=Math.max(0,t.pos-o),f=Math.max(0,r.pos-o),h=e({text:i.textContent.substring(u,f)}),m=n.schema.text(h,i.marks);n.tr.replaceWith(a.from,a.to,m)})})}}}),uI=De.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:B(({state:n})=>{this.storage.selection=n.selection}),restoreSelection:B(({commands:n})=>{this.storage.selection&&n.setTextSelection(this.storage.selection)}),expandSelection:B(({tr:n,commands:e},t)=>{let r=n.selection.from,i=n.selection.to;n.doc.nodesBetween(r,i,(o,a,u)=>{if(t({node:o,parent:u})){const f=o.isText?0:sy(n.doc,a);r=Math.min(r,a+f),i=Math.max(i,a+o.nodeSize-f)}}),e.setTextSelection({from:r,to:i})}),expandSelectionToBlock:B(({commands:n})=>{n.expandSelection(({parent:e})=>e.type.name===ie.DOCUMENT)})}}}),cI=Xn.create({name:"doc",topNode:!0,content:"block+"});class Xs extends lt{constructor(e,t,r,i="SetDocAttr"){super(),this.key=e,this.value=t,this.schema=r,this.stepType=i}apply(e){this.prevValue=e.attrs.meta[this.key];const t=Wr.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,Fe.ok(t)}invert(){return new Xs(this.key,this.prevValue,this.schema,"revertSetDocAttr")}map(){return null}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}static fromJSON(e){return new Xs(e.key,e.value,e.stepType)}}lt.jsonID("setDocAttr",Xs);const fI=cI.extend({marks:dn.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",n=>{n.target.closest("a")&&n.preventDefault()})},addCommands(){return{setDocMetaAttributes:B(({state:n},e,t)=>{n.tr.step(new Xs(e,t,n.schema))})}}}),hI=Xn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Fi(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),dI=hI.extend({marks:dn.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),pI=Xn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Fi(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>GM({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),mI=pI.extend({marks:dn.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),gI=De.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[oT.create(this.editor),aT.create(this.editor)]}}),yI=()=>[fI,dI,mI,YM,sT,aI,lI,uI,gI],bI=Pt.create({name:de.FONT_FAMILY,group:dn.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:B(({commands:n},e)=>{n.applyMark(this.name,{value:e});const t=n.findFontByName(e);let r=H(n.getFontWeight());t.isWeightSupported(r)||(r=t.findClosestWeight(r),n.applyFontWeight(r));const i=n.isSettingCustomized(de.FONT_STYLE).value;!t.isItalicSupported(r)&&i&&n.removeItalic()}),getFont:B(({commands:n})=>{const e=H(this.options.defaultPreset),t=n.findFontByName(e.common.font_family),r=n.getFontFamily();return me(()=>n.findFontByName(H(r))||t)}),findFontByName:B((n,e)=>H(this.options.fonts).find(t=>t.name===e)??this.options.defaultFont),getFontFamily:B(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontFamily())),getDefaultFontFamily:B(({commands:n})=>{const e=n.getPreset();return me(()=>H(e).common.font_family)})}},parseHTML(){const n=e=>({value:e.replace(/["']/g,"")});return[{style:"--zw-font-family",getAttrs:n},{style:"font-family",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.value?`"${n.value}"`:null;return Qr({font_family:e})}}),_I=De.create({name:de.STYLE_PRESET,addGlobalAttributes(){return[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{preset:{isRequired:!1,default:{id:H(this.options.defaultId)},parseHTML:n=>{const e=H(this.options.presets);if(n.parentElement.tagName==="LI")return null;for(const{id:t,node:r,fallbackClass:i}of e){if(i&&n.classList.contains(i))return{id:t};const o=H(this.options.styleRenderer).makePresetCssClass({id:t});if(n.matches(o))return{id:t};if(n.tagName===`H${r?.level}`)return{id:t}}return n.tagName==="P"?{id:H(this.options.defaultId)}:null},renderHTML:n=>n.preset?{class:H(this.options.styleRenderer).makePresetHtmlClass(n.preset)}:null}}}]},addCommands(){function n(t,r){return t.find(i=>r===i.id)}function e(t,r){const i={};for(const o of Object.keys(t)){const a=t[o],u=r[o],f=!u||u.toLowerCase()==="inherit";i[o]=f?a:u}return i}return{getPresetList:B(()=>me(()=>H(this.options.presets).filter(t=>!t.hidden))),getPreset:B(({commands:t})=>{const r=t.getBlockAttributes("preset",{id:H(this.options.defaultId)}),i=t.getPresetList(),o=t.isLink(),a=t.getLinkPreset();return me(()=>{const u=n(H(i),H(r).id);if(!H(o))return u;const f=H(a);return{id:u.id,common:e(u.common,f.common),mobile:e(u.mobile,f.mobile),tablet:e(u.tablet,f.tablet),desktop:e(u.desktop,f.desktop)}})}),applyPreset:B(({commands:t,chain:r},i)=>{const o=H(t.getPresetList()),a=n(o,i),u=a.node?.type??ie.PARAGRAPH,f={preset:{id:i}};a.node&&(f.level=a.node.level);for(const h of de.attributes)f[h]=H(t.getBlockAttributes(h));r().removeList().setNode(u,f).run()}),applyDefaultPreset:B(({commands:t})=>{t.applyPreset(H(this.options.defaultId))}),removePreset:B(({commands:t})=>{t.setNode(ie.PARAGRAPH,{preset:null})}),getPresetCustomization:B(({editor:t,commands:r})=>{const i=xi(t,"state");return me(()=>{const{selection:o,doc:a}=H(i),{from:u,to:f}=o;return r._getSettingCustomization(a,u,f)})}),isSettingCustomized:B(({commands:t},r)=>{const i=t.getPresetCustomization(),o=de.presetAttributes.includes(r)?"attributes":"marks";return me(()=>H(i)[o]?.includes(r)??!1)}),getContentCustomization:B(({editor:t,commands:r})=>{const i=xi(t,"state");return me(()=>{const{doc:o}=H(i);return r._getSettingCustomization(o,0,o.content.size)})}),_getSettingCustomization:B((t,r,i,o)=>{const a=new Set,u=new Set;return r.nodesBetween(i,o,f=>{for(const[h,m]of Object.entries(f.attrs))de.presetAttributes.includes(h)&&m&&u.add(h);for(const{type:h}of f.marks)de.marks.includes(h.name)&&a.add(h.name)}),{attributes:Array.from(u),marks:Array.from(a)}}),removePresetCustomization:B(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(de.marks).resetAttributes(ie.PARAGRAPH,de.presetAttributes).resetAttributes(ie.HEADING,de.presetAttributes).restoreSelection().run()}),removeFormat:B(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()})}},onCreate(){this.options.styleRenderer.inject(Ki.head,H(this.options.presets))}}),vI=Pt.create({name:de.FONT_WEIGHT,group:dn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:B(({commands:n},e)=>{n.applyMark(this.name,{value:e}),H(n.getFont()).isItalicSupported(e)||n.removeItalic()}),toggleBold:B(({commands:n})=>{const e=H(n.getFontWeight()),t=H(n.getFont()),i=Number(e)>=600?"400":"700",o=t.findClosestWeight(i);n.applyFontWeight(o)}),getFontWeight:B(({commands:n})=>{const e=n.getCommonSettingMark(this.name,n.getDefaultFontWeight()),t=n.getFont();return me(()=>{const r=H(e),i=H(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:B(({commands:n})=>{const e=n.getPreset();return me(()=>H(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Zt("toggleBold"),"Mod-B":Zt("toggleBold")}),parseHTML(){const n=e=>e==="bold"?{value:"700"}:Number(e)?{value:e}:!1;return[{style:"--zw-font-weight",getAttrs:n},{style:"font-weight",getAttrs:n},{tag:"b",attrs:{value:"700"}},{tag:"strong",attrs:{value:"700"}}]},renderHTML({HTMLAttributes:n}){return Qr({font_weight:n.value})}}),wI=Pt.create({name:de.FONT_SIZE,group:dn.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes(){return{mobile:{default:null},tablet:{default:null},desktop:{default:null}}},addCommands(){return{getFontSize:B(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultFontSize())),getDefaultFontSize:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>H(t)[H(e)].font_size.replace("px",""))}),applyFontSize:B(({commands:n},e)=>{const t=H(n.getDevice());n.applyMark(this.name,{[t]:e},{isAppliedToParent:(r,i)=>r.type.name!==i.type.name?!1:r.attrs[t]===i.attrs[t],onAppliedToParent:({tr:r,node:i,position:o,mark:a})=>{const u={...a.attrs,[t]:null};if(!Object.values(u).some(m=>!!m))return!1;const h=a.type.create(u);if(i.isText){r.addMark(o,o+i.nodeSize,h);return}r.addNodeMark(o,h)}})}),increaseFontSize:B(({commands:n})=>{const e=Number(H(n.getFontSize())),t=Math.min(e+1,H(this.options.maxSize));n.applyFontSize(String(t))}),decreaseFontSize:B(({commands:n})=>{const e=Number(H(n.getFontSize())),t=Math.max(e-1,H(this.options.minSize));n.applyFontSize(String(t))})}},addKeyboardShortcuts:()=>({"Mod-Shift-=":Zt("increaseFontSize"),"Mod-Shift--":Zt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=H(this.options.wrapperRef),r=ry(e,t);return String(r)};return[{tag:'[style*="--zw-font-size"]',getAttrs:({style:e})=>({mobile:n(e.getPropertyValue("--zw-font-size-mobile")),tablet:n(e.getPropertyValue("--zw-font-size-tablet")),desktop:n(e.getPropertyValue("--zw-font-size-desktop"))})},{style:"font-size",getAttrs:e=>{const t=n(e);return{desktop:t,tablet:t,mobile:null}}}]},renderHTML({HTMLAttributes:n}){const e=t=>t?`${t}px`:null;return Qr({font_size_mobile:e(n.mobile),font_size_tablet:e(n.tablet),font_size_desktop:e(n.desktop)})}}),SI=Pt.create({name:de.FONT_COLOR,group:dn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:B(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontColor())),getDefaultFontColor:B(({commands:n})=>{const e=n.getPreset();return me(()=>H(e).common.color)}),applyFontColor:B(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:ny(e)});return[{style:"--zw-font-color",getAttrs:n},{style:"color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Qr({font_color:n.value})}}),xI=Pt.create({name:de.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:B(({commands:n})=>n.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)")),applyBackgroundColor:B(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:ny(e)});return[{style:"--zw-background-color",getAttrs:n},{style:"background-color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Qr({background_color:n.value})}}),EI=De.create({name:"device_manager",addCommands(){return{getDevice:B(()=>xi(this.options,"device"))}}}),CI=Pt.create({name:de.FONT_STYLE,group:dn.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:B(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return me(()=>H(e)?.italic??H(t).italic)}),isItalicAvailable:B(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return me(()=>{const r=H(e),i=H(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:B(({commands:n})=>{const e=n.getPreset();return me(()=>({italic:H(e).common.font_style==="italic"}))}),toggleItalic:B(({commands:n})=>{H(n.isItalicAvailable())&&(H(n.isItalic())?n.removeItalic():n.applyItalic())}),applyItalic:B(({commands:n})=>{n.applyMark(this.name,{italic:!0})}),removeItalic:B(({commands:n})=>{n.applyMark(this.name,{italic:!1})})}},addKeyboardShortcuts:()=>({"Mod-i":Zt("toggleItalic"),"Mod-I":Zt("toggleItalic")}),parseHTML(){const n=e=>({italic:e.includes("italic")});return[{tag:"i",attrs:{italic:!0}},{style:"--zw-font-style",getAttrs:n},{style:"font-style",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.italic?"italic":"normal";return Qr({font_style:e})}}),kI=Pt.create({name:de.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:B(({commands:n})=>{const e=n.getTextDecoration();return me(()=>H(e).underline)}),isStrikeThrough:B(({commands:n})=>{const e=n.getTextDecoration();return me(()=>H(e).strike_through)}),getTextDecoration:B(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return me(()=>{const r=H(e)??{},i=H(t);return{underline:r.underline||i.underline,strike_through:r.strike_through||i.strike_through}})}),isUnderlineCustomized:B(({commands:n})=>{const e=n.isUnderline(),t=n.getDefaultTextDecoration();return me(()=>H(e)!==H(t).underline)}),getDefaultTextDecoration:B(({commands:n})=>{const e=n.getPreset();return me(()=>{const{text_decoration:t}=H(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}})}),toggleUnderline:B(({commands:n})=>{n.toggleTextDecoration("underline")}),toggleStrikeThrough:B(({commands:n})=>{n.toggleTextDecoration("strike_through")}),toggleTextDecoration:B(({commands:n},e,t=null)=>{const r=H(n.getTextDecoration()),i=t??!r[e];n.applyMark(this.name,{[e]:i})}),applyTextDecoration:B(({commands:n},e)=>{n.toggleTextDecoration(e,!0)}),removeTextDecoration:B(({commands:n},e)=>{n.toggleTextDecoration(e,!1)})}},addKeyboardShortcuts:()=>({"Mod-u":Zt("toggleUnderline"),"Mod-U":Zt("toggleUnderline")}),parseHTML(){const n=e=>{const t=e.includes("underline"),r=e.includes("line-through");return!t&&!r?!1:{underline:t,strike_through:r}};return[{style:"--zw-text-decoration",getAttrs:n},{style:"text-decoration-line",getAttrs:n},{style:"text-decoration",getAttrs:n},{tag:"s",attrs:{underline:!1,strike_through:!0}},{tag:"u",attrs:{underline:!0,strike_through:!1}}]},renderHTML({HTMLAttributes:n}){const e=[];return n.underline&&e.push("underline"),n.strike_through&&e.push("line-through"),e.length||e.push("none"),Qr({text_decoration:e.join(" ")})}}),AI=De.create({name:"case_style",addCommands(){return{applyCaseStyle:B(({commands:n},e)=>{switch(e){case Sf.CAPITALIZE:return n.applyCapitalize();case Sf.LOWERCASE:return n.applyLowerCase();case Sf.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:B(({commands:n})=>{n.transformText(({text:e})=>MT(e))}),applyLowerCase:B(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:B(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),ly={mobile:null,tablet:null,desktop:null},MI=De.create({name:de.ALIGNMENT,addGlobalAttributes:()=>[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{[de.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=eI(n.textAlign);if(e)return{desktop:e,tablet:e,mobile:e};const t=n.getPropertyValue("--zw-alignment-mobile")||null,r=n.getPropertyValue("--zw-alignment-tablet")||null,i=n.getPropertyValue("--zw-alignment-desktop")||null;return!t&&!r&&!i?null:{desktop:i,tablet:r,mobile:t}},renderHTML(n){return n.alignment?cl({alignment_mobile:n.alignment.mobile,alignment_tablet:n.alignment.tablet,alignment_desktop:n.alignment.desktop}):null}}}}],addCommands(){return{applyAlignment:B(({commands:n},e)=>{const t=H(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},ly)}),removeAlignment:B(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:B(({commands:n})=>{const e=n.getBlockAttributes(this.name,ly),t=n.getDevice(),r=n.getDefaultAlignment();return me(()=>H(e)?.[H(t)]??H(r))}),getDefaultAlignment:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>H(t)[H(e)].alignment??wr.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Zt("applyAlignment",wr.LEFT),"Mod-Shift-e":Zt("applyAlignment",wr.CENTER),"Mod-Shift-r":Zt("applyAlignment",wr.RIGHT),"Mod-Shift-j":Zt("applyAlignment",wr.JUSTIFY)})}),uy={mobile:null,tablet:null,desktop:null},TI=De.create({name:de.LINE_HEIGHT,addGlobalAttributes(){return[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{[de.LINE_HEIGHT]:{isRequired:!1,parseHTML:n=>{if(n.matches('[style*="--zw-line-height"]')){const o=n.style.getPropertyValue("--zw-line-height-tablet")||null,a=n.style.getPropertyValue("--zw-line-height-desktop")||null;return{mobile:null,tablet:o,desktop:a}}const e=n.style.lineHeight;if(!e)return null;const t=H(this.options.wrapperRef),r=ZO(e,n,t);return r?{desktop:r,tablet:r,mobile:null}:null},renderHTML(n){return n.line_height?cl({line_height_mobile:n.line_height.mobile,line_height_tablet:n.line_height.tablet,line_height_desktop:n.line_height.desktop}):null}}}}]},addCommands(){return{getLineHeight:B(({commands:n})=>{const e=n.getBlockAttributes(this.name,uy),t=n.getDevice(),r=n.getDefaultLineHeight();return me(()=>H(e)?.[H(t)]??H(r))}),getDefaultLineHeight:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>H(t)[H(e)].line_height)}),applyLineHeight:B(({commands:n},e)=>{const t=H(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},uy)})}}}),OI=Xn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Fi(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),II=OI.extend({name:ie.LIST_ITEM,marks:dn.SETTINGS,addCommands(){const n=({selection:e})=>e.$cursor.before(e.$cursor.depth-1);return{listItemNewline:B(({commands:e,tr:t})=>{const r=t.doc.nodeAt(n(t));if(!t.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const o=n(t);for(const a of r.marks)t.addNodeMark(o,ih(a));return!0})}},addOptions:()=>({HTMLAttributes:{class:"zw-style"}}),addKeyboardShortcuts:()=>({Enter:n=>{const{state:e,commands:t}=n.editor;if(e.selection.$cursor?.path.some(i=>i.type?.name===ie.LIST))return t.listItemNewline()}})}),NI=Xn.create({name:ie.LIST,content:`${ie.LIST_ITEM}+`,group:"block list",marks:dn.SETTINGS,addExtensions:()=>[II],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:Yt.DISC}}}),parseHTML(){const n={a:Yt.ROMAN,i:Yt.LATIN,1:Yt.DECIMAL},e=t=>{for(const r of Yt.values){const i=`.${H(this.options.baseClass)}${r}`;if(t.matches(i)||n[t.type.toLowerCase()]===r)return r}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||Yt.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||Yt.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[H(this.options.baseClass)+n.bullet.type,H(this.options.presetClass)];return[Yt.ordered.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:B(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return me(()=>H(e).type??null)}),applyList:B(({commands:n,chain:e},t)=>{if(H(n.getListType())===t){n.removeList();return}return e().applyDefaultPreset().toggleList(ie.LIST,ie.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({commands:i,tr:o})=>i._bubbleListItemMarks(o)).run()}),_bubbleListItemMarks:B((n,e)=>{const{doc:t,selection:r}=e,i=r.$from.start(),o=r.$to.end();function a(u,f){if(de.inlineMarks.includes(f.type)||f.type.isInSet(u.marks))return!1;for(const h of u.content.content)if(h.childCount&&(!h.marks||!f.isInSet(h.marks)))return!1;return!0}t.nodesBetween(i,o,(u,f)=>{if(u.type.name===ie.LIST)return;if(u.type.name!==ie.LIST_ITEM)return!1;const h=[];return u.forEach(m=>{for(const p of m.marks){if(p.isInSet(h)){e.removeNodeMark(f+1,p);continue}a(u,p)&&(e.removeNodeMark(f+1,p),e.addNodeMark(f,ih(p)),h.push(p))}}),!1})}),removeList:B(({commands:n,state:e})=>{const{tr:t,doc:r,selection:i}=e,o=i.$from.start(),a=i.$to.end();r.nodesBetween(o,a,(u,f,h)=>{if([ie.LIST,ie.LIST_ITEM].includes(u.type.name))return;if(h.type.name!==ie.LIST_ITEM)return!1;const m=h.marks.filter(function(p){return!p.type.isInSet(u.marks)});for(const p of m)t.addNodeMark(f,ih(p));return!1}),n.liftListItem(ie.LIST_ITEM)})}},addInputRules(){const n=(e,t)=>JM({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(Yt.DISC,/^\s*([-+*])\s$/),n(Yt.DECIMAL,/^(\d+)\.\s$/),n(Yt.LATIN,/^([ivx]{1,3})\.\s$/i),n(Yt.ROMAN,/^([a-z])\.\s$/i)]}});function RI(n){return new Rt({key:new fn("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),o=e.some(h=>h.getMeta("preventAutolink"));if(!i||o)return;const{tr:a}=r,u=gM(t.doc,[...e]);if(CM(u).forEach(({newRange:h})=>{const m=bM(r.doc,h,S=>S.isTextblock);let p,b;if(m.length>1?(p=m[0],b=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):m.length&&r.doc.textBetween(h.from,h.to," "," ").endsWith(" ")&&(p=m[0],b=r.doc.textBetween(p.pos,h.to,void 0," ")),p&&b){const S=b.split(" ").filter(_=>_!=="");if(S.length<=0)return!1;const E=S[S.length-1],g=p.pos+b.lastIndexOf(E);if(!E)return!1;Vf(E).filter(_=>_.isLink).map(_=>({..._,from:g+_.start+1,to:g+_.end+1})).filter(_=>r.schema.marks.code?!r.doc.rangeHasMark(_.from,_.to,r.schema.marks.code):!0).filter(_=>n.validate?n.validate(_.value):!0).forEach(_=>{I0(_.from,_.to,r.doc).some(x=>x.mark.type===n.type)||a.addMark(_.from,_.to,n.type.create({href:_.href}))})}}),!!a.steps.length)return a}})}function LI(n){return new Rt({key:new fn("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||r.target.nodeName!=="A")return!1;const u=SM(e.state,n.type.name),f=r.target,h=(i=f?.href)!==null&&i!==void 0?i:u.href,m=(o=f?.target)!==null&&o!==void 0?o:u.target;return f&&h?(e.editable&&window.open(h,m),!0):!1}}})}function PI(n){return new Rt({key:new fn("handlePasteLink"),props:{handlePaste:(e,t,r)=>{var i;const{state:o}=e,{selection:a}=o,{empty:u}=a;if(u)return!1;let f="";r.content.forEach(E=>{f+=E.textContent});const h=Vf(f).find(E=>E.isLink&&E.value===f);if(!f||!h)return!1;const m=(i=t.clipboardData)===null||i===void 0?void 0:i.getData("text/html"),p=/href="([^"]*)"/,b=m?.match(p),S=b?b[1]:h.href;return n.editor.commands.setMark(n.type,{href:S}),!0}}})}const DI=Pt.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){t1(n);return}t1(n.scheme,n.optionalSlashes)})},onDestroy(){ET()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",Fi(this.options.HTMLAttributes,{...n,href:""}),0]:["a",Fi(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[jM({find:n=>Vf(n).filter(e=>this.options.validate?this.options.validate(e.value):!0).filter(e=>e.isLink).map(e=>({text:e.value,index:e.start,data:e})),type:this.type,getAttributes:(n,e)=>{var t,r;const i=(t=e?.clipboardData)===null||t===void 0?void 0:t.getData("text/html"),o=/href="([^"]*)"/,a=i?.match(o);return a?{href:a[1]}:{href:(r=n.data)===null||r===void 0?void 0:r.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(RI({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(LI({type:this.type})),this.options.linkOnPaste&&n.push(PI({editor:this.editor,type:this.type})),n}}),FI=DI.extend({name:de.LINK,addOptions(){return{...this.parent?.(),openOnClick:!1,linkOnPaste:!1}},addAttributes(){return{href:{default:null,parseHTML:n=>{const e=n.getAttribute("href");return e.startsWith("#")?parseFloat(n.getAttribute("href").replace("#","")):e}},target:{default:H0.SELF,parseHTML:n=>n.getAttribute("target")||H0.SELF},destination:{default:Bs.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Bs.URL;const t=e.replace("#","");return H(this.options.pageBlocks).find(o=>o.id===parseInt(t))?Bs.BLOCK:Bs.URL}}}},addCommands(){const{unsetLink:n}=this.parent();return{removeLink:n,applyLink:B(({commands:e,chain:t},r)=>(e.setMeta("preventAutolink",!0),e.getSelectedText()?t().applyMark(this.name,r).expandSelectionToLink().command(({tr:i})=>(r.text&&i.insertText(r.text,i.selection.from,i.selection.to),!0)).run():e.insertContent(fy.text(r.text,[fy.mark(de.LINK,r)])))),expandSelectionToLink:B(({commands:e})=>{e.expandSelection(({node:t})=>this.type.isInSet(t.marks))}),isLink:B(({commands:e})=>e.hasMark(this.name)),getLinkPreset:B(()=>me(()=>H(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),AT.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Bs.BLOCK?`#${n.href}`:n.href,t=H(this.options.basePresetClass)+H(this.options.preset).id;return["a",{href:e,target:n.target,class:`${t} zw-style`},0]}}),zI=Pt.create({name:de.SUPERSCRIPT,addCommands(){return{applySuperscript:B(({commands:n})=>{n.setMark(this.name)}),removeSuperscript:B(({commands:n})=>{n.unsetMark(this.name)}),toggleSuperscript:B(({commands:n})=>{H(n.isSuperscript())?n.removeSuperscript():n.applySuperscript()}),isSuperscript:B(({commands:n})=>{const e=n.getMark(this.name);return me(()=>!!H(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),BI=De.create({name:de.MARGIN,addGlobalAttributes:()=>[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{[de.MARGIN]:{isRequired:!1,parseHTML(n){const{margin:e,marginTop:t,marginRight:r,marginBottom:i,marginLeft:o}=n.style;return[e,t,r,i,o].some(f=>!!f)?e?{value:e}:{value:[t||0,r||0,i||0,o||0].join(" ")}:null},renderHTML(n){return n.margin?cl({margin:n.margin.value}):null}}}}]});function $I(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=hc({default:null,link:null});return PE(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),yI().concat([_I.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new WI({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),NI.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),EI.configure({device:n.deviceRef}),wI.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),bI.configure({fonts:n.fonts,defaultPreset:xi(t,"default"),defaultFont:n.defaultFont}),vI,SI,xI,CI,kI,AI,zI,MI,TI.configure({wrapperRef:n.wrapperRef}),FI.configure({preset:xi(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),BI])}class HI{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class cy{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class kn extends cy{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=kn.BLOCK_NODE_NAMES.concat("UL","OL");static BLOCK_STYLES=["text-align","line-height","margin","margin-top","margin-bottom","margin-left","margin-right"];_parser;constructor({content:e,parser:t}){super({content:e}),this._parser=t,this.dom=null}normalize(){return this.normalizeHTML(),this.normalizedHTML}normalizeHTML(){this.dom=this._parser.parse(this.content.replace(/(\r)?\n/g,"")),this._removeComments(),this._normalizeRootTags(),this._iterateNodes(this._normalizeBreakLines,e=>e.tagName==="BR"),this._iterateNodes(this._removeEmptyNodes,this._isBlockNode),this._iterateNodes(this._normalizeListItems,e=>e.tagName==="LI"),this._normalizeBlockTextDecoration(),this._normalizeBlockBackgroundColor()}get normalizedHTML(){return this.dom.body.innerHTML}get _NodeFilter(){return this._parser.types.NodeFilter}get _Node(){return this._parser.types.Node}_removeComments(){const e=this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);this._runIterator(e,t=>t.remove())}_normalizeRootTags(){const e=Array.from(this.dom.body.childNodes),t=this.dom.createDocumentFragment();let r;for(const i of e){if(this._isRootNode(i)){t.append(i),r=null;continue}r||(r=this.dom.createElement("p"),t.append(r)),r.append(i)}this.dom.body.innerHTML="",this.dom.body.append(t)}_createNodeIterator(e,t){return this.dom.createNodeIterator(this.dom.body,e,t)}_iterateNodes(e,t=()=>!0){const r=o=>o.tagName!=="BODY"&&t.call(this,o),i=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:o=>r(o)?this._NodeFilter.FILTER_ACCEPT:this._NodeFilter.FILTER_REJECT});this._runIterator(i,e)}_runIterator(e,t){let r=e.nextNode();for(;r;)t.call(this,r),r=e.nextNode()}_removeEmptyNodes(e){e.innerHTML.trim()||e.remove()}_normalizeListItems(e){const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes);let i,o;const a=u=>{this._assignElementProperties(u,e,kn.BLOCK_STYLES),t.append(u)};this._assignElementProperties(e,e.parentElement,kn.BLOCK_STYLES);for(const u of r){if(this._isBlockNode(u)){a(u),i=null,o=u;continue}if(u.tagName==="BR"&&o&&o?.tagName!=="BR"){u.remove(),o=u;continue}if(u.tagName==="BR"){const f=this.dom.createElement("p");f.append(u),a(f),i=null,o=u;continue}i||(i=this.dom.createElement("p"),a(i)),i.append(u),o=u}e.append(t),this._removeStyleProperties(e,kn.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,kn.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return kn.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return kn.ROOT_NODE_NAMES.includes(e.tagName)}_assignElementProperties(e,t,r=Array.from(t.style)){for(const i of r){const o=t.style.getPropertyValue(i);o&&!e.style.getPropertyValue(i)&&e.style.setProperty(i,o)}}_removeStyleProperties(e,t=Array.from(e.style)){for(const r of t)e.style.removeProperty(r);e.style.length===0&&e.removeAttribute("style")}_normalizeBreakLines({parentElement:e}){if(!this._isBlockNode(e)||!e.textContent)return;const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes),i=e.cloneNode(!0);i.innerHTML="";let o=i.cloneNode();const a=u=>{this._assignElementProperties(u,e,kn.BLOCK_STYLES),t.append(u)};for(const u of r){if(u.tagName==="BR"){a(o),o=i.cloneNode();continue}o.append(u)}t.append(o),e.replaceWith(t)}_normalizeBlockTextDecoration(){const e=this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveTextDecorationToChildren(t)}_moveTextDecorationToChildren(e){const t=this._parseTextDecoration(e);if(e.style.removeProperty("text-decoration-line"),e.style.removeProperty("text-decoration"),e.style.cssText||e.removeAttribute("style"),!t.none)for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=this._parseTextDecoration(i),a={underline:o.underline||t.underline,line_through:o.line_through||t.line_through};i.style.removeProperty("text-decoration-line"),i.style.removeProperty("text-decoration"),i.style.textDecoration=Object.entries(a).filter(([,u])=>u).map(([u])=>u.replace("_","-")).join(" ")}}_parseTextDecoration(e){const{textDecoration:t,textDecorationLine:r}=e.style,i=t||r||"";return{none:i.includes("none"),underline:i.includes("underline"),line_through:i.includes("line-through")}}_normalizeBlockBackgroundColor(){const e=this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveBackgroundColorToChildren(t)}_moveBackgroundColorToChildren(e){const t=e.style.backgroundColor;e.style.removeProperty("background-color"),e.style.cssText||e.removeAttribute("style");for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=i.style.backgroundColor||t;i.style.backgroundColor=o}}_wrapTextNode(e,t){if(t.nodeType!==this._Node.TEXT_NODE)return t;const r=this.dom.createElement("span");return r.append(t.cloneNode()),e.replaceChild(r,t),r}}class VI extends cy{normalize(){return this._iterateNodes(this._bubbleMarks),this.content}_iterateNodes(e){this._iterateChildNodes(this.content,e)}_iterateChildNodes(e,t){for(const r of e.content)r.content&&this._iterateChildNodes(r,t),t.call(this,r)}_bubbleMarks(e){if(e.content&&e.type!==ie.LIST){for(const t of e.content)if(!this._isLink(t)&&t.marks)for(const r of t.marks.slice()){if(this._includesMark(e,r)){this._removeMark(t,r);continue}this._canBubbleMark(e,r)&&(this._removeMark(t,r),this._addMark(e,r))}}}_canBubbleMark(e,t){if(de.inlineMarks.includes(t.type)||this._includesMarkType(e,t.type))return!1;for(const r of e.content)if(!(!r.content&&e.type===ie.LIST_ITEM)&&(!r.marks||!this._includesMark(r,t)))return!1;return!0}_includesMark(e,t){return e.marks?.some(r=>ay.isEqual(r,t))??!1}_includesMarkType(e,t){return e.marks?.some(r=>r.type===t)??!1}_isLink(e){return e.type===ie.TEXT&&this._includesMarkType(e,de.LINK)}_removeMark(e,t){if(!e.marks)return;const r=this._findMarkIndexByType(e,t.type);r>=0&&e.marks.splice(r,1),e.marks.length||delete e.marks}_addMark(e,t){this._removeMark(e,t),e.marks??=[],e.marks.push(t)}_findMarkIndexByType(e,t){return e.marks?.findIndex(r=>r.type===t)??null}}class El{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new kn({content:e,parser:t.parser||new HI})}static _buildJson(e){return new VI({content:e})}static normalize(e,t={}){return El.build(e,t).normalize()}}class Ki{static window=globalThis.window;static use(e){this.window=e}static get document(){return this.window.document}static get body(){return this.document.body}static get head(){return this.document.head}static getComputedStyle(e){return this.window.getComputedStyle(e)}}class hh{static build({config:e,nodeDomParser:t}){const r=$I({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:sa(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:sa(wf.DESKTOP),pageBlocksRef:sa([]),wrapperRef:Ki.document.createElement("p")}),i=vM(r);return new hh({schema:i,domParser:Mc.fromSchema(i),nodeDomParser:t})}_schema;_domParser;_nodeDomParser;constructor({schema:e,domParser:t,nodeDomParser:r}){this._schema=e,this._domParser=t,this._nodeDomParser=r}toJSON(e){const t=El.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}class fy{static doc(e){return{type:ie.DOCUMENT,content:e}}static list(e,t){return{type:ie.LIST,attrs:{bullet:{type:e}},content:t.map(r=>r.type===ie.LIST_ITEM?r:this.listItem([].concat(r)))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this._normalizeTextBlockArgs(e);return{type:ie.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[].concat(r).map(o=>typeof o=="string"?this.paragraph(o):o)}}static heading(e,...t){const r=this._textBlock(t,this.text);return r.attrs??={},r.attrs.level=e,{type:ie.HEADING,...r}}static paragraph(...e){return{type:ie.PARAGRAPH,...this._textBlock(e,this.text)}}static _textBlock(e){const{attrs:t,content:r,marks:i}=this._normalizeTextBlockArgs(e);return{content:typeof r=="string"?[this.text(r)]:r,...t?{attrs:t}:{},...i?{marks:i}:{}}}static _normalizeTextBlockArgs(e){return e.length===1?{attrs:null,marks:null,content:e[0]}:e.length===2?{attrs:e[0],marks:null,content:e[1]}:{attrs:e[0],marks:e[1],content:e[2]}}static text(e,t){return{type:ie.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(de.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class WI{_baseClass;_makeVariable;_linkPresetId;constructor({baseClass:e,makeVariable:t,linkPresetId:r}){this._baseClass=e,this._makeVariable=t,this._linkPresetId=r}inject(e,t){let r=e.querySelector("[data-zw-styles]");r||(r=Ki.document.createElement("style"),r.dataset.zwStyles="",r.innerHTML=this.render(t),e.append(r))}render(e){let t="";for(const r of e){const i=r.id===this._linkPresetId,o=this.makePresetCssClass(r);t+=` ${o} {`;for(const a of wf.values)for(const u of Object.keys(r[a])){const f=this._makeVariable({device:a,preset:r,property:u}),h=this._makeInternalVariableName(u,a);if(t+=`${h}: var(${f}, inherit);`,i&&!de.attributes.includes(u)){const m=h.replace("preset-","");t+=`${m}: var(${h});`}}t+="}"}return t}_makeInternalVariableName(e,t){const r=e==="color"?"font-color":e.replace(/_/i,"-"),i=t===wf.COMMON?"":`-${t}`;return`--zw-preset-${r}${i}`}makePresetHtmlClass(e){return this._baseClass+e.id}makePresetCssClass(e){return this.makePresetHtmlClass(e).split(" ").map(t=>`.${t}`).join("")}}class dh{static _instance;static get instance(){return this._instance??=new dh,this._instance}static query(e,t){return this.instance.query(e,t)}query(e,t){let r=null;return e.descendants(i=>{if(r)return!1;if(this.matchNode(i,t))return r=i,!1}),r?t.getMark?this.getMark(r,t.getMark):r:null}matchNode(e,t){return!(t.typeName&&t.typeName!==e.type.name||t.mark&&!this.getMark(e,t.mark))}getMark(e,t){return e.marks.find(r=>this.matchMark(r,t))||null}matchMark(e,t){return e.type.name===t.typeName}}class hy{static createWindow(){return new Kp.JSDOM().window}types;parse(e){const{window:t}=new Kp.JSDOM(e);return this.types=t,t.document}}class dy{name;description;argument;options=[];doCommand(){throw new Error('Command "doCommand" is required')}install(e){if(!this.name)throw new Error('Command "name" is required');let t=e.command(this.name);if(this.description&&(t=t.description(this.description)),this.argument&&(t=t.argument(this.argument)),this.options.length)for(const r of this.options)t=t.option(r.flags,r.description,r.default);t.action(this.doCommand.bind(this))}output(e){}}class UI extends dy{name="to-json";description="migrate html to json";argument="<html...>";options=[{flags:"-c, --config <path>",description:"Generator config",default:qp.resolve(__dirname,"../bin/zp.config.json")},{flags:"-f, --format <type>",description:"Set output format",default:"rb"}];doCommand(e,{config:t,format:r}){Ki.use(hy.createWindow());const i=qp.resolve(process.cwd(),t),o=hh.build({config:require(i).editor,nodeDomParser:new hy}),a=e.map(h=>o.toJSON(this._formatInputHtml(h))),u=a.length===1?a[0]:a,f=this._stringifyContent(u);this.output(r==="rb"?this._formatOutputRb(f):f)}_formatInputHtml(e){return e.replace(/\\(["'])/g,"$1").replace(/rgba\(\d{1,3}, ?\d{1,3}, ?\d{1,3}, (\d{1,2}%)\)/g,(t,r)=>t.replace(r,parseFloat(r)/100))}_stringifyContent(e){return JSON.stringify(e,(r,i)=>i===null?void 0:i,2)}_formatOutputRb(e){return e.replace(/\\"/g,'"').replace(/font-family: ?'(.+)'/g,'font-family: "$1"').replace(/'/g,"\\'").replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm,t=>t.replace(/"/g,"")).replace(/: "(.+)"([,\n])/g,": '$1'$2")}}var qI="4.9.2";class KI extends dy{name="version";description="display cli version";doCommand(){this.output(qI)}}const py=new h5,GI=[UI,KI];for(const n of GI)new n().install(py);py.parse();
59
+ }`;var se=Vp(function(){return be(w,J+"return "+F).apply(t,C)});if(se.source=F,Du(se))throw se;return se}function lx(s){return _e(s).toLowerCase()}function ux(s){return _e(s).toUpperCase()}function cx(s,l,c){if(s=_e(s),s&&(c||l===t))return Xh(s);if(!s||!(l=At(l)))return s;var d=sn(s),y=sn(l),w=Zh(d,y),C=Qh(d,y)+1;return lr(d,w,C).join("")}function fx(s,l,c){if(s=_e(s),s&&(c||l===t))return s.slice(0,td(s)+1);if(!s||!(l=At(l)))return s;var d=sn(s),y=Qh(d,sn(l))+1;return lr(d,0,y).join("")}function hx(s,l,c){if(s=_e(s),s&&(c||l===t))return s.replace(Dl,"");if(!s||!(l=At(l)))return s;var d=sn(s),y=Zh(d,sn(l));return lr(d,y).join("")}function dx(s,l){var c=Et,d=yt;if(Me(l)){var y="separator"in l?l.separator:y;c="length"in l?re(l.length):c,d="omission"in l?At(l.omission):d}s=_e(s);var w=s.length;if(li(s)){var C=sn(s);w=C.length}if(c>=w)return s;var M=c-ui(d);if(M<1)return d;var O=C?lr(C,0,M).join(""):s.slice(0,M);if(y===t)return O+d;if(C&&(M+=O.length-M),Fu(y)){if(s.slice(M).search(y)){var P,D=O;for(y.global||(y=Ql(y.source,_e(_h.exec(y))+"g")),y.lastIndex=0;P=y.exec(D);)var F=P.index;O=O.slice(0,F===t?M:F)}}else if(s.indexOf(At(y),M)!=M){var W=O.lastIndexOf(y);W>-1&&(O=O.slice(0,W))}return O+d}function px(s){return s=_e(s),s&&Cy.test(s)?s.replace(gh,Wb):s}var mx=gi(function(s,l,c){return s+(c?" ":"")+l.toUpperCase()}),$u=Wd("toUpperCase");function Hp(s,l,c){return s=_e(s),l=c?t:l,l===t?zb(s)?Kb(s):Tb(s):s.match(l)||[]}var Vp=oe(function(s,l){try{return Ct(s,t,l)}catch(c){return Du(c)?c:new te(c)}}),gx=Pn(function(s,l){return $t(l,function(c){c=_n(c),Rn(s,c,Lu(s[c],s))}),s});function yx(s){var l=s==null?0:s.length,c=X();return s=l?ke(s,function(d){if(typeof d[1]!="function")throw new Ht(a);return[c(d[0]),d[1]]}):[],oe(function(d){for(var y=-1;++y<l;){var w=s[y];if(Ct(w[0],this,d))return Ct(w[1],this,d)}})}function bx(s){return W2(Wt(s,p))}function Hu(s){return function(){return s}}function _x(s,l){return s==null||s!==s?l:s}var vx=qd(),wx=qd(!0);function wt(s){return s}function Vu(s){return wd(typeof s=="function"?s:Wt(s,p))}function Sx(s){return xd(Wt(s,p))}function xx(s,l){return Ed(s,Wt(l,p))}var Ex=oe(function(s,l){return function(c){return ds(c,s,l)}}),Cx=oe(function(s,l){return function(c){return ds(s,c,l)}});function Wu(s,l,c){var d=Ke(l),y=Co(l,d);c==null&&!(Me(l)&&(y.length||!d.length))&&(c=l,l=s,s=this,y=Co(l,Ke(l)));var w=!(Me(c)&&"chain"in c)||!!c.chain,C=Fn(s);return $t(y,function(M){var O=l[M];s[M]=O,C&&(s.prototype[M]=function(){var P=this.__chain__;if(w||P){var D=s(this.__wrapped__),F=D.__actions__=bt(this.__actions__);return F.push({func:O,args:arguments,thisArg:s}),D.__chain__=P,D}return O.apply(s,nr([this.value()],arguments))})}),s}function kx(){return Qe._===this&&(Qe._=Zb),this}function Uu(){}function Ax(s){return s=re(s),oe(function(l){return Cd(l,s)})}var Mx=wu(ke),Tx=wu(Kh),Ox=wu(Kl);function Wp(s){return Mu(s)?Gl(_n(s)):o_(s)}function Ix(s){return function(l){return s==null?t:Rr(s,l)}}var Nx=Gd(),Rx=Gd(!0);function qu(){return[]}function Ku(){return!1}function Lx(){return{}}function Px(){return""}function Dx(){return!0}function Fx(s,l){if(s=re(s),s<1||s>Ue)return[];var c=qe,d=ot(s,qe);l=X(l),s-=qe;for(var y=Yl(d,l);++c<s;)l(c);return y}function zx(s){return ne(s)?ke(s,_n):Mt(s)?[s]:bt(up(_e(s)))}function Bx(s){var l=++Yb;return _e(s)+l}var $x=Io(function(s,l){return s+l},0),Hx=Su("ceil"),Vx=Io(function(s,l){return s/l},1),Wx=Su("floor");function Ux(s){return s&&s.length?Eo(s,wt,au):t}function qx(s,l){return s&&s.length?Eo(s,X(l,2),au):t}function Kx(s){return jh(s,wt)}function Gx(s,l){return jh(s,X(l,2))}function Jx(s){return s&&s.length?Eo(s,wt,fu):t}function jx(s,l){return s&&s.length?Eo(s,X(l,2),fu):t}var Yx=Io(function(s,l){return s*l},1),Xx=Su("round"),Zx=Io(function(s,l){return s-l},0);function Qx(s){return s&&s.length?jl(s,wt):0}function e5(s,l){return s&&s.length?jl(s,X(l,2)):0}return v.after=Sw,v.ary=vp,v.assign=uS,v.assignIn=Lp,v.assignInWith=Uo,v.assignWith=cS,v.at=fS,v.before=wp,v.bind=Lu,v.bindAll=gx,v.bindKey=Sp,v.castArray=Lw,v.chain=yp,v.chunk=W_,v.compact=U_,v.concat=q_,v.cond=yx,v.conforms=bx,v.constant=Hu,v.countBy=Qv,v.create=hS,v.curry=xp,v.curryRight=Ep,v.debounce=Cp,v.defaults=dS,v.defaultsDeep=pS,v.defer=xw,v.delay=Ew,v.difference=K_,v.differenceBy=G_,v.differenceWith=J_,v.drop=j_,v.dropRight=Y_,v.dropRightWhile=X_,v.dropWhile=Z_,v.fill=Q_,v.filter=tw,v.flatMap=iw,v.flatMapDeep=sw,v.flatMapDepth=ow,v.flatten=dp,v.flattenDeep=ev,v.flattenDepth=tv,v.flip=Cw,v.flow=vx,v.flowRight=wx,v.fromPairs=nv,v.functions=wS,v.functionsIn=SS,v.groupBy=aw,v.initial=iv,v.intersection=sv,v.intersectionBy=ov,v.intersectionWith=av,v.invert=ES,v.invertBy=CS,v.invokeMap=uw,v.iteratee=Vu,v.keyBy=cw,v.keys=Ke,v.keysIn=vt,v.map=zo,v.mapKeys=AS,v.mapValues=MS,v.matches=Sx,v.matchesProperty=xx,v.memoize=$o,v.merge=TS,v.mergeWith=Pp,v.method=Ex,v.methodOf=Cx,v.mixin=Wu,v.negate=Ho,v.nthArg=Ax,v.omit=OS,v.omitBy=IS,v.once=kw,v.orderBy=fw,v.over=Mx,v.overArgs=Aw,v.overEvery=Tx,v.overSome=Ox,v.partial=Pu,v.partialRight=kp,v.partition=hw,v.pick=NS,v.pickBy=Dp,v.property=Wp,v.propertyOf=Ix,v.pull=fv,v.pullAll=mp,v.pullAllBy=hv,v.pullAllWith=dv,v.pullAt=pv,v.range=Nx,v.rangeRight=Rx,v.rearg=Mw,v.reject=mw,v.remove=mv,v.rest=Tw,v.reverse=Nu,v.sampleSize=yw,v.set=LS,v.setWith=PS,v.shuffle=bw,v.slice=gv,v.sortBy=ww,v.sortedUniq=xv,v.sortedUniqBy=Ev,v.split=ix,v.spread=Ow,v.tail=Cv,v.take=kv,v.takeRight=Av,v.takeRightWhile=Mv,v.takeWhile=Tv,v.tap=Uv,v.throttle=Iw,v.thru=Fo,v.toArray=Ip,v.toPairs=Fp,v.toPairsIn=zp,v.toPath=zx,v.toPlainObject=Rp,v.transform=DS,v.unary=Nw,v.union=Ov,v.unionBy=Iv,v.unionWith=Nv,v.uniq=Rv,v.uniqBy=Lv,v.uniqWith=Pv,v.unset=FS,v.unzip=Ru,v.unzipWith=gp,v.update=zS,v.updateWith=BS,v.values=_i,v.valuesIn=$S,v.without=Dv,v.words=Hp,v.wrap=Rw,v.xor=Fv,v.xorBy=zv,v.xorWith=Bv,v.zip=$v,v.zipObject=Hv,v.zipObjectDeep=Vv,v.zipWith=Wv,v.entries=Fp,v.entriesIn=zp,v.extend=Lp,v.extendWith=Uo,Wu(v,v),v.add=$x,v.attempt=Vp,v.camelCase=US,v.capitalize=Bp,v.ceil=Hx,v.clamp=HS,v.clone=Pw,v.cloneDeep=Fw,v.cloneDeepWith=zw,v.cloneWith=Dw,v.conformsTo=Bw,v.deburr=$p,v.defaultTo=_x,v.divide=Vx,v.endsWith=qS,v.eq=an,v.escape=KS,v.escapeRegExp=GS,v.every=ew,v.find=nw,v.findIndex=fp,v.findKey=mS,v.findLast=rw,v.findLastIndex=hp,v.findLastKey=gS,v.floor=Wx,v.forEach=bp,v.forEachRight=_p,v.forIn=yS,v.forInRight=bS,v.forOwn=_S,v.forOwnRight=vS,v.get=zu,v.gt=$w,v.gte=Hw,v.has=xS,v.hasIn=Bu,v.head=pp,v.identity=wt,v.includes=lw,v.indexOf=rv,v.inRange=VS,v.invoke=kS,v.isArguments=Dr,v.isArray=ne,v.isArrayBuffer=Vw,v.isArrayLike=_t,v.isArrayLikeObject=Ne,v.isBoolean=Ww,v.isBuffer=ur,v.isDate=Uw,v.isElement=qw,v.isEmpty=Kw,v.isEqual=Gw,v.isEqualWith=Jw,v.isError=Du,v.isFinite=jw,v.isFunction=Fn,v.isInteger=Ap,v.isLength=Vo,v.isMap=Mp,v.isMatch=Yw,v.isMatchWith=Xw,v.isNaN=Zw,v.isNative=Qw,v.isNil=tS,v.isNull=eS,v.isNumber=Tp,v.isObject=Me,v.isObjectLike=Ie,v.isPlainObject=_s,v.isRegExp=Fu,v.isSafeInteger=nS,v.isSet=Op,v.isString=Wo,v.isSymbol=Mt,v.isTypedArray=bi,v.isUndefined=rS,v.isWeakMap=iS,v.isWeakSet=sS,v.join=lv,v.kebabCase=JS,v.last=qt,v.lastIndexOf=uv,v.lowerCase=jS,v.lowerFirst=YS,v.lt=oS,v.lte=aS,v.max=Ux,v.maxBy=qx,v.mean=Kx,v.meanBy=Gx,v.min=Jx,v.minBy=jx,v.stubArray=qu,v.stubFalse=Ku,v.stubObject=Lx,v.stubString=Px,v.stubTrue=Dx,v.multiply=Yx,v.nth=cv,v.noConflict=kx,v.noop=Uu,v.now=Bo,v.pad=XS,v.padEnd=ZS,v.padStart=QS,v.parseInt=ex,v.random=WS,v.reduce=dw,v.reduceRight=pw,v.repeat=tx,v.replace=nx,v.result=RS,v.round=Xx,v.runInContext=T,v.sample=gw,v.size=_w,v.snakeCase=rx,v.some=vw,v.sortedIndex=yv,v.sortedIndexBy=bv,v.sortedIndexOf=_v,v.sortedLastIndex=vv,v.sortedLastIndexBy=wv,v.sortedLastIndexOf=Sv,v.startCase=sx,v.startsWith=ox,v.subtract=Zx,v.sum=Qx,v.sumBy=e5,v.template=ax,v.times=Fx,v.toFinite=zn,v.toInteger=re,v.toLength=Np,v.toLower=lx,v.toNumber=Kt,v.toSafeInteger=lS,v.toString=_e,v.toUpper=ux,v.trim=cx,v.trimEnd=fx,v.trimStart=hx,v.truncate=dx,v.unescape=px,v.uniqueId=Bx,v.upperCase=mx,v.upperFirst=$u,v.each=bp,v.eachRight=_p,v.first=pp,Wu(v,function(){var s={};return yn(v,function(l,c){we.call(v.prototype,c)||(s[c]=l)}),s}(),{chain:!1}),v.VERSION=r,$t(["bind","bindKey","curry","curryRight","partial","partialRight"],function(s){v[s].placeholder=v}),$t(["drop","take"],function(s,l){ce.prototype[s]=function(c){c=c===t?1:Be(re(c),0);var d=this.__filtered__&&!l?new ce(this):this.clone();return d.__filtered__?d.__takeCount__=ot(c,d.__takeCount__):d.__views__.push({size:ot(c,qe),type:s+(d.__dir__<0?"Right":"")}),d},ce.prototype[s+"Right"]=function(c){return this.reverse()[s](c).reverse()}}),$t(["filter","map","takeWhile"],function(s,l){var c=l+1,d=c==en||c==Ve;ce.prototype[s]=function(y){var w=this.clone();return w.__iteratees__.push({iteratee:X(y,3),type:c}),w.__filtered__=w.__filtered__||d,w}}),$t(["head","last"],function(s,l){var c="take"+(l?"Right":"");ce.prototype[s]=function(){return this[c](1).value()[0]}}),$t(["initial","tail"],function(s,l){var c="drop"+(l?"":"Right");ce.prototype[s]=function(){return this.__filtered__?new ce(this):this[c](1)}}),ce.prototype.compact=function(){return this.filter(wt)},ce.prototype.find=function(s){return this.filter(s).head()},ce.prototype.findLast=function(s){return this.reverse().find(s)},ce.prototype.invokeMap=oe(function(s,l){return typeof s=="function"?new ce(this):this.map(function(c){return ds(c,s,l)})}),ce.prototype.reject=function(s){return this.filter(Ho(X(s)))},ce.prototype.slice=function(s,l){s=re(s);var c=this;return c.__filtered__&&(s>0||l<0)?new ce(c):(s<0?c=c.takeRight(-s):s&&(c=c.drop(s)),l!==t&&(l=re(l),c=l<0?c.dropRight(-l):c.take(l-s)),c)},ce.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},ce.prototype.toArray=function(){return this.take(qe)},yn(ce.prototype,function(s,l){var c=/^(?:filter|find|map|reject)|While$/.test(l),d=/^(?:head|last)$/.test(l),y=v[d?"take"+(l=="last"?"Right":""):l],w=d||/^find/.test(l);y&&(v.prototype[l]=function(){var C=this.__wrapped__,M=d?[1]:arguments,O=C instanceof ce,P=M[0],D=O||ne(C),F=function(le){var he=y.apply(v,nr([le],M));return d&&W?he[0]:he};D&&c&&typeof P=="function"&&P.length!=1&&(O=D=!1);var W=this.__chain__,J=!!this.__actions__.length,Z=w&&!W,se=O&&!J;if(!w&&D){C=se?C:new ce(this);var Q=s.apply(C,M);return Q.__actions__.push({func:Fo,args:[F],thisArg:t}),new Vt(Q,W)}return Z&&se?s.apply(this,M):(Q=this.thru(F),Z?d?Q.value()[0]:Q.value():Q)})}),$t(["pop","push","shift","sort","splice","unshift"],function(s){var l=lo[s],c=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",d=/^(?:pop|shift)$/.test(s);v.prototype[s]=function(){var y=arguments;if(d&&!this.__chain__){var w=this.value();return l.apply(ne(w)?w:[],y)}return this[c](function(C){return l.apply(ne(C)?C:[],y)})}}),yn(ce.prototype,function(s,l){var c=v[l];if(c){var d=c.name+"";we.call(di,d)||(di[d]=[]),di[d].push({name:l,func:c})}}),di[Oo(t,x).name]=[{name:"wrapper",func:t}],ce.prototype.clone=p2,ce.prototype.reverse=m2,ce.prototype.value=g2,v.prototype.at=qv,v.prototype.chain=Kv,v.prototype.commit=Gv,v.prototype.next=Jv,v.prototype.plant=Yv,v.prototype.reverse=Xv,v.prototype.toJSON=v.prototype.valueOf=v.prototype.value=Zv,v.prototype.first=v.prototype.head,ss&&(v.prototype[ss]=jv),v},ci=Gb();Mr?((Mr.exports=ci)._=ci,Vl._=ci):Qe._=ci}).call(sI)}(js,js.exports)),js.exports}var ay=oI();function ih(n){return n.type.create(ay.cloneDeep(n.attrs))}const aI=De.create({name:"node_processor",addCommands(){return{setBlockAttributes:B(({commands:n,state:e},t,r,i={})=>{const o=H(n.getBlockAttributes(t))??{},{doc:a,tr:u}=e,{from:f,to:h}=u.selection;a.nodesBetween(f,h,(m,p)=>{ie.blocks.includes(m.type.name)&&u.setNodeAttribute(p,t,{...i,...o,...r})})}),getBlockAttributes:B(({editor:n},e,t)=>me(()=>{let r=Object.assign({},t||{});for(const i of ie.blocks)Object.assign(r,n.getAttributes(i)?.[e]||{});return Object.keys(r).length?r:null})),removeBlockAttributes:B(({commands:n},e)=>{for(const t of ie.blocks)n.resetAttributes(t,e)}),applyMark:B(({state:n,commands:e},t,r,i={})=>{const{tr:o,doc:a,schema:u}=n,{$from:f,$to:h}=o.selection,m=wn(de.LINK,u),p=wn(t,u);if(!(p.spec.group||"").includes(dn.SETTINGS))return e.setMark(t,r);if(f.pos===h.pos)return;const S=E=>{if(!i.onAppliedToParent||i.onAppliedToParent(E)===!1){const{tr:g,node:_,position:x,mark:k}=E;e._removeNodeMark({tr:g,node:_,position:x,mark:k.type})}};a.nodesBetween(f.pos,h.pos,(E,g)=>{if(E.type.name===ie.LIST)return;const _=iI(E.marks,t),x=p.create({..._?.attrs||{},...r}),k=iy(f,h,E,g);if(!m.isInSet(E.marks)&&rI(o.doc,g,x,i.isAppliedToParent))return S({tr:o,node:E,position:g,mark:x});if(E.isText){o.addMark(k.from,k.to,x);return}tI(o.doc,o.selection,E,g)&&o.addNodeMark(g,x)})}),getMarks:B(({editor:n},e)=>{const t=xi(n,"state");return me(()=>{const{selection:r,doc:i}=H(t),{from:o,to:a}=H(r),u=[];return i.nodesBetween(o,a,f=>{for(const h of f.marks)h.type.name===e&&u.unshift(h.attrs)}),u})}),getMark:B(({commands:n},e)=>{const t=n.getMarks(e);return me(()=>H(t)[0]??null)}),hasMark:B(({commands:n},e)=>{const t=n.getMark(e);return me(()=>!!H(t))}),getCommonSettingMark:B(({commands:n},e,t)=>{const r=n.getMark(e);return me(()=>H(r)?.value??H(t))}),getDeviceSettingMark:B(({commands:n},e,t)=>{const r=n.getMarks(e),i=n.getDevice();return me(()=>{for(const o of H(r)){const a=o[H(i)];if(a)return a}return H(t)})}),removeAllMarks:B(({state:n,commands:e})=>{const{tr:t,doc:r}=n,{from:i,to:o}=t.selection;r.nodesBetween(i,o,(a,u)=>{for(const f of a.marks)e._removeNodeMark({tr:t,node:a,position:u,mark:f})})}),removeMarks:B(({state:n,commands:e},t)=>{const{tr:r,doc:i}=n,{from:o,to:a}=r.selection;i.nodesBetween(o,a,(u,f)=>{const h=u.marks.filter(m=>t.includes(m.type.name));for(const m of h)e._removeNodeMark({tr:r,node:u,position:f,mark:m})})}),_removeNodeMark:B((n,{tr:e,node:t,position:r,mark:i})=>t.isText?e.removeMark(r,r+t.nodeSize,i):e.removeNodeMark(r,i))}}}),lI=De.create({name:"text_processor",addCommands(){return{getSelectedText:B(({state:n})=>{const{from:e,to:t}=n.selection;return n.doc.textBetween(e,t," ")}),transformText:B(({state:n},e)=>{const{$from:t,$to:r}=n.tr.selection;t.pos!==r.pos&&n.doc.nodesBetween(t.pos,r.pos,(i,o)=>{if(!i.isText)return;const a=iy(t,r,i,o),u=Math.max(0,t.pos-o),f=Math.max(0,r.pos-o),h=e({text:i.textContent.substring(u,f)}),m=n.schema.text(h,i.marks);n.tr.replaceWith(a.from,a.to,m)})})}}}),uI=De.create({name:"selection_processor",addStorage:()=>({selection:null}),addCommands(){return{storeSelection:B(({state:n})=>{this.storage.selection=n.selection}),restoreSelection:B(({commands:n})=>{this.storage.selection&&n.setTextSelection(this.storage.selection)}),expandSelection:B(({tr:n,commands:e},t)=>{let r=n.selection.from,i=n.selection.to;n.doc.nodesBetween(r,i,(o,a,u)=>{if(t({node:o,parent:u})){const f=o.isText?0:sy(n.doc,a);r=Math.min(r,a+f),i=Math.max(i,a+o.nodeSize-f)}}),e.setTextSelection({from:r,to:i})}),expandSelectionToBlock:B(({commands:n})=>{n.expandSelection(({parent:e})=>e.type.name===ie.DOCUMENT)})}}}),cI=Xn.create({name:"doc",topNode:!0,content:"block+"});class Xs extends lt{constructor(e,t,r,i="SetDocAttr"){super(),this.key=e,this.value=t,this.schema=r,this.stepType=i}apply(e){this.prevValue=e.attrs.meta[this.key];const t=Wr.fromJSON(this.schema,e.toJSON());return t.attrs.meta[this.key]=this.value,Fe.ok(t)}invert(){return new Xs(this.key,this.prevValue,this.schema,"revertSetDocAttr")}map(){return null}toJSON(){return{stepType:this.stepType,key:this.key,value:this.value}}static fromJSON(e){return new Xs(e.key,e.value,e.stepType)}}lt.jsonID("setDocAttr",Xs);const fI=cI.extend({marks:dn.SETTINGS,addAttributes:()=>({meta:{default:{}}}),onCreate(){this.editor.view.dom.addEventListener("click",n=>{n.target.closest("a")&&n.preventDefault()})},addCommands(){return{setDocMetaAttributes:B(({state:n},e,t)=>{n.tr.step(new Xs(e,t,n.schema))})}}}),hI=Xn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Fi(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),dI=hI.extend({marks:dn.ALL,addOptions:()=>({HTMLAttributes:{class:"zw-style"}})}),pI=Xn.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Fi(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>GM({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),mI=pI.extend({marks:dn.ALL,addOptions:()=>({levels:[1,2,3,4],HTMLAttributes:{class:"zw-style"}})}),gI=De.create({name:"prose_mirror_plugins",addProseMirrorPlugins(){return[oT.create(this.editor),aT.create(this.editor)]}}),yI=()=>[fI,dI,mI,YM,sT,aI,lI,uI,gI],bI=Pt.create({name:de.FONT_FAMILY,group:dn.SETTINGS,addOptions:()=>({fonts:[]}),addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontFamily:B(({commands:n},e)=>{n.applyMark(this.name,{value:e});const t=n.findFontByName(e);let r=H(n.getFontWeight());t.isWeightSupported(r)||(r=t.findClosestWeight(r),n.applyFontWeight(r));const i=n.isSettingCustomized(de.FONT_STYLE).value;!t.isItalicSupported(r)&&i&&n.removeItalic()}),getFont:B(({commands:n})=>{const e=H(this.options.defaultPreset),t=n.findFontByName(e.common.font_family),r=n.getFontFamily();return me(()=>n.findFontByName(H(r))||t)}),findFontByName:B((n,e)=>H(this.options.fonts).find(t=>t.name===e)??this.options.defaultFont),getFontFamily:B(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontFamily())),getDefaultFontFamily:B(({commands:n})=>{const e=n.getPreset();return me(()=>H(e).common.font_family)})}},parseHTML(){const n=e=>({value:e.replace(/["']/g,"")});return[{style:"--zw-font-family",getAttrs:n},{style:"font-family",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.value?`"${n.value}"`:null;return Qr({font_family:e})}}),_I=De.create({name:de.STYLE_PRESET,addGlobalAttributes(){return[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{preset:{isRequired:!1,default:{id:H(this.options.defaultId)},parseHTML:n=>{const e=H(this.options.presets);if(n.parentElement.tagName==="LI")return null;for(const{id:t,node:r,fallbackClass:i}of e){if(i&&n.classList.contains(i))return{id:t};const o=H(this.options.styleRenderer).makePresetCssClass({id:t});if(n.matches(o))return{id:t};if(n.tagName===`H${r?.level}`)return{id:t}}return n.tagName==="P"?{id:H(this.options.defaultId)}:null},renderHTML:n=>n.preset?{class:H(this.options.styleRenderer).makePresetHtmlClass(n.preset)}:null}}}]},addCommands(){function n(t,r){return t.find(i=>r===i.id)}function e(t,r){const i={};for(const o of Object.keys(t)){const a=t[o],u=r[o],f=!u||u.toLowerCase()==="inherit";i[o]=f?a:u}return i}return{getPresetList:B(()=>me(()=>H(this.options.presets).filter(t=>!t.hidden))),getPreset:B(({commands:t})=>{const r=t.getBlockAttributes("preset",{id:H(this.options.defaultId)}),i=t.getPresetList(),o=t.isLink(),a=t.getLinkPreset();return me(()=>{const u=n(H(i),H(r).id);if(!H(o))return u;const f=H(a);return{id:u.id,common:e(u.common,f.common),mobile:e(u.mobile,f.mobile),tablet:e(u.tablet,f.tablet),desktop:e(u.desktop,f.desktop)}})}),applyPreset:B(({commands:t,chain:r},i)=>{const o=H(t.getPresetList()),a=n(o,i),u=a.node?.type??ie.PARAGRAPH,f={preset:{id:i}};a.node&&(f.level=a.node.level);for(const h of de.attributes)f[h]=H(t.getBlockAttributes(h));r().removeList().setNode(u,f).run()}),applyDefaultPreset:B(({commands:t})=>{t.applyPreset(H(this.options.defaultId))}),removePreset:B(({commands:t})=>{t.setNode(ie.PARAGRAPH,{preset:null})}),getPresetCustomization:B(({editor:t,commands:r})=>{const i=xi(t,"state");return me(()=>{const{selection:o,doc:a}=H(i),{from:u,to:f}=o;return r._getSettingCustomization(a,u,f)})}),isSettingCustomized:B(({commands:t},r)=>{const i=t.getPresetCustomization(),o=de.presetAttributes.includes(r)?"attributes":"marks";return me(()=>H(i)[o]?.includes(r)??!1)}),getContentCustomization:B(({editor:t,commands:r})=>{const i=xi(t,"state");return me(()=>{const{doc:o}=H(i);return r._getSettingCustomization(o,0,o.content.size)})}),_getSettingCustomization:B((t,r,i,o)=>{const a=new Set,u=new Set;return r.nodesBetween(i,o,f=>{for(const[h,m]of Object.entries(f.attrs))de.presetAttributes.includes(h)&&m&&u.add(h);for(const{type:h}of f.marks)de.marks.includes(h.name)&&a.add(h.name)}),{attributes:Array.from(u),marks:Array.from(a)}}),removePresetCustomization:B(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeMarks(de.marks).resetAttributes(ie.PARAGRAPH,de.presetAttributes).resetAttributes(ie.HEADING,de.presetAttributes).restoreSelection().run()}),removeFormat:B(({chain:t})=>{t().storeSelection().expandSelectionToBlock().removeAllMarks().applyDefaultPreset().restoreSelection().run()})}},onCreate(){this.options.styleRenderer.inject(Ki.head,H(this.options.presets))}}),vI=Pt.create({name:de.FONT_WEIGHT,group:dn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{applyFontWeight:B(({commands:n},e)=>{n.applyMark(this.name,{value:e}),H(n.getFont()).isItalicSupported(e)||n.removeItalic()}),toggleBold:B(({commands:n})=>{const e=H(n.getFontWeight()),t=H(n.getFont()),i=Number(e)>=600?"400":"700",o=t.findClosestWeight(i);n.applyFontWeight(o)}),getFontWeight:B(({commands:n})=>{const e=n.getCommonSettingMark(this.name,n.getDefaultFontWeight()),t=n.getFont();return me(()=>{const r=H(e),i=H(t);return i.isWeightSupported(r)?r:i.findClosestWeight(r)})}),getDefaultFontWeight:B(({commands:n})=>{const e=n.getPreset();return me(()=>H(e).common.font_weight)})}},addKeyboardShortcuts:()=>({"Mod-b":Zt("toggleBold"),"Mod-B":Zt("toggleBold")}),parseHTML(){const n=e=>e==="bold"?{value:"700"}:Number(e)?{value:e}:!1;return[{style:"--zw-font-weight",getAttrs:n},{style:"font-weight",getAttrs:n},{tag:"b",attrs:{value:"700"}},{tag:"strong",attrs:{value:"700"}}]},renderHTML({HTMLAttributes:n}){return Qr({font_weight:n.value})}}),wI=Pt.create({name:de.FONT_SIZE,group:dn.SETTINGS,addOptions:()=>({minSize:1,maxSize:100}),addAttributes(){return{mobile:{default:null},tablet:{default:null},desktop:{default:null}}},addCommands(){return{getFontSize:B(({commands:n})=>n.getDeviceSettingMark(this.name,n.getDefaultFontSize())),getDefaultFontSize:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>H(t)[H(e)].font_size.replace("px",""))}),applyFontSize:B(({commands:n},e)=>{const t=H(n.getDevice());n.applyMark(this.name,{[t]:e},{isAppliedToParent:(r,i)=>r.type.name!==i.type.name?!1:r.attrs[t]===i.attrs[t],onAppliedToParent:({tr:r,node:i,position:o,mark:a})=>{const u={...a.attrs,[t]:null};if(!Object.values(u).some(m=>!!m))return!1;const h=a.type.create(u);if(i.isText){r.addMark(o,o+i.nodeSize,h);return}r.addNodeMark(o,h)}})}),increaseFontSize:B(({commands:n})=>{const e=Number(H(n.getFontSize())),t=Math.min(e+1,H(this.options.maxSize));n.applyFontSize(String(t))}),decreaseFontSize:B(({commands:n})=>{const e=Number(H(n.getFontSize())),t=Math.max(e-1,H(this.options.minSize));n.applyFontSize(String(t))})}},addKeyboardShortcuts:()=>({"Mod-Shift-=":Zt("increaseFontSize"),"Mod-Shift--":Zt("decreaseFontSize")}),parseHTML(){const n=e=>{if(!e)return null;const t=H(this.options.wrapperRef),r=ry(e,t);return String(r)};return[{tag:'[style*="--zw-font-size"]',getAttrs:({style:e})=>({mobile:n(e.getPropertyValue("--zw-font-size-mobile")),tablet:n(e.getPropertyValue("--zw-font-size-tablet")),desktop:n(e.getPropertyValue("--zw-font-size-desktop"))})},{style:"font-size",getAttrs:e=>{const t=n(e);return{desktop:t,tablet:t,mobile:null}}}]},renderHTML({HTMLAttributes:n}){const e=t=>t?`${t}px`:null;return Qr({font_size_mobile:e(n.mobile),font_size_tablet:e(n.tablet),font_size_desktop:e(n.desktop)})}}),SI=Pt.create({name:de.FONT_COLOR,group:dn.SETTINGS,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getFontColor:B(({commands:n})=>n.getCommonSettingMark(this.name,n.getDefaultFontColor())),getDefaultFontColor:B(({commands:n})=>{const e=n.getPreset();return me(()=>H(e).common.color)}),applyFontColor:B(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:ny(e)});return[{style:"--zw-font-color",getAttrs:n},{style:"color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Qr({font_color:n.value})}}),xI=Pt.create({name:de.BACKGROUND_COLOR,addAttributes:()=>({value:{required:!0}}),addCommands(){return{getBackgroundColor:B(({commands:n})=>n.getCommonSettingMark(this.name,"rgba(255, 255, 255, 0%)")),applyBackgroundColor:B(({commands:n},e)=>{n.applyMark(this.name,{value:e})})}},parseHTML(){const n=e=>({value:ny(e)});return[{style:"--zw-background-color",getAttrs:n},{style:"background-color",getAttrs:n}]},renderHTML({HTMLAttributes:n}){return Qr({background_color:n.value})}}),EI=De.create({name:"device_manager",addCommands(){return{getDevice:B(()=>xi(this.options,"device"))}}}),CI=Pt.create({name:de.FONT_STYLE,group:dn.SETTINGS,addAttributes:()=>({italic:{required:!0}}),addCommands(){return{isItalic:B(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultFontStyle();return me(()=>H(e)?.italic??H(t).italic)}),isItalicAvailable:B(({commands:n})=>{const e=n.getFont(),t=n.getFontWeight();return me(()=>{const r=H(e),i=H(t);return r.isItalicSupported(i)&&!r.isWeightItalicOnly(i)})}),getDefaultFontStyle:B(({commands:n})=>{const e=n.getPreset();return me(()=>({italic:H(e).common.font_style==="italic"}))}),toggleItalic:B(({commands:n})=>{H(n.isItalicAvailable())&&(H(n.isItalic())?n.removeItalic():n.applyItalic())}),applyItalic:B(({commands:n})=>{n.applyMark(this.name,{italic:!0})}),removeItalic:B(({commands:n})=>{n.applyMark(this.name,{italic:!1})})}},addKeyboardShortcuts:()=>({"Mod-i":Zt("toggleItalic"),"Mod-I":Zt("toggleItalic")}),parseHTML(){const n=e=>({italic:e.includes("italic")});return[{tag:"i",attrs:{italic:!0}},{style:"--zw-font-style",getAttrs:n},{style:"font-style",getAttrs:n}]},renderHTML({HTMLAttributes:n}){const e=n.italic?"italic":"normal";return Qr({font_style:e})}}),kI=Pt.create({name:de.TEXT_DECORATION,priority:1e3,addAttributes:()=>({underline:{default:!1},strike_through:{default:!1}}),addCommands(){return{isUnderline:B(({commands:n})=>{const e=n.getTextDecoration();return me(()=>H(e).underline)}),isStrikeThrough:B(({commands:n})=>{const e=n.getTextDecoration();return me(()=>H(e).strike_through)}),getTextDecoration:B(({commands:n})=>{const e=n.getMark(this.name),t=n.getDefaultTextDecoration();return me(()=>{const r=H(e)??{},i=H(t);return{underline:r.underline||i.underline,strike_through:r.strike_through||i.strike_through}})}),isUnderlineCustomized:B(({commands:n})=>{const e=n.isUnderline(),t=n.getDefaultTextDecoration();return me(()=>H(e)!==H(t).underline)}),getDefaultTextDecoration:B(({commands:n})=>{const e=n.getPreset();return me(()=>{const{text_decoration:t}=H(e).common;return{underline:t.includes("underline"),strike_through:t.includes("line-through")}})}),toggleUnderline:B(({commands:n})=>{n.toggleTextDecoration("underline")}),toggleStrikeThrough:B(({commands:n})=>{n.toggleTextDecoration("strike_through")}),toggleTextDecoration:B(({commands:n},e,t=null)=>{const r=H(n.getTextDecoration()),i=t??!r[e];n.applyMark(this.name,{[e]:i})}),applyTextDecoration:B(({commands:n},e)=>{n.toggleTextDecoration(e,!0)}),removeTextDecoration:B(({commands:n},e)=>{n.toggleTextDecoration(e,!1)})}},addKeyboardShortcuts:()=>({"Mod-u":Zt("toggleUnderline"),"Mod-U":Zt("toggleUnderline")}),parseHTML(){const n=e=>{const t=e.includes("underline"),r=e.includes("line-through");return!t&&!r?!1:{underline:t,strike_through:r}};return[{style:"--zw-text-decoration",getAttrs:n},{style:"text-decoration-line",getAttrs:n},{style:"text-decoration",getAttrs:n},{tag:"s",attrs:{underline:!1,strike_through:!0}},{tag:"u",attrs:{underline:!0,strike_through:!1}}]},renderHTML({HTMLAttributes:n}){const e=[];return n.underline&&e.push("underline"),n.strike_through&&e.push("line-through"),e.length||e.push("none"),Qr({text_decoration:e.join(" ")})}}),AI=De.create({name:"case_style",addCommands(){return{applyCaseStyle:B(({commands:n},e)=>{switch(e){case Sf.CAPITALIZE:return n.applyCapitalize();case Sf.LOWERCASE:return n.applyLowerCase();case Sf.UPPERCASE:return n.applyUpperCase()}}),applyCapitalize:B(({commands:n})=>{n.transformText(({text:e})=>MT(e))}),applyLowerCase:B(({commands:n})=>{n.transformText(({text:e})=>e.toLowerCase())}),applyUpperCase:B(({commands:n})=>{n.transformText(({text:e})=>e.toUpperCase())})}}}),ly={mobile:null,tablet:null,desktop:null},MI=De.create({name:de.ALIGNMENT,addGlobalAttributes:()=>[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{[de.ALIGNMENT]:{isRequired:!1,parseHTML({style:n}){const e=eI(n.textAlign);if(e)return{desktop:e,tablet:e,mobile:e};const t=n.getPropertyValue("--zw-alignment-mobile")||null,r=n.getPropertyValue("--zw-alignment-tablet")||null,i=n.getPropertyValue("--zw-alignment-desktop")||null;return!t&&!r&&!i?null:{desktop:i,tablet:r,mobile:t}},renderHTML(n){return n.alignment?cl({alignment_mobile:n.alignment.mobile,alignment_tablet:n.alignment.tablet,alignment_desktop:n.alignment.desktop}):null}}}}],addCommands(){return{applyAlignment:B(({commands:n},e)=>{const t=H(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},ly)}),removeAlignment:B(({commands:n})=>n.removeBlockAttributes(this.name)),getAlignment:B(({commands:n})=>{const e=n.getBlockAttributes(this.name,ly),t=n.getDevice(),r=n.getDefaultAlignment();return me(()=>H(e)?.[H(t)]??H(r))}),getDefaultAlignment:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>H(t)[H(e)].alignment??wr.LEFT)})}},addKeyboardShortcuts:()=>({"Mod-Shift-l":Zt("applyAlignment",wr.LEFT),"Mod-Shift-e":Zt("applyAlignment",wr.CENTER),"Mod-Shift-r":Zt("applyAlignment",wr.RIGHT),"Mod-Shift-j":Zt("applyAlignment",wr.JUSTIFY)})}),uy={mobile:null,tablet:null,desktop:null},TI=De.create({name:de.LINE_HEIGHT,addGlobalAttributes(){return[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{[de.LINE_HEIGHT]:{isRequired:!1,parseHTML:n=>{if(n.matches('[style*="--zw-line-height"]')){const o=n.style.getPropertyValue("--zw-line-height-tablet")||null,a=n.style.getPropertyValue("--zw-line-height-desktop")||null;return{mobile:null,tablet:o,desktop:a}}const e=n.style.lineHeight;if(!e)return null;const t=H(this.options.wrapperRef),r=ZO(e,n,t);return r?{desktop:r,tablet:r,mobile:null}:null},renderHTML(n){return n.line_height?cl({line_height_mobile:n.line_height.mobile,line_height_tablet:n.line_height.tablet,line_height_desktop:n.line_height.desktop}):null}}}}]},addCommands(){return{getLineHeight:B(({commands:n})=>{const e=n.getBlockAttributes(this.name,uy),t=n.getDevice(),r=n.getDefaultLineHeight();return me(()=>H(e)?.[H(t)]??H(r))}),getDefaultLineHeight:B(({commands:n})=>{const e=n.getDevice(),t=n.getPreset();return me(()=>H(t)[H(e)].line_height)}),applyLineHeight:B(({commands:n},e)=>{const t=H(n.getDevice());n.setBlockAttributes(this.name,{[t]:e},uy)})}}}),OI=Xn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Fi(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),II=OI.extend({name:ie.LIST_ITEM,marks:dn.SETTINGS,addCommands(){const n=({selection:e})=>e.$cursor.before(e.$cursor.depth-1);return{listItemNewline:B(({commands:e,tr:t})=>{const r=t.doc.nodeAt(n(t));if(!t.selection.$cursor.node().textContent)return!1;e.splitListItem(this.name);const o=n(t);for(const a of r.marks)t.addNodeMark(o,ih(a));return!0})}},addOptions:()=>({HTMLAttributes:{class:"zw-style"}}),addKeyboardShortcuts:()=>({Enter:n=>{const{state:e,commands:t}=n.editor;if(e.selection.$cursor?.path.some(i=>i.type?.name===ie.LIST))return t.listItemNewline()}})}),NI=Xn.create({name:ie.LIST,content:`${ie.LIST_ITEM}+`,group:"block list",marks:dn.SETTINGS,addExtensions:()=>[II],addOptions:()=>({baseClass:"",presetClass:""}),addAttributes:()=>({bullet:{default:{type:Yt.DISC}}}),parseHTML(){const n={a:Yt.ROMAN,i:Yt.LATIN,1:Yt.DECIMAL},e=t=>{for(const r of Yt.values){const i=`.${H(this.options.baseClass)}${r}`;if(t.matches(i)||n[t.type.toLowerCase()]===r)return r}};return[{tag:"ol",getAttrs:t=>({bullet:{type:e(t)||Yt.DECIMAL}})},{tag:"ul",getAttrs:t=>({bullet:{type:e(t)||Yt.DISC}})}]},renderHTML({HTMLAttributes:n}){const e=[H(this.options.baseClass)+n.bullet.type,H(this.options.presetClass)];return[Yt.ordered.includes(n.bullet.type)?"ol":"ul",{class:e.join(" ")},0]},addCommands(){return{getListType:B(({commands:n})=>{const e=n.getBlockAttributes("bullet",{type:null});return me(()=>H(e).type??null)}),applyList:B(({commands:n,chain:e},t)=>{if(H(n.getListType())===t){n.removeList();return}return e().applyDefaultPreset().toggleList(ie.LIST,ie.LIST_ITEM).setBlockAttributes("bullet",{type:t}).command(({commands:i,tr:o})=>i._bubbleListItemMarks(o)).run()}),_bubbleListItemMarks:B((n,e)=>{const{doc:t,selection:r}=e,i=r.$from.start(),o=r.$to.end();function a(u,f){if(de.inlineMarks.includes(f.type)||f.type.isInSet(u.marks))return!1;for(const h of u.content.content)if(h.childCount&&(!h.marks||!f.isInSet(h.marks)))return!1;return!0}t.nodesBetween(i,o,(u,f)=>{if(u.type.name===ie.LIST)return;if(u.type.name!==ie.LIST_ITEM)return!1;const h=[];return u.forEach(m=>{for(const p of m.marks){if(p.isInSet(h)){e.removeNodeMark(f+1,p);continue}a(u,p)&&(e.removeNodeMark(f+1,p),e.addNodeMark(f,ih(p)),h.push(p))}}),!1})}),removeList:B(({commands:n,state:e})=>{const{tr:t,doc:r,selection:i}=e,o=i.$from.start(),a=i.$to.end();r.nodesBetween(o,a,(u,f,h)=>{if([ie.LIST,ie.LIST_ITEM].includes(u.type.name))return;if(h.type.name!==ie.LIST_ITEM)return!1;const m=h.marks.filter(function(p){return!p.type.isInSet(u.marks)});for(const p of m)t.addNodeMark(f,ih(p));return!1}),n.liftListItem(ie.LIST_ITEM)})}},addInputRules(){const n=(e,t)=>JM({find:t,type:this.type,getAttributes:{bullet:{type:e}},joinPredicate:(r,{attrs:i})=>i.bullet.type===e});return[n(Yt.DISC,/^\s*([-+*])\s$/),n(Yt.DECIMAL,/^(\d+)\.\s$/),n(Yt.LATIN,/^([ivx]{1,3})\.\s$/i),n(Yt.ROMAN,/^([a-z])\.\s$/i)]}});function RI(n){return new Rt({key:new fn("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(h=>h.docChanged)&&!t.doc.eq(r.doc),o=e.some(h=>h.getMeta("preventAutolink"));if(!i||o)return;const{tr:a}=r,u=gM(t.doc,[...e]);if(CM(u).forEach(({newRange:h})=>{const m=bM(r.doc,h,S=>S.isTextblock);let p,b;if(m.length>1?(p=m[0],b=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):m.length&&r.doc.textBetween(h.from,h.to," "," ").endsWith(" ")&&(p=m[0],b=r.doc.textBetween(p.pos,h.to,void 0," ")),p&&b){const S=b.split(" ").filter(_=>_!=="");if(S.length<=0)return!1;const E=S[S.length-1],g=p.pos+b.lastIndexOf(E);if(!E)return!1;Vf(E).filter(_=>_.isLink).map(_=>({..._,from:g+_.start+1,to:g+_.end+1})).filter(_=>r.schema.marks.code?!r.doc.rangeHasMark(_.from,_.to,r.schema.marks.code):!0).filter(_=>n.validate?n.validate(_.value):!0).forEach(_=>{I0(_.from,_.to,r.doc).some(x=>x.mark.type===n.type)||a.addMark(_.from,_.to,n.type.create({href:_.href}))})}}),!!a.steps.length)return a}})}function LI(n){return new Rt({key:new fn("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,o;if(r.button!==0||r.target.nodeName!=="A")return!1;const u=SM(e.state,n.type.name),f=r.target,h=(i=f?.href)!==null&&i!==void 0?i:u.href,m=(o=f?.target)!==null&&o!==void 0?o:u.target;return f&&h?(e.editable&&window.open(h,m),!0):!1}}})}function PI(n){return new Rt({key:new fn("handlePasteLink"),props:{handlePaste:(e,t,r)=>{var i;const{state:o}=e,{selection:a}=o,{empty:u}=a;if(u)return!1;let f="";r.content.forEach(E=>{f+=E.textContent});const h=Vf(f).find(E=>E.isLink&&E.value===f);if(!f||!h)return!1;const m=(i=t.clipboardData)===null||i===void 0?void 0:i.getData("text/html"),p=/href="([^"]*)"/,b=m?.match(p),S=b?b[1]:h.href;return n.editor.commands.setMark(n.type,{href:S}),!0}}})}const DI=Pt.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){t1(n);return}t1(n.scheme,n.optionalSlashes)})},onDestroy(){ET()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",Fi(this.options.HTMLAttributes,{...n,href:""}),0]:["a",Fi(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[jM({find:n=>Vf(n).filter(e=>this.options.validate?this.options.validate(e.value):!0).filter(e=>e.isLink).map(e=>({text:e.value,index:e.start,data:e})),type:this.type,getAttributes:(n,e)=>{var t,r;const i=(t=e?.clipboardData)===null||t===void 0?void 0:t.getData("text/html"),o=/href="([^"]*)"/,a=i?.match(o);return a?{href:a[1]}:{href:(r=n.data)===null||r===void 0?void 0:r.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(RI({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(LI({type:this.type})),this.options.linkOnPaste&&n.push(PI({editor:this.editor,type:this.type})),n}}),FI=DI.extend({name:de.LINK,addOptions(){return{...this.parent?.(),openOnClick:!1,linkOnPaste:!1}},addAttributes(){return{href:{default:null,parseHTML:n=>{const e=n.getAttribute("href");return e.startsWith("#")?parseFloat(n.getAttribute("href").replace("#","")):e}},target:{default:H0.SELF,parseHTML:n=>n.getAttribute("target")||H0.SELF},destination:{default:Bs.URL,parseHTML:n=>{const e=n.getAttribute("href");if(!e.startsWith("#"))return Bs.URL;const t=e.replace("#","");return H(this.options.pageBlocks).find(o=>o.id===parseInt(t))?Bs.BLOCK:Bs.URL}}}},addCommands(){const{unsetLink:n}=this.parent();return{removeLink:n,applyLink:B(({commands:e,chain:t},r)=>(e.setMeta("preventAutolink",!0),e.getSelectedText()?t().applyMark(this.name,r).expandSelectionToLink().command(({tr:i})=>(r.text&&i.insertText(r.text,i.selection.from,i.selection.to),!0)).run():e.insertContent(fy.text(r.text,[fy.mark(de.LINK,r)])))),expandSelectionToLink:B(({commands:e})=>{e.expandSelection(({node:t})=>this.type.isInSet(t.marks))}),isLink:B(({commands:e})=>e.hasMark(this.name)),getLinkPreset:B(()=>me(()=>H(this.options.preset)))}},addProseMirrorPlugins(){return[...this.parent(),AT.create(this.editor)]},renderHTML({HTMLAttributes:n}){const e=n.destination===Bs.BLOCK?`#${n.href}`:n.href,t=H(this.options.basePresetClass)+H(this.options.preset).id;return["a",{href:e,target:n.target,class:`${t} zw-style`},0]}}),zI=Pt.create({name:de.SUPERSCRIPT,addCommands(){return{applySuperscript:B(({commands:n})=>{n.setMark(this.name)}),removeSuperscript:B(({commands:n})=>{n.unsetMark(this.name)}),toggleSuperscript:B(({commands:n})=>{H(n.isSuperscript())?n.removeSuperscript():n.applySuperscript()}),isSuperscript:B(({commands:n})=>{const e=n.getMark(this.name);return me(()=>!!H(e))})}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs:n=>n!=="super"?!1:null}]},renderHTML(){return["sup",{class:"zw-superscript"},0]}}),BI=De.create({name:de.MARGIN,addGlobalAttributes:()=>[{types:[ie.PARAGRAPH,ie.HEADING],attributes:{[de.MARGIN]:{isRequired:!1,parseHTML(n){const{margin:e,marginTop:t,marginRight:r,marginBottom:i,marginLeft:o}=n.style;return[e,t,r,i,o].some(f=>!!f)?e?{value:e}:{value:[t||0,r||0,i||0,o||0].join(" ")}:null},renderHTML(n){return n.margin?cl({margin:n.margin.value}):null}}}}]});function $I(n){const e=r=>n.presetsRef.value.find(i=>i.id===r),t=hc({default:null,link:null});return PE(n.presetsRef,()=>{t.default=e(n.defaultPresetId),t.link=e(n.linkPresetId)},{immediate:!0,deep:!0}),yI().concat([_I.configure({presets:n.presetsRef,defaultId:n.defaultPresetId,styleRenderer:new WI({baseClass:n.basePresetClass,makeVariable:n.makePresetVariable,linkPresetId:n.linkPresetId})}),NI.configure({baseClass:n.baseListClass,presetClass:n.basePresetClass+n.defaultPresetId}),EI.configure({device:n.deviceRef}),wI.configure({minSize:n.minFontSize,maxSize:n.maxFontSize,wrapperRef:n.wrapperRef}),bI.configure({fonts:n.fonts,defaultPreset:xi(t,"default"),defaultFont:n.defaultFont}),vI,SI,xI,CI,kI,AI,zI,MI,TI.configure({wrapperRef:n.wrapperRef}),FI.configure({preset:xi(t,"link"),basePresetClass:n.basePresetClass,pageBlocks:n.pageBlocksRef}),BI])}class HI{_domParser=new DOMParser;types=window;parse(e){return this._domParser.parseFromString(e,"text/html")}}class cy{content;constructor({content:e}){this.content=e}normalize(){throw new Error("Implement abstract method")}}class kn extends cy{static BLOCK_NODE_NAMES=["P","H1","H2","H3","H4"];static ROOT_NODE_NAMES=kn.BLOCK_NODE_NAMES.concat("UL","OL");static BLOCK_STYLES=["text-align","line-height","margin","margin-top","margin-bottom","margin-left","margin-right"];_parser;constructor({content:e,parser:t}){super({content:e}),this._parser=t,this.dom=null}normalize(){return this.normalizeHTML(),this.normalizedHTML}normalizeHTML(){this.dom=this._parser.parse(this.content.replace(/(\r)?\n/g,"")),this._removeComments(),this._normalizeRootTags(),this._iterateNodes(this._normalizeBreakLines,e=>e.tagName==="BR"),this._iterateNodes(this._removeEmptyNodes,this._isBlockNode),this._iterateNodes(this._normalizeListItems,e=>e.tagName==="LI"),this._normalizeBlockTextDecoration(),this._normalizeBlockBackgroundColor()}get normalizedHTML(){return this.dom.body.innerHTML}get _NodeFilter(){return this._parser.types.NodeFilter}get _Node(){return this._parser.types.Node}_removeComments(){const e=this._createNodeIterator(this._NodeFilter.SHOW_COMMENT);this._runIterator(e,t=>t.remove())}_normalizeRootTags(){const e=Array.from(this.dom.body.childNodes),t=this.dom.createDocumentFragment();let r;for(const i of e){if(this._isRootNode(i)){t.append(i),r=null;continue}r||(r=this.dom.createElement("p"),t.append(r)),r.append(i)}this.dom.body.innerHTML="",this.dom.body.append(t)}_createNodeIterator(e,t){return this.dom.createNodeIterator(this.dom.body,e,t)}_iterateNodes(e,t=()=>!0){const r=o=>o.tagName!=="BODY"&&t.call(this,o),i=this._createNodeIterator(this._NodeFilter.SHOW_ELEMENT,{acceptNode:o=>r(o)?this._NodeFilter.FILTER_ACCEPT:this._NodeFilter.FILTER_REJECT});this._runIterator(i,e)}_runIterator(e,t){let r=e.nextNode();for(;r;)t.call(this,r),r=e.nextNode()}_removeEmptyNodes(e){e.innerHTML.trim()||e.remove()}_normalizeListItems(e){const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes);let i,o;const a=u=>{this._assignElementProperties(u,e,kn.BLOCK_STYLES),t.append(u)};this._assignElementProperties(e,e.parentElement,kn.BLOCK_STYLES);for(const u of r){if(this._isBlockNode(u)){a(u),i=null,o=u;continue}if(u.tagName==="BR"&&o&&o?.tagName!=="BR"){u.remove(),o=u;continue}if(u.tagName==="BR"){const f=this.dom.createElement("p");f.append(u),a(f),i=null,o=u;continue}i||(i=this.dom.createElement("p"),a(i)),i.append(u),o=u}e.append(t),this._removeStyleProperties(e,kn.BLOCK_STYLES),this._removeStyleProperties(e.parentElement,kn.BLOCK_STYLES),this._assignElementProperties(e,e.parentElement),e.parentElement.lastElementChild===e&&this._removeStyleProperties(e.parentElement)}_isBlockNode(e){return kn.BLOCK_NODE_NAMES.includes(e.tagName)}_isRootNode(e){return kn.ROOT_NODE_NAMES.includes(e.tagName)}_assignElementProperties(e,t,r=Array.from(t.style)){for(const i of r){const o=t.style.getPropertyValue(i);o&&!e.style.getPropertyValue(i)&&e.style.setProperty(i,o)}}_removeStyleProperties(e,t=Array.from(e.style)){for(const r of t)e.style.removeProperty(r);e.style.length===0&&e.removeAttribute("style")}_normalizeBreakLines({parentElement:e}){if(!this._isBlockNode(e)||!e.textContent)return;const t=this.dom.createDocumentFragment(),r=Array.from(e.childNodes),i=e.cloneNode(!0);i.innerHTML="";let o=i.cloneNode();const a=u=>{this._assignElementProperties(u,e,kn.BLOCK_STYLES),t.append(u)};for(const u of r){if(u.tagName==="BR"){a(o),o=i.cloneNode();continue}o.append(u)}t.append(o),e.replaceWith(t)}_normalizeBlockTextDecoration(){const e=this.dom.querySelectorAll('[style*="text-decoration"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveTextDecorationToChildren(t)}_moveTextDecorationToChildren(e){const t=this._parseTextDecoration(e);if(e.style.removeProperty("text-decoration-line"),e.style.removeProperty("text-decoration"),e.style.cssText||e.removeAttribute("style"),!t.none)for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=this._parseTextDecoration(i),a={underline:o.underline||t.underline,line_through:o.line_through||t.line_through};i.style.removeProperty("text-decoration-line"),i.style.removeProperty("text-decoration"),i.style.textDecoration=Object.entries(a).filter(([,u])=>u).map(([u])=>u.replace("_","-")).join(" ")}}_parseTextDecoration(e){const{textDecoration:t,textDecorationLine:r}=e.style,i=t||r||"";return{none:i.includes("none"),underline:i.includes("underline"),line_through:i.includes("line-through")}}_normalizeBlockBackgroundColor(){const e=this.dom.querySelectorAll('[style*="background-color"]:where(p, h1, h2, h3, h4, li)');for(const t of e)this._moveBackgroundColorToChildren(t)}_moveBackgroundColorToChildren(e){const t=e.style.backgroundColor;e.style.removeProperty("background-color"),e.style.cssText||e.removeAttribute("style");for(const r of e.childNodes){const i=this._wrapTextNode(e,r),o=i.style.backgroundColor||t;i.style.backgroundColor=o}}_wrapTextNode(e,t){if(t.nodeType!==this._Node.TEXT_NODE)return t;const r=this.dom.createElement("span");return r.append(t.cloneNode()),e.replaceChild(r,t),r}}class VI extends cy{normalize(){return this._iterateNodes(this._bubbleMarks),this.content}_iterateNodes(e){this._iterateChildNodes(this.content,e)}_iterateChildNodes(e,t){for(const r of e.content)r.content&&this._iterateChildNodes(r,t),t.call(this,r)}_bubbleMarks(e){if(e.content&&e.type!==ie.LIST){for(const t of e.content)if(!this._isLink(t)&&t.marks)for(const r of t.marks.slice()){if(this._includesMark(e,r)){this._removeMark(t,r);continue}this._canBubbleMark(e,r)&&(this._removeMark(t,r),this._addMark(e,r))}}}_canBubbleMark(e,t){if(de.inlineMarks.includes(t.type)||this._includesMarkType(e,t.type))return!1;for(const r of e.content)if(!(!r.content&&e.type===ie.LIST_ITEM)&&(!r.marks||!this._includesMark(r,t)))return!1;return!0}_includesMark(e,t){return e.marks?.some(r=>ay.isEqual(r,t))??!1}_includesMarkType(e,t){return e.marks?.some(r=>r.type===t)??!1}_isLink(e){return e.type===ie.TEXT&&this._includesMarkType(e,de.LINK)}_removeMark(e,t){if(!e.marks)return;const r=this._findMarkIndexByType(e,t.type);r>=0&&e.marks.splice(r,1),e.marks.length||delete e.marks}_addMark(e,t){this._removeMark(e,t),e.marks??=[],e.marks.push(t)}_findMarkIndexByType(e,t){return e.marks?.findIndex(r=>r.type===t)??null}}class El{static build(e,t={}){return typeof e=="string"?this._buildHtml(e,t):this._buildJson(e)}static _buildHtml(e,t){return new kn({content:e,parser:t.parser||new HI})}static _buildJson(e){return new VI({content:e})}static normalize(e,t={}){return El.build(e,t).normalize()}}class Ki{static window=globalThis.window;static use(e){this.window=e}static get document(){return this.window.document}static get body(){return this.document.body}static get head(){return this.document.head}static getComputedStyle(e){return this.window.getComputedStyle(e)}}class hh{static build({config:e,nodeDomParser:t}){const r=$I({fonts:e.fonts,minFontSize:0,maxFontSize:0,presetsRef:sa(e.presets),defaultPresetId:e.defaultPresetId,linkPresetId:e.linkPresetId,makePresetVariable:()=>"",basePresetClass:e.basePresetClass,baseListClass:e.baseListClass,deviceRef:sa(wf.DESKTOP),pageBlocksRef:sa([]),wrapperRef:Ki.document.createElement("p")}),i=vM(r);return new hh({schema:i,domParser:Mc.fromSchema(i),nodeDomParser:t})}_schema;_domParser;_nodeDomParser;constructor({schema:e,domParser:t,nodeDomParser:r}){this._schema=e,this._domParser=t,this._nodeDomParser=r}toJSON(e){const t=El.build(e,{parser:this._nodeDomParser});return t.normalizeHTML(),this._domParser.parse(t.dom.body).toJSON()}}class fy{static doc(e){return{type:ie.DOCUMENT,content:e}}static list(e,t){return{type:ie.LIST,attrs:{bullet:{type:e}},content:t.map(r=>r.type===ie.LIST_ITEM?r:this.listItem([].concat(r)))}}static listItem(...e){const{attrs:t,content:r,marks:i}=this._normalizeTextBlockArgs(e);return{type:ie.LIST_ITEM,...t?{attrs:t}:{},...i?{marks:i}:{},content:[].concat(r).map(o=>typeof o=="string"?this.paragraph(o):o)}}static heading(e,...t){const r=this._textBlock(t,this.text);return r.attrs??={},r.attrs.level=e,{type:ie.HEADING,...r}}static paragraph(...e){return{type:ie.PARAGRAPH,...this._textBlock(e,this.text)}}static _textBlock(e){const{attrs:t,content:r,marks:i}=this._normalizeTextBlockArgs(e);return{content:typeof r=="string"?[this.text(r)]:r,...t?{attrs:t}:{},...i?{marks:i}:{}}}static _normalizeTextBlockArgs(e){return e.length===1?{attrs:null,marks:null,content:e[0]}:e.length===2?{attrs:e[0],marks:null,content:e[1]}:{attrs:e[0],marks:e[1],content:e[2]}}static text(e,t){return{type:ie.TEXT,...t?{marks:t}:{},text:e}}static link(e,t,r=[]){return this.text(e,[this.mark(de.LINK,t),...r])}static mark(e,t){return{type:e,attrs:t}}static populateAllDevices(e){return{mobile:e,tablet:e,desktop:e}}}class WI{_baseClass;_makeVariable;_linkPresetId;constructor({baseClass:e,makeVariable:t,linkPresetId:r}){this._baseClass=e,this._makeVariable=t,this._linkPresetId=r}inject(e,t){let r=e.querySelector("[data-zw-styles]");r||(r=Ki.document.createElement("style"),r.dataset.zwStyles="",r.innerHTML=this.render(t),e.append(r))}render(e){let t="";for(const r of e){const i=r.id===this._linkPresetId,o=this.makePresetCssClass(r);t+=` ${o} {`;for(const a of wf.values)for(const u of Object.keys(r[a])){const f=this._makeVariable({device:a,preset:r,property:u}),h=this._makeInternalVariableName(u,a);if(t+=`${h}: var(${f}, inherit);`,i&&!de.attributes.includes(u)){const m=h.replace("preset-","");t+=`${m}: var(${h});`}}t+="}"}return t}_makeInternalVariableName(e,t){const r=e==="color"?"font-color":e.replace(/_/i,"-"),i=t===wf.COMMON?"":`-${t}`;return`--zw-preset-${r}${i}`}makePresetHtmlClass(e){return this._baseClass+e.id}makePresetCssClass(e){return this.makePresetHtmlClass(e).split(" ").map(t=>`.${t}`).join("")}}class dh{static _instance;static get instance(){return this._instance??=new dh,this._instance}static query(e,t){return this.instance.query(e,t)}query(e,t){let r=null;return e.descendants(i=>{if(r)return!1;if(this.matchNode(i,t))return r=i,!1}),r?t.getMark?this.getMark(r,t.getMark):r:null}matchNode(e,t){return!(t.typeName&&t.typeName!==e.type.name||t.mark&&!this.getMark(e,t.mark))}getMark(e,t){return e.marks.find(r=>this.matchMark(r,t))||null}matchMark(e,t){return e.type.name===t.typeName}}class hy{static createWindow(){return new Kp.JSDOM().window}types;parse(e){const{window:t}=new Kp.JSDOM(e);return this.types=t,t.document}}class dy{name;description;argument;options=[];doCommand(){throw new Error('Command "doCommand" is required')}install(e){if(!this.name)throw new Error('Command "name" is required');let t=e.command(this.name);if(this.description&&(t=t.description(this.description)),this.argument&&(t=t.argument(this.argument)),this.options.length)for(const r of this.options)t=t.option(r.flags,r.description,r.default);t.action(this.doCommand.bind(this))}output(e){}}class UI extends dy{name="to-json";description="migrate html to json";argument="<html...>";options=[{flags:"-c, --config <path>",description:"Generator config",default:qp.resolve(__dirname,"../bin/zp.config.json")},{flags:"-f, --format <type>",description:"Set output format",default:"rb"}];doCommand(e,{config:t,format:r}){Ki.use(hy.createWindow());const i=qp.resolve(process.cwd(),t),o=hh.build({config:require(i).editor,nodeDomParser:new hy}),a=e.map(h=>o.toJSON(this._formatInputHtml(h))),u=a.length===1?a[0]:a,f=this._stringifyContent(u);this.output(r==="rb"?this._formatOutputRb(f):f)}_formatInputHtml(e){return e.replace(/\\(["'])/g,"$1").replace(/rgba\(\d{1,3}, ?\d{1,3}, ?\d{1,3}, (\d{1,2}%)\)/g,(t,r)=>t.replace(r,parseFloat(r)/100))}_stringifyContent(e){return JSON.stringify(e,(r,i)=>i===null?void 0:i,2)}_formatOutputRb(e){return e.replace(/\\"/g,'"').replace(/font-family: ?'(.+)'/g,'font-family: "$1"').replace(/'/g,"\\'").replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm,t=>t.replace(/"/g,"")).replace(/: "(.+)"([,\n])/g,": '$1'$2")}}var qI="4.9.4";class KI extends dy{name="version";description="display cli version";doCommand(){this.output(qI)}}const py=new h5,GI=[UI,KI];for(const n of GI)new n().install(py);py.parse();
package/dist/wysiwyg.css CHANGED
@@ -349,36 +349,36 @@
349
349
  position: var(--8349ba3e);
350
350
  }
351
351
 
352
- .zw-modal[data-v-a8a4e8ea] {
352
+ .zw-modal[data-v-72ecfd23] {
353
353
  border-radius: 2px;
354
354
  box-shadow: 0 0 4px rgba(var(--zw-color-black), 0.3);
355
355
  background-color: rgb(var(--zw-color-n15));
356
- max-height: var(--4d6acbf1);
357
- max-width: var(--6330983c);
356
+ max-height: var(--3b807430);
357
+ max-width: var(--749527c6);
358
358
  z-index: 1000;
359
359
  will-change: transform;
360
360
  }
361
- .zw-modal--enter-active[data-v-a8a4e8ea] {
361
+ .zw-modal--enter-active[data-v-72ecfd23] {
362
362
  transition: opacity 0.15s ease-out;
363
363
  }
364
- .zw-modal--enter-from[data-v-a8a4e8ea],
365
- .zw-modal--leave-to[data-v-a8a4e8ea] {
364
+ .zw-modal--enter-from[data-v-72ecfd23],
365
+ .zw-modal--leave-to[data-v-72ecfd23] {
366
366
  opacity: 0;
367
367
  }
368
- .zw-modal--leave-active[data-v-a8a4e8ea] {
368
+ .zw-modal--leave-active[data-v-72ecfd23] {
369
369
  transition: opacity 0.1s ease-in;
370
370
  }
371
371
 
372
372
  /* Scrollbar overrides in modal */
373
- .zw-modal[data-v-a8a4e8ea] .simplebar-offset,
374
- .zw-modal[data-v-a8a4e8ea] .simplebar-mask {
373
+ .zw-modal[data-v-72ecfd23] .simplebar-offset,
374
+ .zw-modal[data-v-72ecfd23] .simplebar-mask {
375
375
  position: initial;
376
376
  }
377
- .zw-modal[data-v-a8a4e8ea] .simplebar-content {
378
- max-height: var(--4d6acbf1);
377
+ .zw-modal[data-v-72ecfd23] .simplebar-content {
378
+ max-height: var(--3b807430);
379
379
  padding: 0 !important;
380
380
  }
381
- .zw-modal[data-v-a8a4e8ea] .simplebar-content-wrapper {
381
+ .zw-modal[data-v-72ecfd23] .simplebar-content-wrapper {
382
382
  overscroll-behavior: contain;
383
383
  }
384
384
 
@@ -421,29 +421,29 @@
421
421
  color: rgb(var(--zw-color-red));
422
422
  }
423
423
 
424
- .zw-checkbox[data-v-94a6bca2] {
424
+ .zw-checkbox[data-v-e1624b5d] {
425
425
  display: inline-flex;
426
426
  align-items: center;
427
427
  position: relative;
428
428
  cursor: pointer;
429
429
  padding: var(--zw-offset-xxs) var(--zw-offset-xxs) var(--zw-offset-xxs) 0;
430
430
  }
431
- .zw-checkbox__field + .zw-checkbox__indicator[data-v-94a6bca2] {
431
+ .zw-checkbox__field + .zw-checkbox__indicator[data-v-e1624b5d] {
432
432
  color: var(--zw-color-n200);
433
433
  box-shadow: inset 0 0 0 2px currentColor;
434
434
  }
435
- .zw-checkbox:hover .zw-checkbox__indicator[data-v-94a6bca2],
436
- .zw-checkbox:focus .zw-checkbox__indicator[data-v-94a6bca2],
437
- .zw-checkbox:focus-within .zw-checkbox__indicator[data-v-94a6bca2] {
435
+ .zw-checkbox:hover .zw-checkbox__indicator[data-v-e1624b5d],
436
+ .zw-checkbox:focus .zw-checkbox__indicator[data-v-e1624b5d],
437
+ .zw-checkbox:focus-within .zw-checkbox__indicator[data-v-e1624b5d] {
438
438
  box-shadow: inset 0 0 0 2px rgb(var(--zw-color-b200));
439
439
  }
440
- .zw-checkbox__field:checked + .zw-checkbox__indicator[data-v-94a6bca2] {
440
+ .zw-checkbox__field:checked + .zw-checkbox__indicator[data-v-e1624b5d] {
441
441
  color: rgb(var(--zw-color-b200))
442
442
  }
443
- .zw-checkbox .zw-checkbox__field:checked + .zw-checkbox__indicator[data-v-94a6bca2] {
443
+ .zw-checkbox .zw-checkbox__field:checked + .zw-checkbox__indicator[data-v-e1624b5d] {
444
444
  background-color: rgb(var(--zw-color-b200));
445
445
  }
446
- .zw-checkbox .zw-checkbox__indicator[data-v-94a6bca2]::after {
446
+ .zw-checkbox .zw-checkbox__indicator[data-v-e1624b5d]::after {
447
447
  content: "";
448
448
  display: block;
449
449
  height: 16px;
@@ -455,16 +455,16 @@
455
455
  background-size: 16px;
456
456
  background-position: center center;
457
457
  }
458
- .zw-checkbox__field:not(:checked) + .zw-checkbox__indicator[data-v-94a6bca2]::after {
458
+ .zw-checkbox__field:not(:checked) + .zw-checkbox__indicator[data-v-e1624b5d]::after {
459
459
  transform: scale(0);
460
460
  }
461
- .zw-checkbox__field[data-v-94a6bca2] {
461
+ .zw-checkbox__field[data-v-e1624b5d] {
462
462
  position: absolute;
463
463
  opacity: 0;
464
464
  height: 0;
465
465
  width: 0;
466
466
  }
467
- .zw-checkbox__label[data-v-94a6bca2] {
467
+ .zw-checkbox__label[data-v-e1624b5d] {
468
468
  font-size: var(--zw-font-size-xs);
469
469
  }
470
470
 
@@ -592,34 +592,34 @@
592
592
  display: flex;
593
593
  }
594
594
 
595
- .zw-link-modal-header[data-v-64870ac2] {
595
+ .zw-link-modal-header[data-v-d721e93d] {
596
596
  display: flex;
597
597
  align-items: center;
598
598
  justify-content: space-between;
599
599
  padding: var(--zw-offset-sm);
600
600
  border-bottom: 2px solid rgb(var(--zw-color-n5));
601
601
  }
602
- .zw-link-modal-header__title[data-v-64870ac2] {
602
+ .zw-link-modal-header__title[data-v-d721e93d] {
603
603
  text-transform: uppercase;
604
604
  font-weight: var(--zw-font-weight-semibold);
605
605
  font-size: var(--zw-font-size-xxs);
606
606
  color: rgb(var(--zw-color-white));
607
607
  }
608
- .zw-link-modal-header__unlink-icon[data-v-64870ac2] {
608
+ .zw-link-modal-header__unlink-icon[data-v-d721e93d] {
609
609
  margin-right: var(--zw-offset-xxs);
610
610
  }
611
- .zw-link-modal-header__unlink-button[data-v-64870ac2] {
611
+ .zw-link-modal-header__unlink-button[data-v-d721e93d] {
612
612
  color: rgb(var(--zw-color-n80));
613
613
  font-size: var(--zw-font-size-xxs);
614
614
  transition: 0.1s opacity ease-out, 0.1s color ease-out;
615
615
  will-change: opacity, color;
616
616
  }
617
- .zw-link-modal-header__unlink-button[data-v-64870ac2]:disabled {
617
+ .zw-link-modal-header__unlink-button[data-v-d721e93d]:disabled {
618
618
  opacity: 0.35;
619
619
  }
620
- .zw-link-modal-header__unlink-button[data-v-64870ac2]:focus,
621
- .zw-link-modal-header__unlink-button[data-v-64870ac2]:focus-within,
622
- .zw-link-modal-header__unlink-button[data-v-64870ac2]:hover {
620
+ .zw-link-modal-header__unlink-button[data-v-d721e93d]:focus,
621
+ .zw-link-modal-header__unlink-button[data-v-d721e93d]:focus-within,
622
+ .zw-link-modal-header__unlink-button[data-v-d721e93d]:hover {
623
623
  color: rgb(var(--zw-color-white));
624
624
  }
625
625
 
package/dist/wysiwyg.mjs CHANGED
@@ -28679,7 +28679,7 @@ const _sfc_main$1 = {
28679
28679
  },
28680
28680
  setup(__props) {
28681
28681
  useCssVars((_ctx) => ({
28682
- "0526d2ed": __props.offsets[1]
28682
+ "7b6bf359": __props.offsets[1]
28683
28683
  }));
28684
28684
  const props = __props;
28685
28685
  const layoutComponent = computed(() => {
@@ -28711,7 +28711,7 @@ const _sfc_main$1 = {
28711
28711
  };
28712
28712
  }
28713
28713
  };
28714
- const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-c8d81d2f"]]);
28714
+ const Toolbar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-e9105a30"]]);
28715
28715
  function useEditor({ content, onChange, extensions: extensions2, isReadonlyRef }) {
28716
28716
  const editor = reactive(new Editor2({
28717
28717
  content: ContentNormalizer.normalize(content.value),
@@ -65,8 +65,8 @@ const layoutComponent = computed(() => {
65
65
  border: 1px solid rgba(var(--zw-color-white), 0.2);
66
66
  border-radius: 2px;
67
67
  background-color: rgba(var(--zw-color-n15), 0.9);
68
- -webkit-backdrop-filter: blur(8px); /* prefixed rule must be before unprefixed one https://github.com/parcel-bundler/lightningcss/issues/695 */
69
68
  backdrop-filter: blur(8px);
69
+ -webkit-backdrop-filter: blur(8px);
70
70
  color: rgb(var(--zw-color-n70));
71
71
  z-index: 999999;
72
72
  text-align: left;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zipify/wysiwyg",
3
- "version": "4.9.2",
3
+ "version": "4.9.4",
4
4
  "description": "Zipify modification of TipTap text editor",
5
5
  "main": "dist/wysiwyg.mjs",
6
6
  "types": "dist/wysiwyg.d.ts",