slice-machine-ui 1.24.1-alpha.feat-disable-push-changes-with-git.2 → 1.24.1-alpha.feat-disable-push-changes-with-git.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.
- package/out/404.html +1 -1
- package/out/_next/static/{R2G-iL0ukIJP5mlv6wM6E → O63Ju-nLSggpdmXYLV0r9}/_buildManifest.js +1 -1
- package/out/_next/static/chunks/{18539003-5c90777ef33ded7b.js → 18539003-a5a5d48f20a7b261.js} +3 -3
- package/out/_next/static/chunks/pages/{_app-55cb594e63d22821.js → _app-5e90dcdcaf6bb30c.js} +12 -12
- package/out/_next/static/css/{f86234529ac7fa66.css → 75711e840ea6c200.css} +1 -1
- package/out/changelog.html +1 -1
- package/out/changes.html +1 -1
- package/out/custom-types/[customTypeId].html +1 -1
- package/out/custom-types.html +1 -1
- package/out/index.html +1 -1
- package/out/labs.html +1 -1
- package/out/page-types/[pageTypeId].html +1 -1
- package/out/settings.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation]/simulator.html +1 -1
- package/out/slices/[lib]/[sliceName]/[variation].html +1 -1
- package/out/slices.html +1 -1
- package/package.json +6 -6
- /package/out/_next/static/{R2G-iL0ukIJP5mlv6wM6E → O63Ju-nLSggpdmXYLV0r9}/_ssgManifest.js +0 -0
package/out/_next/static/chunks/{18539003-5c90777ef33ded7b.js → 18539003-a5a5d48f20a7b261.js}
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
`,t)}function Wb(t,n){var r,i=n(t);return{value:i[0],forest:Wx(i[1],n)}}function Wx(t,n){return t.map(function(t){return Wb(t,n)})}function W_(t){var n=WS(t);return function(r,i){return t.chain(i(r),function(r){var o=r[0],a=r[1];return t.map(n(a,i),function(t){return{value:o,forest:t}})})}}function WS(t){var n=fg(t);return function(r,i){return rp(r,n(function(n){return W_(t)(n,i)}))}}var WT=function(t,n){return rp(t,WL(n))},Ww=function(t,n){return rp(t,Wj(function(t){return rp(n,WL(t))}))},WO=function(t,n){return rp(t,Wj(n))},Wk=function(t,n,r){return rp(t,WF(n,r))},WC=function(t){var n=WD(t);return function(t,r){return rp(t,n(r))}},WI=function(t,n,r){return rp(t,WW(n,r))},WM=function(t,n){return rp(t,WA(n))},WR=function(t){var n=Wz(t);return function(t,r){return rp(t,n(r))}},WE=function(t){return function(n){return Ww(n,t)}},Wj=function(t){return function(n){var r=t(n.value),i=r.value,o=r.forest,a=fw().concat;return{value:i,forest:a(o,n.forest.map(Wj(t)))}}},WA=function(t){return function(n){return{value:t(n),forest:n.forest.map(WA(t))}}},WN=WA(rn),WP=Wj(rn),WL=function(t){return function(n){return{value:t(n.value),forest:n.forest.map(WL(t))}}},WF=function(t,n){return function(r){for(var i=n(t,r.value),o=r.forest.length,a=0;a<o;a++)i=rp(r.forest[a],WF(i,n));return i}},WD=function(t){return function(n){return WF(t.empty,function(r,i){return t.concat(r,n(i))})}},WW=function(t,n){return function(r){for(var i=t,o=r.forest.length,a=o-1;a>=0;a--)i=rp(r.forest[a],WW(i,n));return n(r.value,i)}},WU=function(t){return t.value},Wz=function(t){var n=fg(t),r=function(i){return function(o){return t.ap(t.map(i(o.value),function(t){return function(n){return{value:t,forest:n}}}),rp(o.forest,n(r(i))))}};return r},WB=function(t){return Wz(t)(rn)},WV=function(t){return Wg(t)},W$="Tree",Wq={URI:W$,map:WT},WK=rq(Wq),WH={URI:W$,map:WT,ap:Ww},WG=rP(WH),WZ=rL(WH),WY={URI:W$,map:WT,ap:Ww,chain:WO},WJ=rQ(WY),WQ=WV(rE),WX=rK(Wq),W0=rX(WY),W1=rF(WH),W2=function(t){return function(n){return t(n.value)||n.forest.some(W2(t))}};let W3=Object.freeze(Object.defineProperty({__proto__:null,Applicative:{URI:W$,map:WT,ap:Ww,of:WV},Apply:WH,Chain:WY,Comonad:{URI:W$,map:WT,extend:WM,extract:WU},Do:WQ,Foldable:{URI:W$,reduce:Wk,foldMap:WC,reduceRight:WI},Functor:Wq,Monad:{URI:W$,map:WT,ap:Ww,of:WV,chain:WO},Pointed:{URI:W$,of:WV},Traversable:{URI:W$,map:WT,reduce:Wk,foldMap:WC,reduceRight:WI,traverse:WR,sequence:WB},URI:W$,ap:WE,apFirst:WG,apS:W1,apSecond:WZ,bind:W0,bindTo:WX,chain:Wj,chainFirst:WJ,drawForest:Wv,drawTree:function(t){return t.value+Wv(t.forest)},duplicate:WN,elem:function(t){var n=function(r,i){return t.equals(r,i.value)||i.forest.some(function(t){return n(r,t)})};return n},exists:W2,extend:WA,extract:WU,flap:WK,flatten:WP,fold:function(t){var n=function(r){return t(r.value,r.forest.map(n))};return n},foldMap:WD,getEq:function(t){var n,r=ie(function(r,i){return t.equals(r.value,i.value)&&n.equals(r.forest,i.forest)});return n=cd(r),r},getShow:function(t){var n=function(r){return cY(r.forest)?"make(".concat(t.show(r.value),")"):"make(".concat(t.show(r.value),", [").concat(r.forest.map(n).join(", "),"])")};return{show:n}},make:Wg,map:WL,of:WV,reduce:WF,reduceRight:WW,sequence:WB,traverse:Wz,tree:{URI:W$,map:WT,of:WV,ap:Ww,chain:WO,reduce:Wk,foldMap:WC,reduceRight:WI,traverse:WR,sequence:WB,extract:WU,extend:WM},unfoldForest:Wx,unfoldForestM:WS,unfoldTree:Wb,unfoldTreeM:W_},Symbol.toStringTag,{value:"Module"}));var W4=function(t){var n;return[j2(t),(n=t,n[0])]};function W5(t){return{URI:Uv,_E:void 0,map:W7,ap:function(n,r){var i,o;return[(i=n,i[0])((o=r,o[0])),t.concat(j2(n),j2(r))]}}}var W6=function(t){return function(n){return[n,t.empty]}};function W9(t){var n=W5(t);return{URI:Uv,_E:void 0,map:n.map,ap:n.ap,chain:function(n,r){var i,o=r((i=n,i[0])),a=o[0],u=o[1];return[a,t.concat(j2(n),u)]}}}var W8=function(t,n){return rp(t,Uc(n))},W7=function(t,n){return rp(t,Us(n))},Ue=function(t,n,r){return rp(t,Uu(n,r))},Ut=function(t,n){return rp(t,Ul(n))},Un=function(t,n){return rp(t,Ud(n))},Ur=function(t,n,r){return rp(t,Uh(n,r))},Ui=function(t){var n=Up();return function(t,r){return rp(t,n(r))}},Uo=function(t,n,r){return rp(t,Um(n,r))};function Ua(t){var n=Ug(t);return function(t,r){return rp(t,n(r))}}var Uu=function(t,n){return function(r){var i;return[n((i=r,i[0])),t(j2(r))]}},Us=function(t){return function(n){var r;return[t((r=n,r[0])),j2(n)]}},Ul=function(t){return function(n){var r;return[(r=n,r[0]),t(j2(n))]}},Uc=function(t){return function(n){var r;return[(r=n,r[0]),j2(t)]}},Ud=function(t){return function(n){return[t(n),j2(n)]}},Uf=Ud(rn),Up=Ap,Uh=Af,Um=Ah,Ug=function(t){return function(n){return function(r){var i;return t.map(n((i=r,i[0])),function(t){return[t,j2(r)]})}}},Uy=function(t){return function(n){var r;return t.map((r=n,r[0]),function(t){return[t,j2(n)]})}},Uv="Tuple",Ub={URI:Uv,map:W7},Ux=rq(Ub);let U_=Object.freeze(Object.defineProperty({__proto__:null,Bifunctor:{URI:Uv,bimap:Ue,mapLeft:Ut},Comonad:{URI:Uv,map:W7,extend:Un,extract:j1},Foldable:{URI:Uv,reduce:Ur,foldMap:Ui,reduceRight:Uo},Functor:Ub,Semigroupoid:{URI:Uv,compose:W8},Traversable:{URI:Uv,map:W7,reduce:Ur,foldMap:Ui,reduceRight:Uo,traverse:Ua,sequence:Uy},URI:Uv,bimap:Uu,compose:Uc,duplicate:Uf,extend:Ud,extract:j1,flap:Ux,foldMap:Up,fst:j1,getApplicative:function(t){var n=W5(t);return{URI:Uv,_E:void 0,map:n.map,ap:n.ap,of:W6(t)}},getApply:W5,getChain:W9,getChainRec:function(t){var n=function(n,r){for(var i,o,a=r(n),u=t.empty,s=(i=a,i[0]);"Left"===s._tag;){u=t.concat(u,j2(a)),s=(o=a=r(s.left))[0]}return[s.right,t.concat(u,j2(a))]},r=W9(t);return{URI:Uv,_E:void 0,map:r.map,ap:r.ap,chain:r.chain,chainRec:n}},getMonad:function(t){var n=W9(t);return{URI:Uv,_E:void 0,map:n.map,ap:n.ap,chain:n.chain,of:W6(t)}},map:Us,mapFst:Us,mapLeft:Ul,mapSnd:Ul,reduce:Uh,reduceRight:Um,sequence:Uy,snd:j2,swap:W4,traverse:Ug,tuple:{URI:Uv,compose:W8,map:W7,bimap:Ue,mapLeft:Ut,extract:j1,extend:Un,reduce:Ur,foldMap:Ui,reduceRight:Uo,traverse:Ua,sequence:Uy}},Symbol.toStringTag,{value:"Module"})),US=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),UT=Object.freeze(Object.defineProperty({__proto__:null,getValidationM:function(t,n){var r=rY(n,mB(t));return{map:r.map,ap:r.ap,of:r.of,chain:function(t,r){return n.chain(t,function(t){return rS(t)?n.of(rw(t.left)):r(t.right)})},alt:function(r,i){return n.chain(r,function(r){return rT(r)?n.of(r):n.map(i(),function(n){return rS(n)?rw(t.concat(r.left,n.left)):n})})}}}},Symbol.toStringTag,{value:"Module"}));var Uw=iB(void 0),UO={concat:Uw.concat,empty:void 0};let Uk=Object.freeze(Object.defineProperty({__proto__:null,Monoid:UO,Semigroup:Uw},Symbol.toStringTag,{value:"Module"}));var UC=function(t){return function(){return[void 0,t]}},UI=function(t){return function(){var n=t(),r=n[0],i=n[1];return[[r,i],i]}},UM=function(t){return function(){var n,r=t(),i=r[0],o=i[0];return[o,(0,i[1])(r[1])]}},UR=function(t){return function(n){return function(){var r=n(),i=r[0],o=r[1];return[[i,t(o)],o]}}},UE=function(t){return function(n){return function(){var r,i=n();return[i[0],t(i[1])]}}},Uj=function(t,n){return rp(t,UA(n))},UA=function(t){return function(n){return function(){var r=n(),i=r[0],o=r[1];return[t(i),o]}}},UN="Writer",UP=function(t){return{URI:UN,_E:void 0,of:function(n){return function(){return[n,t.empty]}}}},UL=function(t){return{URI:UN,_E:void 0,map:Uj,ap:function(n,r){return function(){var i=n(),o=i[0],a=i[1],u=r(),s=u[0],l=u[1];return[o(s),t.concat(a,l)]}}}},UF=function(t){var n=UL(t),r=UP(t);return{URI:UN,_E:void 0,map:Uj,ap:n.ap,of:r.of}};function UD(t){var n=UL(t);return{URI:UN,_E:void 0,map:Uj,ap:n.ap,chain:function(n,r){return function(){var i=n(),o=i[0],a=i[1],u=r(o)(),s=u[0],l=u[1];return[s,t.concat(a,l)]}}}}var UW={URI:UN,map:Uj},UU=rq(UW),Uz=function(t){return t()[0]},UB=function(t){return t()[1]},UV=function(t){return t()[0]},U$=function(t){return t()[1]};let Uq=Object.freeze(Object.defineProperty({__proto__:null,Functor:UW,URI:UN,censor:UE,evalWriter:UV,evaluate:Uz,execWriter:U$,execute:UB,flap:UU,getApplicative:UF,getApply:UL,getChain:UD,getMonad:function(t){var n=UF(t),r=UD(t);return{URI:UN,_E:void 0,map:Uj,ap:n.ap,of:n.of,chain:r.chain}},getPointed:UP,listen:UI,listens:UR,map:UA,pass:UM,tell:UC,writer:UW},Symbol.toStringTag,{value:"Module"})),UK=Object.freeze(Object.defineProperty({__proto__:null,getWriterM:function(t){var n=function(n,r){return function(){return t.map(n(),function(t){var n=t[0],i=t[1];return[r(n),i]})}};return{map:n,evalWriter:function(n){return t.map(n(),function(t){return t[0]})},execWriter:function(n){return t.map(n(),function(t){return t[0],t[1]})},tell:function(n){return function(){return t.of([void 0,n])}},listen:function(n){return function(){return t.map(n(),function(t){var n=t[0],r=t[1];return[[n,r],r]})}},pass:function(n){return function(){return t.map(n(),function(t){var n,r=t[0],i=r[0];return[i,(0,r[1])(t[1])]})}},listens:function(n,r){return function(){return t.map(n(),function(t){var n=t[0],i=t[1];return[[n,r(i)],i]})}},censor:function(n,r){return function(){return t.map(n(),function(t){var n;return[t[0],r(t[1])]})}},getMonad:function(r){return{_E:void 0,map:n,of:function(n){return function(){return t.of([n,r.empty])}},ap:function(n,i){return function(){return t.chain(n(),function(n){var o=n[0],a=n[1];return t.map(i(),function(t){var n=t[0],i=t[1];return[o(n),r.concat(a,i)]})})}},chain:function(n,i){return function(){return t.chain(n(),function(n){var o=n[0],a=n[1];return t.map(i(o)(),function(t){var n=t[0],i=t[1];return[n,r.concat(a,i)]})})}}}}}}},Symbol.toStringTag,{value:"Module"})),UH=Object.freeze(Object.defineProperty({__proto__:null,alt:n4,alternative:n5,applicative:rJ,apply:rV,array:f2,bifunctor:f3,boolean:pn,booleanAlgebra:pi,bounded:ps,boundedDistributiveLattice:pd,boundedJoinSemilattice:pf,boundedLattice:pp,boundedMeetSemilattice:ph,category:pm,chain:r0,chainRec:py,choice:px,comonad:p_,compactable:h8,console:mr,const:my,contravariant:mv,date:mS,distributiveLattice:pc,either:gU,eitherT:g7,endomorphism:yn,eq:id,extend:yr,field:yo,filterable:yc,filterableWithIndex:yd,foldable:yy,foldableWithIndex:y_,fromEither:r7,fromIO:yO,fromReader:vd,fromState:vJ,fromTask:v1,fromThese:v3,function:rg,functor:rG,functorWithIndex:v5,group:v6,heytingAlgebra:v9,hkt:v8,identity:bA,invariant:bN,io:xe,ioEither:_l,ioOption:Sk,ioRef:SI,joinSemilattice:SM,json:Sj,lattice:SA,magma:iW,map:wx,meetSemilattice:w_,monad:wS,monadIO:wT,monadTask:ww,monadThrow:wO,monoid:wW,naturalTransformation:wU,nonEmptyArray:u6,number:su,option:h5,optionT:_C,ord:iA,ordering:wH,pipeable:wG,pointed:wZ,predicate:pj,profunctor:wY,random:w1,reader:vo,readerEither:O2,readerT:O8,readerTask:Cj,readerTaskEither:RW,readonlyArray:cZ,readonlyMap:TN,readonlyNonEmptyArray:aI,readonlyRecord:jw,readonlySet:j0,readonlyTuple:Ax,record:Nn,refinement:Nd,ring:Nh,semigroup:i1,semigroupoid:Nm,semiring:Ng,separated:sb,set:NF,show:NU,state:v$,stateReaderTaskEither:La,stateT:NZ,store:Ly,string:R4,strong:Lx,struct:LT,task:kB,taskEither:I6,taskOption:FL,taskThese:Wo,these:Dp,theseT:DI,traced:Wd,traversable:Wh,traversableWithIndex:Wm,tree:W3,tuple:U_,unfoldable:US,validationT:UT,void:Uk,witherable:sT,writer:Uq,writerT:UK,zero:sO},Symbol.toStringTag,{value:"Module"})),UG=C(UH);var UZ={},UY={},UJ={},UQ={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getEndomorphismMonoid=t.not=t.SK=t.hole=t.pipe=t.untupled=t.tupled=t.absurd=t.decrement=t.increment=t.tuple=t.flow=t.flip=t.constVoid=t.constUndefined=t.constNull=t.constFalse=t.constTrue=t.constant=t.unsafeCoerce=t.identity=t.apply=t.getRing=t.getSemiring=t.getMonoid=t.getSemigroup=t.getBooleanAlgebra=void 0;var n=function(t){return function(){return{meet:function(n,r){return function(i){return t.meet(n(i),r(i))}},join:function(n,r){return function(i){return t.join(n(i),r(i))}},zero:function(){return t.zero},one:function(){return t.one},implies:function(n,r){return function(i){return t.implies(n(i),r(i))}},not:function(n){return function(r){return t.not(n(r))}}}}};t.getBooleanAlgebra=n;var r=function(t){return function(){return{concat:function(n,r){return function(i){return t.concat(n(i),r(i))}}}}};t.getSemigroup=r;var i=function(n){var r=(0,t.getSemigroup)(n);return function(){return{concat:r().concat,empty:function(){return n.empty}}}};t.getMonoid=i;var o=function(t){return{add:function(n,r){return function(i){return t.add(n(i),r(i))}},zero:function(){return t.zero},mul:function(n,r){return function(i){return t.mul(n(i),r(i))}},one:function(){return t.one}}};t.getSemiring=o;var a=function(n){var r=(0,t.getSemiring)(n);return{add:r.add,mul:r.mul,one:r.one,zero:r.zero,sub:function(t,r){return function(i){return n.sub(t(i),r(i))}}}};t.getRing=a;var u=function(t){return function(n){return n(t)}};function s(t){return t}function l(t){return function(){return t}}function c(t,n,r,i,o,a,u,s,l){switch(arguments.length){case 1:return t;case 2:return function(){return n(t.apply(this,arguments))};case 3:return function(){return r(n(t.apply(this,arguments)))};case 4:return function(){return i(r(n(t.apply(this,arguments))))};case 5:return function(){return o(i(r(n(t.apply(this,arguments)))))};case 6:return function(){return a(o(i(r(n(t.apply(this,arguments))))))};case 7:return function(){return u(a(o(i(r(n(t.apply(this,arguments)))))))};case 8:return function(){return s(u(a(o(i(r(n(t.apply(this,arguments))))))))};case 9:return function(){return l(s(u(a(o(i(r(n(t.apply(this,arguments)))))))))}}}function d(t){return t+1}function f(t){return t-1}function p(t){throw Error("Called `absurd` function which should be uncallable")}t.apply=u,t.identity=s,t.unsafeCoerce=s,t.constant=l,t.constTrue=l(!0),t.constFalse=l(!1),t.constNull=l(null),t.constUndefined=l(void 0),t.constVoid=t.constUndefined,t.flip=function(t){return function(n,r){return t(r,n)}},t.flow=c,t.tuple=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t},t.increment=d,t.decrement=f,t.absurd=p,t.tupled=function(t){return function(n){return t.apply(void 0,n)}},t.untupled=function(t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return t(n)}},t.pipe=function(t,n,r,i,o,a,u,s,l){switch(arguments.length){case 1:return t;case 2:return n(t);case 3:return r(n(t));case 4:return i(r(n(t)));case 5:return o(i(r(n(t))));case 6:return a(o(i(r(n(t)))));case 7:return u(a(o(i(r(n(t))))));case 8:return s(u(a(o(i(r(n(t)))))));case 9:return l(s(u(a(o(i(r(n(t))))))));default:for(var c=arguments[0],d=1;d<arguments.length;d++)c=arguments[d](c);return c}},t.hole=p;var h=function(t,n){return n};t.SK=h,t.not=function(t){return function(n){return!t(n)}};var m=function(){return{concat:function(t,n){return c(t,n)},empty:s}};t.getEndomorphismMonoid=m}(UQ);var UX={},U0=k&&k.__spreadArray||function(t,n,r){if(r||2===arguments.length)for(var i,o=0,a=n.length;o<a;o++)!i&&o in n||(i||(i=Array.prototype.slice.call(n,0,o)),i[o]=n[o]);return t.concat(i||Array.prototype.slice.call(n))};Object.defineProperty(UX,"__esModule",{value:!0}),UX.fromReadonlyNonEmptyArray=UX.has=UX.emptyRecord=UX.emptyReadonlyArray=UX.tail=UX.head=UX.isNonEmpty=UX.singleton=UX.right=UX.left=UX.isRight=UX.isLeft=UX.some=UX.none=UX.isSome=UX.isNone=void 0;var U1=function(t){return"None"===t._tag};UX.isNone=U1;var U2=function(t){return"Some"===t._tag};UX.isSome=U2,UX.none={_tag:"None"};var U3=function(t){return{_tag:"Some",value:t}};UX.some=U3;var U4=function(t){return"Left"===t._tag};UX.isLeft=U4;var U5=function(t){return"Right"===t._tag};UX.isRight=U5;var U6=function(t){return{_tag:"Left",left:t}};UX.left=U6;var U9=function(t){return{_tag:"Right",right:t}};UX.right=U9;var U8=function(t){return[t]};UX.singleton=U8;var U7=function(t){return t.length>0};UX.isNonEmpty=U7;var ze=function(t){return t[0]};UX.head=ze;var zt=function(t){return t.slice(1)};UX.tail=zt,UX.emptyReadonlyArray=[],UX.emptyRecord={},UX.has=Object.prototype.hasOwnProperty;var zn=function(t){return U0([t[0]],t.slice(1),!0)};UX.fromReadonlyNonEmptyArray=zn;var zr=k&&k.__createBinding||(Object.create?function(t,n,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(n,r);(!o||("get"in o?!n.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return n[r]}}),Object.defineProperty(t,i,o)}:function(t,n,r,i){void 0===i&&(i=r),t[i]=n[r]}),zi=k&&k.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),zo=k&&k.__importStar||function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&zr(n,t,r);return zi(n,t),n};Object.defineProperty(UJ,"__esModule",{value:!0}),UJ.sequenceS=UJ.sequenceT=UJ.getApplySemigroup=UJ.apS=UJ.apSecond=UJ.apFirst=UJ.ap=void 0;var za=zo(UX);function zu(t,n,r){return function(i){for(var o=Array(r.length+1),a=0;a<r.length;a++)o[a]=r[a];return o[r.length]=i,0===n?t.apply(null,o):zu(t,n-1,o)}}UJ.ap=function(t,n){return function(r){return function(i){return t.ap(t.map(i,function(t){return function(r){return n.ap(t,r)}}),r)}}},UJ.apFirst=function(t){return function(n){return function(r){return t.ap(t.map(r,function(t){return function(){return t}}),n)}}},UJ.apSecond=function(t){return function(n){return function(r){return t.ap(t.map(r,function(){return function(t){return t}}),n)}}},UJ.apS=function(t){return function(n,r){return function(i){return t.ap(t.map(i,function(t){return function(r){var i;return Object.assign({},t,((i={})[n]=r,i))}}),r)}}},UJ.getApplySemigroup=function(t){return function(n){return{concat:function(r,i){return t.ap(t.map(r,function(t){return function(r){return n.concat(t,r)}}),i)}}}};var zs={1:function(t){return[t]},2:function(t){return function(n){return[t,n]}},3:function(t){return function(n){return function(r){return[t,n,r]}}},4:function(t){return function(n){return function(r){return function(i){return[t,n,r,i]}}}},5:function(t){return function(n){return function(r){return function(i){return function(o){return[t,n,r,i,o]}}}}}};function zl(t){return za.has.call(zs,t)||(zs[t]=zu(UQ.tuple,t-1,[])),zs[t]}function zc(t){var n=t.length;switch(n){case 1:return function(n){var r;return(r={})[t[0]]=n,r};case 2:return function(n){return function(r){var i;return(i={})[t[0]]=n,i[t[1]]=r,i}};case 3:return function(n){return function(r){return function(i){var o;return(o={})[t[0]]=n,o[t[1]]=r,o[t[2]]=i,o}}};case 4:return function(n){return function(r){return function(i){return function(o){var a;return(a={})[t[0]]=n,a[t[1]]=r,a[t[2]]=i,a[t[3]]=o,a}}}};case 5:return function(n){return function(r){return function(i){return function(o){return function(a){var u;return(u={})[t[0]]=n,u[t[1]]=r,u[t[2]]=i,u[t[3]]=o,u[t[4]]=a,u}}}}};default:return zu(function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];for(var o={},a=0;a<n;a++)o[t[a]]=r[a];return o},n-1,[])}}UJ.sequenceT=function(t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var i=n.length,o=zl(i),a=t.map(n[0],o),u=1;u<i;u++)a=t.ap(a,n[u]);return a}},UJ.sequenceS=function(t){return function(n){for(var r=Object.keys(n),i=r.length,o=zc(r),a=t.map(n[r[0]],o),u=1;u<i;u++)a=t.ap(a,n[r[u]]);return a}};var zd={};function zf(t,n){return function(r){return function(i){return t.map(i,function(t){return n.map(t,r)})}}}Object.defineProperty(zd,"__esModule",{value:!0}),zd.getFunctorComposition=zd.bindTo=zd.flap=zd.map=void 0,zd.map=zf,zd.flap=function(t){return function(n){return function(r){return t.map(r,function(t){return t(n)})}}},zd.bindTo=function(t){return function(n){return function(r){return t.map(r,function(t){var r;return(r={})[n]=t,r})}}},zd.getFunctorComposition=function(t,n){var r=zf(t,n);return{map:function(t,n){return(0,UQ.pipe)(t,r(n))}}},Object.defineProperty(UY,"__esModule",{value:!0}),UY.getApplicativeComposition=UY.getApplicativeMonoid=void 0,UY.getApplicativeMonoid=function(t){var n=(0,UJ.getApplySemigroup)(t);return function(r){return{concat:n(r).concat,empty:t.of(r.empty)}}},UY.getApplicativeComposition=function(t,n){var r=(0,zd.getFunctorComposition)(t,n).map,i=(0,UJ.ap)(t,n);return{map:r,of:function(r){return t.of(n.of(r))},ap:function(t,n){return(0,UQ.pipe)(t,i(n))}}};var zp={};Object.defineProperty(zp,"__esModule",{value:!0}),zp.bind=zp.chainFirst=void 0,zp.chainFirst=function(t){return function(n){return function(r){return t.chain(r,function(r){return t.map(n(r),function(){return r})})}}},zp.bind=function(t){return function(n,r){return function(i){return t.chain(i,function(i){return t.map(r(i),function(t){var r;return Object.assign({},i,((r={})[n]=t,r))})})}}};var zh={};Object.defineProperty(zh,"__esModule",{value:!0}),zh.tailRec=void 0;var zm=function(t,n){for(var r=n(t);"Left"===r._tag;)r=n(r.left);return r.right};zh.tailRec=zm;var zg={},zy=k&&k.__createBinding||(Object.create?function(t,n,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(n,r);(!o||("get"in o?!n.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return n[r]}}),Object.defineProperty(t,i,o)}:function(t,n,r,i){void 0===i&&(i=r),t[i]=n[r]}),zv=k&&k.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),zb=k&&k.__importStar||function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&zy(n,t,r);return zv(n,t),n};Object.defineProperty(zg,"__esModule",{value:!0}),zg.filterOrElse=zg.chainFirstEitherK=zg.chainEitherK=zg.fromEitherK=zg.chainOptionK=zg.fromOptionK=zg.fromPredicate=zg.fromOption=void 0;var zx=zb(UX);function z_(t){return function(n){return function(r){return t.fromEither(zx.isNone(r)?zx.left(n()):zx.right(r.value))}}}function zS(t){var n=z_(t);return function(t){var r=n(t);return function(t){return(0,UQ.flow)(t,r)}}}function zT(t){return function(n){return(0,UQ.flow)(n,t.fromEither)}}zg.fromOption=z_,zg.fromPredicate=function(t){return function(n,r){return function(i){return t.fromEither(n(i)?zx.right(i):zx.left(r(i)))}}},zg.fromOptionK=zS,zg.chainOptionK=function(t,n){var r=zS(t);return function(t){var i=r(t);return function(t){return function(r){return n.chain(r,i(t))}}}},zg.fromEitherK=zT,zg.chainEitherK=function(t,n){var r=zT(t);return function(t){return function(i){return n.chain(i,r(t))}}},zg.chainFirstEitherK=function(t,n){return(0,UQ.flow)(zT(t),(0,zp.chainFirst)(n))},zg.filterOrElse=function(t,n){return function(r,i){return function(o){return n.chain(o,function(n){return t.fromEither(r(n)?zx.right(n):zx.left(i(n)))})}}};var zw,zO,zk,zC,zI,zM,zR,zE,zj,zA,zN={};Object.defineProperty(zw=zN,"__esModule",{value:!0}),zw.right=zw.left=zw.flap=zw.Functor=zw.Bifunctor=zw.URI=zw.bimap=zw.mapLeft=zw.map=zw.separated=void 0,zO=function(t,n){return{left:t,right:n}},zw.separated=zO,zk=function(t,n){return(0,UQ.pipe)(t,(0,zw.map)(n))},zC=function(t,n){return(0,UQ.pipe)(t,(0,zw.mapLeft)(n))},zI=function(t,n,r){return(0,UQ.pipe)(t,(0,zw.bimap)(n,r))},zM=function(t){return function(n){return(0,zw.separated)((0,zw.left)(n),t((0,zw.right)(n)))}},zw.map=zM,zR=function(t){return function(n){return(0,zw.separated)(t((0,zw.left)(n)),(0,zw.right)(n))}},zw.mapLeft=zR,zE=function(t,n){return function(r){return(0,zw.separated)(t((0,zw.left)(r)),n((0,zw.right)(r)))}},zw.bimap=zE,zw.URI="Separated",zw.Bifunctor={URI:zw.URI,mapLeft:zC,bimap:zI},zw.Functor={URI:zw.URI,map:zk},zw.flap=(0,zd.flap)(zw.Functor),zj=function(t){return t.left},zw.left=zj,zA=function(t){return t.right},zw.right=zA;var zP={},zL=k&&k.__createBinding||(Object.create?function(t,n,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(n,r);(!o||("get"in o?!n.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return n[r]}}),Object.defineProperty(t,i,o)}:function(t,n,r,i){void 0===i&&(i=r),t[i]=n[r]}),zF=k&&k.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),zD=k&&k.__importStar||function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&zL(n,t,r);return zF(n,t),n};Object.defineProperty(zP,"__esModule",{value:!0}),zP.filterE=zP.witherDefault=zP.wiltDefault=void 0;var zW=zD(UX);zP.wiltDefault=function(t,n){return function(r){var i=t.traverse(r);return function(t,o){return r.map(i(t,o),n.separate)}}},zP.witherDefault=function(t,n){return function(r){var i=t.traverse(r);return function(t,o){return r.map(i(t,o),n.compact)}}},zP.filterE=function(t){return function(n){var r=t.wither(n);return function(t){return function(i){return r(i,function(r){return n.map(t(r),function(t){return t?zW.some(r):zW.none})})}}}},BM=UZ,BR=k&&k.__createBinding||(Object.create?function(t,n,r,i){void 0===i&&(i=r);var o=Object.getOwnPropertyDescriptor(n,r);(!o||("get"in o?!n.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return n[r]}}),Object.defineProperty(t,i,o)}:function(t,n,r,i){void 0===i&&(i=r),t[i]=n[r]}),BE=k&&k.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),Bj=k&&k.__importStar||function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&BR(n,t,r);return BE(n,t),n},Object.defineProperty(BM,"__esModule",{value:!0}),BM.fold=BM.match=BM.foldW=BM.matchW=BM.isRight=BM.isLeft=BM.fromOption=BM.fromPredicate=BM.FromEither=BM.MonadThrow=BM.throwError=BM.ChainRec=BM.Extend=BM.extend=BM.Alt=BM.alt=BM.altW=BM.Bifunctor=BM.mapLeft=BM.bimap=BM.Traversable=BM.sequence=BM.traverse=BM.Foldable=BM.reduceRight=BM.foldMap=BM.reduce=BM.Monad=BM.Chain=BM.chain=BM.chainW=BM.Applicative=BM.Apply=BM.ap=BM.apW=BM.Pointed=BM.of=BM.Functor=BM.map=BM.getAltValidation=BM.getApplicativeValidation=BM.getWitherable=BM.getFilterable=BM.getCompactable=BM.getSemigroup=BM.getEq=BM.getShow=BM.URI=BM.right=BM.left=void 0,BM.getValidation=BM.getValidationMonoid=BM.getValidationSemigroup=BM.getApplyMonoid=BM.getApplySemigroup=BM.either=BM.stringifyJSON=BM.parseJSON=BM.sequenceArray=BM.traverseArray=BM.traverseArrayWithIndex=BM.traverseReadonlyArrayWithIndex=BM.traverseReadonlyNonEmptyArrayWithIndex=BM.ApT=BM.apSW=BM.apS=BM.bindW=BM.bind=BM.bindTo=BM.Do=BM.exists=BM.elem=BM.toError=BM.toUnion=BM.chainNullableK=BM.fromNullableK=BM.tryCatchK=BM.tryCatch=BM.fromNullable=BM.orElse=BM.orElseW=BM.swap=BM.filterOrElseW=BM.filterOrElse=BM.chainOptionK=BM.fromOptionK=BM.duplicate=BM.flatten=BM.flattenW=BM.chainFirstW=BM.chainFirst=BM.apSecondW=BM.apSecond=BM.apFirstW=BM.apFirst=BM.flap=BM.getOrElse=BM.getOrElseW=void 0,BA=Bj(UX),BM.left=BA.left,BM.right=BA.right,BN=function(t,n){return(0,UQ.pipe)(t,(0,BM.map)(n))},BP=function(t,n){return(0,UQ.pipe)(t,(0,BM.ap)(n))},BL=function(t,n){return(0,UQ.pipe)(t,(0,BM.chain)(n))},BF=function(t,n,r){return(0,UQ.pipe)(t,(0,BM.reduce)(n,r))},BD=function(t){return function(n,r){var i=(0,BM.foldMap)(t);return(0,UQ.pipe)(n,i(r))}},BW=function(t,n,r){return(0,UQ.pipe)(t,(0,BM.reduceRight)(n,r))},BU=function(t){var n=(0,BM.traverse)(t);return function(t,r){return(0,UQ.pipe)(t,n(r))}},Bz=function(t,n,r){return(0,UQ.pipe)(t,(0,BM.bimap)(n,r))},BB=function(t,n){return(0,UQ.pipe)(t,(0,BM.mapLeft)(n))},BV=function(t,n){return(0,UQ.pipe)(t,(0,BM.alt)(n))},B$=function(t,n){return(0,UQ.pipe)(t,(0,BM.extend)(n))},Bq=function(t,n){return(0,zh.tailRec)(n(t),function(t){return(0,BM.isLeft)(t)?(0,BM.right)((0,BM.left)(t.left)):(0,BM.isLeft)(t.right)?(0,BM.left)(n(t.right.left)):(0,BM.right)((0,BM.right)(t.right.right))})},BM.URI="Either",BK=function(t,n){return{show:function(r){return(0,BM.isLeft)(r)?"left(".concat(t.show(r.left),")"):"right(".concat(n.show(r.right),")")}}},BM.getShow=BK,BH=function(t,n){return{equals:function(r,i){return r===i||((0,BM.isLeft)(r)?(0,BM.isLeft)(i)&&t.equals(r.left,i.left):(0,BM.isRight)(i)&&n.equals(r.right,i.right))}}},BM.getEq=BH,BG=function(t){return{concat:function(n,r){return(0,BM.isLeft)(r)?n:(0,BM.isLeft)(n)?r:(0,BM.right)(t.concat(n.right,r.right))}}},BM.getSemigroup=BG,BZ=function(t){var n=(0,BM.left)(t.empty);return{URI:BM.URI,_E:void 0,compact:function(t){return(0,BM.isLeft)(t)?t:"None"===t.right._tag?n:(0,BM.right)(t.right.value)},separate:function(t){return(0,BM.isLeft)(t)?(0,zN.separated)(t,t):(0,BM.isLeft)(t.right)?(0,zN.separated)((0,BM.right)(t.right.left),n):(0,zN.separated)(n,(0,BM.right)(t.right.right))}}},BM.getCompactable=BZ,BY=function(t){var n=(0,BM.left)(t.empty),r=(0,BM.getCompactable)(t),i=r.compact,o=r.separate,a=function(t,r){return(0,BM.isLeft)(t)||r(t.right)?t:n},u=function(t,r){return(0,BM.isLeft)(t)?(0,zN.separated)(t,t):r(t.right)?(0,zN.separated)(n,(0,BM.right)(t.right)):(0,zN.separated)((0,BM.right)(t.right),n)};return{URI:BM.URI,_E:void 0,map:BN,compact:i,separate:o,filter:a,filterMap:function(t,r){if((0,BM.isLeft)(t))return t;var i=r(t.right);return"None"===i._tag?n:(0,BM.right)(i.value)},partition:u,partitionMap:function(t,r){if((0,BM.isLeft)(t))return(0,zN.separated)(t,t);var i=r(t.right);return(0,BM.isLeft)(i)?(0,zN.separated)((0,BM.right)(i.left),n):(0,zN.separated)(n,(0,BM.right)(i.right))}}},BM.getFilterable=BY,BJ=function(t){var n=(0,BM.getFilterable)(t),r=(0,BM.getCompactable)(t);return{URI:BM.URI,_E:void 0,map:BN,compact:n.compact,separate:n.separate,filter:n.filter,filterMap:n.filterMap,partition:n.partition,partitionMap:n.partitionMap,traverse:BU,sequence:BM.sequence,reduce:BF,foldMap:BD,reduceRight:BW,wither:(0,zP.witherDefault)(BM.Traversable,r),wilt:(0,zP.wiltDefault)(BM.Traversable,r)}},BM.getWitherable=BJ,BQ=function(t){return{URI:BM.URI,_E:void 0,map:BN,ap:function(n,r){return(0,BM.isLeft)(n)?(0,BM.isLeft)(r)?(0,BM.left)(t.concat(n.left,r.left)):n:(0,BM.isLeft)(r)?r:(0,BM.right)(n.right(r.right))},of:BM.of}},BM.getApplicativeValidation=BQ,BX=function(t){return{URI:BM.URI,_E:void 0,map:BN,alt:function(n,r){if((0,BM.isRight)(n))return n;var i=r();return(0,BM.isLeft)(i)?(0,BM.left)(t.concat(n.left,i.left)):i}}},BM.getAltValidation=BX,B0=function(t){return function(n){return(0,BM.isLeft)(n)?n:(0,BM.right)(t(n.right))}},BM.map=B0,BM.Functor={URI:BM.URI,map:BN},BM.of=BM.right,BM.Pointed={URI:BM.URI,of:BM.of},B1=function(t){return function(n){return(0,BM.isLeft)(n)?n:(0,BM.isLeft)(t)?t:(0,BM.right)(n.right(t.right))}},BM.apW=B1,BM.ap=BM.apW,BM.Apply={URI:BM.URI,map:BN,ap:BP},BM.Applicative={URI:BM.URI,map:BN,ap:BP,of:BM.of},B2=function(t){return function(n){return(0,BM.isLeft)(n)?n:t(n.right)}},BM.chainW=B2,BM.chain=BM.chainW,BM.Chain={URI:BM.URI,map:BN,ap:BP,chain:BL},BM.Monad={URI:BM.URI,map:BN,ap:BP,of:BM.of,chain:BL},B3=function(t,n){return function(r){return(0,BM.isLeft)(r)?t:n(t,r.right)}},BM.reduce=B3,B4=function(t){return function(n){return function(r){return(0,BM.isLeft)(r)?t.empty:n(r.right)}}},BM.foldMap=B4,B5=function(t,n){return function(r){return(0,BM.isLeft)(r)?t:n(r.right,t)}},BM.reduceRight=B5,BM.Foldable={URI:BM.URI,reduce:BF,foldMap:BD,reduceRight:BW},B6=function(t){return function(n){return function(r){return(0,BM.isLeft)(r)?t.of((0,BM.left)(r.left)):t.map(n(r.right),BM.right)}}},BM.traverse=B6,B9=function(t){return function(n){return(0,BM.isLeft)(n)?t.of((0,BM.left)(n.left)):t.map(n.right,BM.right)}},BM.sequence=B9,BM.Traversable={URI:BM.URI,map:BN,reduce:BF,foldMap:BD,reduceRight:BW,traverse:BU,sequence:BM.sequence},B8=function(t,n){return function(r){return(0,BM.isLeft)(r)?(0,BM.left)(t(r.left)):(0,BM.right)(n(r.right))}},BM.bimap=B8,B7=function(t){return function(n){return(0,BM.isLeft)(n)?(0,BM.left)(t(n.left)):n}},BM.mapLeft=B7,BM.Bifunctor={URI:BM.URI,bimap:Bz,mapLeft:BB},Ve=function(t){return function(n){return(0,BM.isLeft)(n)?t():n}},BM.altW=Ve,BM.alt=BM.altW,BM.Alt={URI:BM.URI,map:BN,alt:BV},Vt=function(t){return function(n){return(0,BM.isLeft)(n)?n:(0,BM.right)(t(n))}},BM.extend=Vt,BM.Extend={URI:BM.URI,map:BN,extend:B$},BM.ChainRec={URI:BM.URI,map:BN,ap:BP,chain:BL,chainRec:Bq},BM.throwError=BM.left,BM.MonadThrow={URI:BM.URI,map:BN,ap:BP,of:BM.of,chain:BL,throwError:BM.throwError},BM.FromEither={URI:BM.URI,fromEither:UQ.identity},BM.fromPredicate=(0,zg.fromPredicate)(BM.FromEither),BM.fromOption=(0,zg.fromOption)(BM.FromEither),BM.isLeft=BA.isLeft,BM.isRight=BA.isRight,Vn=function(t,n){return function(r){return(0,BM.isLeft)(r)?t(r.left):n(r.right)}},BM.matchW=Vn,BM.foldW=BM.matchW,BM.match=BM.matchW,BM.fold=BM.match,Vr=function(t){return function(n){return(0,BM.isLeft)(n)?t(n.left):n.right}},BM.getOrElseW=Vr,BM.getOrElse=BM.getOrElseW,BM.flap=(0,zd.flap)(BM.Functor),BM.apFirst=(0,UJ.apFirst)(BM.Apply),BM.apFirstW=BM.apFirst,BM.apSecond=(0,UJ.apSecond)(BM.Apply),BM.apSecondW=BM.apSecond,BM.chainFirst=(0,zp.chainFirst)(BM.Chain),BM.chainFirstW=BM.chainFirst,BM.flattenW=(0,BM.chainW)(UQ.identity),BM.flatten=BM.flattenW,BM.duplicate=(0,BM.extend)(UQ.identity),BM.fromOptionK=(0,zg.fromOptionK)(BM.FromEither),BM.chainOptionK=(0,zg.chainOptionK)(BM.FromEither,BM.Chain),BM.filterOrElse=(0,zg.filterOrElse)(BM.FromEither,BM.Chain),BM.filterOrElseW=BM.filterOrElse,Vi=function(t){return(0,BM.isLeft)(t)?(0,BM.right)(t.left):(0,BM.left)(t.right)},BM.swap=Vi,Vo=function(t){return function(n){return(0,BM.isLeft)(n)?t(n.left):n}},BM.orElseW=Vo,BM.orElse=BM.orElseW,Va=function(t){return function(n){return null==n?(0,BM.left)(t):(0,BM.right)(n)}},BM.fromNullable=Va,Vu=function(t,n){try{return(0,BM.right)(t())}catch(r){return(0,BM.left)(n(r))}},BM.tryCatch=Vu,Vs=function(t,n){return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];return(0,BM.tryCatch)(function(){return t.apply(void 0,r)},n)}},BM.tryCatchK=Vs,Vl=function(t){var n=(0,BM.fromNullable)(t);return function(t){return(0,UQ.flow)(t,n)}},BM.fromNullableK=Vl,Vc=function(t){var n=(0,BM.fromNullableK)(t);return function(t){return(0,BM.chain)(n(t))}},BM.chainNullableK=Vc,BM.toUnion=(0,BM.foldW)(UQ.identity,UQ.identity),BM.toError=function(t){return t instanceof Error?t:Error(String(t))},BM.elem=function t(n){return function(r,i){if(void 0===i){var o=t(n);return function(t){return o(r,t)}}return!(0,BM.isLeft)(i)&&n.equals(r,i.right)}},Vd=function(t){return function(n){return!(0,BM.isLeft)(n)&&t(n.right)}},BM.exists=Vd,BM.Do=(0,BM.of)(BA.emptyRecord),BM.bindTo=(0,zd.bindTo)(BM.Functor),BM.bind=(0,zp.bind)(BM.Chain),BM.bindW=BM.bind,BM.apS=(0,UJ.apS)(BM.Apply),BM.apSW=BM.apS,BM.ApT=(0,BM.of)(BA.emptyReadonlyArray),Vf=function(t){return function(n){var r=t(0,BA.head(n));if((0,BM.isLeft)(r))return r;for(var i=[r.right],o=1;o<n.length;o++){var a=t(o,n[o]);if((0,BM.isLeft)(a))return a;i.push(a.right)}return(0,BM.right)(i)}},BM.traverseReadonlyNonEmptyArrayWithIndex=Vf,Vp=function(t){var n=(0,BM.traverseReadonlyNonEmptyArrayWithIndex)(t);return function(t){return BA.isNonEmpty(t)?n(t):BM.ApT}},BM.traverseReadonlyArrayWithIndex=Vp,BM.traverseArrayWithIndex=BM.traverseReadonlyArrayWithIndex,Vh=function(t){return(0,BM.traverseReadonlyArrayWithIndex)(function(n,r){return t(r)})},BM.traverseArray=Vh,BM.sequenceArray=(0,BM.traverseArray)(UQ.identity),BM.parseJSON=function(t,n){return(0,BM.tryCatch)(function(){return JSON.parse(t)},n)},Vm=function(t,n){return(0,BM.tryCatch)(function(){var n=JSON.stringify(t);if("string"!=typeof n)throw Error("Converting unsupported structure to JSON");return n},n)},BM.stringifyJSON=Vm,BM.either={URI:BM.URI,map:BN,of:BM.of,ap:BP,chain:BL,reduce:BF,foldMap:BD,reduceRight:BW,traverse:BU,sequence:BM.sequence,bimap:Bz,mapLeft:BB,alt:BV,extend:B$,chainRec:Bq,throwError:BM.throwError},BM.getApplySemigroup=(0,UJ.getApplySemigroup)(BM.Apply),BM.getApplyMonoid=(0,UY.getApplicativeMonoid)(BM.Applicative),Vg=function(t,n){return(0,UJ.getApplySemigroup)((0,BM.getApplicativeValidation)(t))(n)},BM.getValidationSemigroup=Vg,Vy=function(t,n){return(0,UY.getApplicativeMonoid)((0,BM.getApplicativeValidation)(t))(n)},BM.getValidationMonoid=Vy,BM.getValidation=function(t){var n=(0,BM.getApplicativeValidation)(t).ap,r=(0,BM.getAltValidation)(t).alt;return{URI:BM.URI,_E:void 0,map:BN,of:BM.of,chain:BL,bimap:Bz,mapLeft:BB,reduce:BF,foldMap:BD,reduceRight:BW,extend:B$,traverse:BU,sequence:BM.sequence,chainRec:Bq,throwError:BM.throwError,ap:n,alt:r}};var zU=globalThis&&globalThis.__extends||(Vv=function(t,n){return(Vv=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])})(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}Vv(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),zz=globalThis&&globalThis.__assign||function(){return(zz=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++)for(var o in n=arguments[r])Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o]);return t}).apply(this,arguments)},zB=globalThis&&globalThis.__spreadArray||function(t,n,r){if(r||2===arguments.length)for(var i,o=0,a=n.length;o<a;o++)!i&&o in n||(i||(i=Array.prototype.slice.call(n,0,o)),i[o]=n[o]);return t.concat(i||Array.prototype.slice.call(n))},zV=function(t,n,r){return rw([{value:t,context:n,message:r}])},z$=function(){function t(t,n,r,i){this.name=t,this.is=n,this.validate=r,this.encode=i,this.decode=this.decode.bind(this)}return t.prototype.pipe=function(n,r){var i=this;return void 0===r&&(r="pipe(".concat(this.name,", ").concat(n.name,")")),new t(r,n.is,function(t,r){var o=i.validate(t,r);return gi(o)?o:n.validate(o.right,r)},this.encode===zq&&n.encode===zq?zq:function(t){return i.encode(n.encode(t))})},t.prototype.asDecoder=function(){return this},t.prototype.asEncoder=function(){return this},t.prototype.decode=function(t){return this.validate(t,[{key:"",type:this,actual:t}])},t}(),zq=function(t){return t};function zK(t){return t.displayName||t.name||"<function".concat(t.length,">")}function zH(t,n,r,i){for(var o=t.length,a=Array(o+1),u=0;u<o;u++)a[u]=t[u];return a[o]={key:n,type:r,actual:i},a}function zG(t,n){for(var r=n.length,i=0;i<r;i++)t.push(n[i])}var zZ=Object.prototype.hasOwnProperty;function zY(t){return Object.keys(t).map(function(n){return"".concat(n,": ").concat(t[n].name)}).join(", ")}function zJ(t){for(var n=0;n<t.length;n++)if(t[n].encode!==zq)return!1;return!0}function zQ(t){return"{ ".concat(zY(t)," }")}function zX(t){return"Partial<".concat(t,">")}function z0(t){if(z8(t)){var n,r,i=t.value;if(Bp.is(i))return(n={})[i]=null,n}else{if(r=t,"KeyofType"===r._tag)return t.keys;if(Be(t)){var o=t.types.map(function(t){return z0(t)});return o.some(Bu.is)?void 0:Object.assign.apply(Object,zB([{}],o,!1))}}}function z1(t){return"("+t.map(function(t){return t.name}).join(" | ")+")"}function z2(t,n){for(var r=!0,i=!0,o=!BT.is(t),a=0;a<n.length;a++){var u=n[a];u!==t&&(r=!1),BT.is(u)&&(i=!1)}if(r)return t;if(i)return n[n.length-1];for(var s={},l=0;l<n.length;l++){var u=n[l];for(var c in u)(!zZ.call(s,c)||o||u[c]!==t[c])&&(s[c]=u[c])}return s}function z3(t,n){for(var r=Object.getOwnPropertyNames(t),i=!1,o={},a=0;a<r.length;a++){var u=r[a];zZ.call(n,u)?o[u]=t[u]:i=!0}return i?o:t}function z4(t){return t.length>0}var z5={};function z6(t,n){for(var r=[],i=0;i<t.length;i++){var o=t[i];-1!==n.indexOf(o)&&r.push(o)}return r}function z9(t){return"AnyType"===t._tag}function z8(t){return"LiteralType"===t._tag}function z7(t){return"InterfaceType"===t._tag}function Be(t){return"UnionType"===t._tag}var Bt=[];function Bn(t){if(-1!==Bt.indexOf(t))return z5;if(z7(t)||"StrictType"===(n=t)._tag){var n,r,i,o,a,u=z5;for(var s in t.props){var l=t.props[s];z8(l)&&(u===z5&&(u={}),u[s]=[l.value])}return u}if("ExactType"===t._tag||"RefinementType"===t._tag)return Bn(t.type);if("IntersectionType"===t._tag)return t.types.reduce(function(t,n){return function(t,n){if(t===z5)return n;if(n===z5)return t;var r=Object.assign({},t);for(var i in n)if(zZ.call(t,i)){var o=z6(t[i],n[i]);if(z4(o))r[i]=o;else{r=z5;break}}else r[i]=n[i];return r}(t,Bn(n))},z5);if(Be(t))return t.types.slice(1).reduce(function(t,n){return function(t,n){if(t===z5||n===z5)return z5;var r=z5;for(var i in t)zZ.call(n,i)&&0===z6(t[i],n[i]).length&&(r===z5&&(r={}),r[i]=t[i].concat(n[i]));return r}(t,Bn(n))},Bn(t.types[0]));if("RecursiveType"===t._tag){Bt.push(t);var c=Bn(t.type);return Bt.pop(),c}return z5}function Br(t){var n=Bn(t[0]),r=Object.keys(n),i=t.length;e:for(var o=0;o<r.length;o++){var a=function(r){for(var o=n[r].slice(),a=[n[r]],u=1;u<i;u++){var s=Bn(t[u])[r];if(void 0===s||s.some(function(t){return -1!==o.indexOf(t)}))return"continue-keys";o.push.apply(o,s),a.push(s)}return{value:[r,a]}}(r[o]);if("object"==typeof a)return a.value;if("continue-keys"===a)continue e}}var Bi=function(t){function n(){var n=t.call(this,"null",function(t){return null===t},function(t,r){return n.is(t)?rO(t):zV(t,r)},zq)||this;return n._tag="NullType",n}return zU(n,t),n}(z$),Bo=new Bi,Ba=function(t){function n(){var n=t.call(this,"undefined",function(t){return void 0===t},function(t,r){return n.is(t)?rO(t):zV(t,r)},zq)||this;return n._tag="UndefinedType",n}return zU(n,t),n}(z$),Bu=new Ba,Bs=function(t){function n(){var n=t.call(this,"void",Bu.is,Bu.validate,zq)||this;return n._tag="VoidType",n}return zU(n,t),n}(z$),Bl=new Bs,Bc=function(t){function n(){var n=t.call(this,"unknown",function(t){return!0},rO,zq)||this;return n._tag="UnknownType",n}return zU(n,t),n}(z$),Bd=new Bc,Bf=function(t){function n(){var n=t.call(this,"string",function(t){return"string"==typeof t},function(t,r){return n.is(t)?rO(t):zV(t,r)},zq)||this;return n._tag="StringType",n}return zU(n,t),n}(z$),Bp=new Bf,Bh=function(t){function n(){var n=t.call(this,"number",function(t){return"number"==typeof t},function(t,r){return n.is(t)?rO(t):zV(t,r)},zq)||this;return n._tag="NumberType",n}return zU(n,t),n}(z$),Bm=new Bh,Bg=function(t){function n(){var n=t.call(this,"bigint",function(t){return"bigint"==typeof t},function(t,r){return n.is(t)?rO(t):zV(t,r)},zq)||this;return n._tag="BigIntType",n}return zU(n,t),n}(z$),By=new Bg,Bv=function(t){function n(){var n=t.call(this,"boolean",function(t){return"boolean"==typeof t},function(t,r){return n.is(t)?rO(t):zV(t,r)},zq)||this;return n._tag="BooleanType",n}return zU(n,t),n}(z$),Bb=new Bv,Bx=function(t){function n(){var n=t.call(this,"UnknownArray",Array.isArray,function(t,r){return n.is(t)?rO(t):zV(t,r)},zq)||this;return n._tag="AnyArrayType",n}return zU(n,t),n}(z$),B_=new Bx,BS=function(t){function n(){var n=t.call(this,"UnknownRecord",function(t){var n=Object.prototype.toString.call(t);return"[object Object]"===n||"[object Window]"===n},function(t,r){return n.is(t)?rO(t):zV(t,r)},zq)||this;return n._tag="AnyDictionaryType",n}return zU(n,t),n}(z$),BT=new BS,Bw=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.value=a,u._tag="LiteralType",u}return zU(n,t),n}(z$);function BO(t,n){void 0===n&&(n=JSON.stringify(t));var r=function(n){return n===t};return new Bw(n,r,function(n,i){return r(n)?rO(t):zV(n,i)},zq,t)}var Bk=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.keys=a,u._tag="KeyofType",u}return zU(n,t),n}(z$),BC=function(t){function n(n,r,i,o,a,u){var s=t.call(this,n,r,i,o)||this;return s.type=a,s.predicate=u,s._tag="RefinementType",s}return zU(n,t),n}(z$);function BI(t,n,r){return VX(t,n,r)}var BM,BR,BE,Bj,BA,BN,BP,BL,BF,BD,BW,BU,Bz,BB,BV,B$,Bq,BK,BH,BG,BZ,BY,BJ,BQ,BX,B0,B1,B2,B3,B4,B5,B6,B9,B8,B7,Ve,Vt,Vn,Vr,Vi,Vo,Va,Vu,Vs,Vl,Vc,Vd,Vf,Vp,Vh,Vm,Vg,Vy,Vv,Vb,Vx,V_=VX(Bm,Vx=function(t){return Number.isInteger(t)},"Int"),VS=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.runDefinition=a,u._tag="RecursiveType",u}return zU(n,t),n}(z$);function VT(t,n){var r,i=function(){return r||((r=n(o)).name=t),r},o=new VS(t,function(t){return i().is(t)},function(t,n){return i().validate(t,n)},function(t){return i().encode(t)},i);return o}Object.defineProperty(VS.prototype,"type",{get:function(){return this.runDefinition()},enumerable:!0,configurable:!0});var Vw=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.type=a,u._tag="ArrayType",u}return zU(n,t),n}(z$);function VO(t,n){return void 0===n&&(n="Array<".concat(t.name,">")),new Vw(n,function(n){return B_.is(n)&&n.every(t.is)},function(n,r){var i=B_.validate(n,r);if(gi(i))return i;for(var o=i.right,a=o.length,u=o,s=[],l=0;l<a;l++){var c=o[l],d=t.validate(c,zH(r,String(l),t,c));if(gi(d))zG(s,d.left);else{var f=d.right;f!==c&&(u===o&&(u=o.slice()),u[l]=f)}}return s.length>0?rw(s):rO(u)},t.encode===zq?zq:function(n){return n.map(t.encode)},t)}var Vk=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.props=a,u._tag="InterfaceType",u}return zU(n,t),n}(z$);function VC(t,n){void 0===n&&(n=zQ(t));var r=Object.keys(t),i=r.map(function(n){return t[n]}),o=r.length;return new Vk(n,function(t){if(BT.is(t)){for(var n=0;n<o;n++){var a=r[n],u=t[a];if(void 0===u&&!zZ.call(t,a)||!i[n].is(u))return!1}return!0}return!1},function(t,n){var a=BT.validate(t,n);if(gi(a))return a;for(var u=a.right,s=u,l=[],c=0;c<o;c++){var d=r[c],f=s[d],p=i[c],h=p.validate(f,zH(n,d,p,f));if(gi(h))zG(l,h.left);else{var m=h.right;m===f&&(void 0!==m||zZ.call(s,d))||(s===u&&(s=zz({},u)),s[d]=m)}}return l.length>0?rw(l):rO(s)},zJ(i)?zq:function(t){for(var n=zz({},t),a=0;a<o;a++){var u=r[a],s=i[a].encode;s!==zq&&(n[u]=s(t[u]))}return n},t)}var VI=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.props=a,u._tag="PartialType",u}return zU(n,t),n}(z$),VM=function(t){function n(n,r,i,o,a,u){var s=t.call(this,n,r,i,o)||this;return s.domain=a,s.codomain=u,s._tag="DictionaryType",s}return zU(n,t),n}(z$);function VR(t,n,r){var i,o,a,u,s,l,c,d,f=z0(t);return f?(i=Object.keys(f),void 0===(u=r)&&(u="{ [K in ".concat(t.name,"]: ").concat(n.name," }")),s=i.length,new VM(u,function(t){return BT.is(t)&&i.every(function(r){return n.is(t[r])})},function(t,r){var o=BT.validate(t,r);if(gi(o))return o;for(var a=o.right,u={},l=[],c=!1,d=0;d<s;d++){var f=i[d],p=a[f],h=n.validate(p,zH(r,f,n,p));if(gi(h))zG(l,h.left);else{var m=h.right;c=c||m!==p,u[f]=m}}return l.length>0?rw(l):rO(c||Object.keys(a).length!==s?u:a)},n.encode===zq?zq:function(t){for(var r={},o=0;o<s;o++){var a=i[o];r[a]=n.encode(t[a])}return r},t,n)):(l=t,void 0===(d=r)&&(d="{ [K in ".concat(l.name,"]: ").concat(n.name," }")),new VM(d,function(t){return BT.is(t)?Object.keys(t).every(function(r){return l.is(r)&&n.is(t[r])}):z9(n)&&Array.isArray(t)},function(t,r){if(BT.is(t)){for(var i={},o=[],a=Object.keys(t),u=a.length,s=!1,c=0;c<u;c++){var d=a[c],f=t[d],p=l.validate(d,zH(r,d,l,d));if(gi(p))zG(o,p.left);else{var h=p.right;s=s||h!==d,d=h;var m=n.validate(f,zH(r,d,n,f));if(gi(m))zG(o,m.left);else{var g=m.right;s=s||g!==f,i[d]=g}}}return o.length>0?rw(o):rO(s?i:t)}return z9(n)&&Array.isArray(t)?rO(t):zV(t,r)},l.encode===zq&&n.encode===zq?zq:function(t){for(var r={},i=Object.keys(t),o=i.length,a=0;a<o;a++){var u=i[a];r[String(l.encode(u))]=n.encode(t[u])}return r},l,n))}var VE=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.types=a,u._tag="UnionType",u}return zU(n,t),n}(z$);function Vj(t,n){void 0===n&&(n=z1(t));var r=Br(t);if(void 0===r||!(t.length>0))return new VE(n,function(n){return t.some(function(t){return t.is(n)})},function(n,r){for(var i=[],o=0;o<t.length;o++){var a=t[o],u=a.validate(n,zH(r,String(o),a,n));if(!gi(u))return rO(u.right);zG(i,u.left)}return rw(i)},zJ(t)?zq:function(r){for(var i=0;i<t.length;i++){var o=t[i];if(o.is(r))return o.encode(r)}throw Error("no codec found to encode value in union type ".concat(n))},t);var i=r[0],o=r[1],a=o.length,u=function(t){for(var n=0;n<a;n++)if(-1!==o[n].indexOf(t))return n};return new VV(n,function(n){if(BT.is(n)){var r=u(n[i]);return void 0!==r&&t[r].is(n)}return!1},function(n,r){var o=BT.validate(n,r);if(gi(o))return o;var a=o.right,s=u(a[i]);if(void 0===s)return zV(n,r);var l=t[s];return l.validate(a,zH(r,String(s),l,a))},zJ(t)?zq:function(r){var o=u(r[i]);if(void 0===o)throw Error("no codec found to encode value in union codec ".concat(n));return t[o].encode(r)},t,i)}var VA=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.types=a,u._tag="IntersectionType",u}return zU(n,t),n}(z$),VN=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.types=a,u._tag="TupleType",u}return zU(n,t),n}(z$),VP=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.type=a,u._tag="ReadonlyType",u}return zU(n,t),n}(z$),VL=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.type=a,u._tag="ReadonlyArrayType",u}return zU(n,t),n}(z$);function VF(t,n){void 0===n&&(n="ReadonlyArray<".concat(t.name,">"));var r=VO(t);return new VL(n,r.is,r.validate,r.encode,t)}var VD=function(t,n){return VU(VC(t),n)},VW=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.type=a,u._tag="ExactType",u}return zU(n,t),n}(z$);function VU(t,n){void 0===n&&(n=z7(i=t)?"{| ".concat(zY(i.props)," |}"):(r=i,"PartialType"===r._tag)?zX("{| ".concat(zY(i.props)," |}")):"Exact<".concat(i.name,">"));var r,i,o=function t(n){switch(n._tag){case"RefinementType":case"ReadonlyType":return t(n.type);case"InterfaceType":case"StrictType":case"PartialType":return n.props;case"IntersectionType":return n.types.reduce(function(n,r){return Object.assign(n,t(r))},{})}}(t);return new VW(n,t.is,function(n,r){var i=BT.validate(n,r);if(gi(i))return i;var a=t.validate(n,r);return gi(a)?a:rO(z3(a.right,o))},function(n){return t.encode(z3(n,o))},t)}var Vz=function(t){function n(){var n=t.call(this,"Function",function(t){return"function"==typeof t},function(t,r){return n.is(t)?rO(t):zV(t,r)},zq)||this;return n._tag="FunctionType",n}return zU(n,t),n}(z$),VB=new Vz,VV=function(t){function n(n,r,i,o,a,u){var s=t.call(this,n,r,i,o,a)||this;return s.tag=u,s}return zU(n,t),n}(VE),V$=function(t,n,r){void 0===r&&(r=z1(n));var i=Vj(n,r);return i instanceof VV?i:(console.warn("[io-ts] Cannot build a tagged union for ".concat(r,", returning a de-optimized union")),new VV(r,i.is,i.validate,i.encode,n,t))},Vq=function(t,n){return{value:t,context:n}},VK=function(t){return[{key:"",type:t}]},VH=function(t){function n(){var n=t.call(this,"never",function(t){return!1},function(t,n){return zV(t,n)},function(){throw Error("cannot encode never")})||this;return n._tag="NeverType",n}return zU(n,t),n}(z$),VG=new VH,VZ=function(t){function n(){var n=t.call(this,"any",function(t){return!0},rO,zq)||this;return n._tag="AnyType",n}return zU(n,t),n}(z$),VY=new VZ,VJ=function(t){function n(){var n=t.call(this,"object",function(t){return null!==t&&"object"==typeof t},function(t,r){return n.is(t)?rO(t):zV(t,r)},zq)||this;return n._tag="ObjectType",n}return zU(n,t),n}(z$),VQ=new VJ;function VX(t,n,r){return void 0===r&&(r="(".concat(t.name," | ").concat(zK(n),")")),new BC(r,function(r){return t.is(r)&&n(r)},function(r,i){var o=t.validate(r,i);if(gi(o))return o;var a=o.right;return n(a)?rO(a):zV(a,i)},t.encode,t,n)}var V0=VX(Bm,Number.isInteger,"Integer"),V1=function(t){function n(n,r,i,o,a){var u=t.call(this,n,r,i,o)||this;return u.props=a,u._tag="StrictType",u}return zU(n,t),n}(z$);function V2(t){return t}let V3=Object.freeze(Object.defineProperty({__proto__:null,AnyArrayType:Bx,AnyDictionaryType:BS,AnyType:VZ,Array:B_,ArrayType:Vw,BigIntType:Bg,BooleanType:Bv,Dictionary:BT,DictionaryType:VM,ExactType:VW,Function:VB,FunctionType:Vz,Int:V_,Integer:V0,InterfaceType:Vk,IntersectionType:VA,KeyofType:Bk,LiteralType:Bw,NeverType:VH,NullType:Bi,NumberType:Bh,ObjectType:VJ,PartialType:VI,ReadonlyArrayType:VL,ReadonlyType:VP,RecursiveType:VS,RefinementType:BC,StrictType:V1,StringType:Bf,TaggedUnionType:VV,TupleType:VN,Type:z$,UndefinedType:Ba,UnionType:VE,UnknownArray:B_,UnknownRecord:BT,UnknownType:Bc,VoidType:Bs,alias:function(t){return function(){return t}},any:VY,appendContext:zH,array:VO,bigint:By,boolean:Bb,brand:BI,clean:V2,dictionary:VR,emptyTags:z5,exact:VU,failure:zV,failures:rw,getContextEntry:function(t,n){return{key:t,type:n}},getDefaultContext:VK,getDomainKeys:z0,getFunctionName:zK,getIndex:Br,getTags:Bn,getValidationError:Vq,identity:zq,interface:VC,intersection:function(t,n){void 0===n&&(n="(".concat(t.map(function(t){return t.name}).join(" & "),")"));var r=t.length;return new VA(n,function(n){return t.every(function(t){return t.is(n)})},0===t.length?rO:function(n,i){for(var o=[],a=[],u=0;u<r;u++){var s=t[u],l=s.validate(n,zH(i,String(u),s,n));gi(l)?zG(a,l.left):o.push(l.right)}return a.length>0?rw(a):rO(z2(n,o))},0===t.length?zq:function(n){return z2(n,t.map(function(t){return t.encode(n)}))},t)},keyof:function(t,n){void 0===n&&(n=Object.keys(t).map(function(t){return JSON.stringify(t)}).join(" | "));var r=function(n){return Bp.is(n)&&zZ.call(t,n)};return new Bk(n,r,function(t,n){return r(t)?rO(t):zV(t,n)},zq,t)},literal:BO,mergeAll:z2,never:VG,null:Bo,nullType:Bo,number:Bm,object:VQ,partial:function(t,n){void 0===n&&(n=zX(zQ(t)));var r=Object.keys(t),i=r.map(function(n){return t[n]}),o=r.length;return new VI(n,function(n){if(BT.is(n)){for(var i=0;i<o;i++){var a=r[i],u=n[a];if(void 0!==u&&!t[a].is(u))return!1}return!0}return!1},function(n,i){var a=BT.validate(n,i);if(gi(a))return a;for(var u=a.right,s=u,l=[],c=0;c<o;c++){var d=r[c],f=s[d],p=t[d],h=p.validate(f,zH(i,d,p,f));if(gi(h))void 0!==f&&zG(l,h.left);else{var m=h.right;m!==f&&(s===u&&(s=zz({},u)),s[d]=m)}}return l.length>0?rw(l):rO(s)},zJ(i)?zq:function(t){for(var n=zz({},t),a=0;a<o;a++){var u=r[a],s=t[u];void 0!==s&&(n[u]=i[a].encode(s))}return n},t)},readonly:function(t,n){return void 0===n&&(n="Readonly<".concat(t.name,">")),new VP(n,t.is,t.validate,t.encode,t)},readonlyArray:VF,record:VR,recursion:VT,refinement:VX,strict:VD,string:Bp,success:rO,taggedUnion:V$,tuple:function(t,n){void 0===n&&(n="[".concat(t.map(function(t){return t.name}).join(", "),"]"));var r=t.length;return new VN(n,function(n){return B_.is(n)&&n.length===r&&t.every(function(t,r){return t.is(n[r])})},function(n,i){var o=B_.validate(n,i);if(gi(o))return o;for(var a=o.right,u=a.length>r?a.slice(0,r):a,s=[],l=0;l<r;l++){var c=a[l],d=t[l],f=d.validate(c,zH(i,String(l),d,c));if(gi(f))zG(s,f.left);else{var p=f.right;p!==c&&(u===a&&(u=a.slice()),u[l]=p)}}return s.length>0?rw(s):rO(u)},zJ(t)?zq:function(n){return t.map(function(t,r){return t.encode(n[r])})},t)},type:VC,undefined:Bu,union:Vj,unknown:Bd,void:Bl,voidType:Bl},Symbol.toStringTag,{value:"Module"})),V4=C(V3);var V5={};Object.defineProperty(V5,"__esModule",{value:!0}),V5.ContentPath=void 0,V5.ContentPath={serialize:t=>t.map(t=>t.key).join("::"),current:t=>t[t.length-1],append:(t,n)=>t+"::"+n,make:t=>t.reduce((t,{key:n,type:r})=>n?t.concat({key:n,type:r}):t,[])};var V6={},V9={};Object.defineProperty(V9,"__esModule",{value:!0}),V9.getAssetOrThrow=void 0;let V8=t=>n=>{let r=t[n];if(!r)throw Error(`Missing asset with id '${n}'!`);return r};V9.getAssetOrThrow=V8;var V7={};Object.defineProperty(V7,"__esModule",{value:!0}),V7.getEmbedOrThrow=void 0;let $e=t=>n=>{let r=t[n];if(!r)throw Error(`Missing embed with url '${n}'`);return r};V7.getEmbedOrThrow=$e;var $t={},$n={};let $r=C(rg);function $i(t,n,r){return void 0===r&&(r=t.name),new z$(r,t.is,t.validate,function(r){return n(t.encode(r))})}let $o=Object.freeze(Object.defineProperty({__proto__:null,mapOutput:$i},Symbol.toStringTag,{value:"Module"}));var $a,$u,$s,$l=VX(Bp,$u=function(t){return t.length>0},"NonEmptyString");function $c(t,n){void 0===n&&(n="NonEmptyArray<"+t.name+">");var r=VO(t);return new z$(n,function(t){return r.is(t)&&aR(t)},function(t,n){return rp(r.validate(t,n),mQ(function(r){var i=az(r);return hk(i)?zV(t,n):rO(i.value)}))},function(t){return r.encode(t)})}function $d(t,n,r){void 0===r&&(r="Set<"+t.name+">");var i=VO(t),o=NL(n),a=NM(n);return new z$(r,function(n){return n instanceof Set&&j$(t.is)(n)},function(t,n){return rp(i.validate(t,n),mQ(function(r){var i=a(r);return i.size!==r.length?zV(t,n):rO(i)}))},function(t){return i.encode(o(t))})}function $f(t,n){return new z$(t,n,function(t,r){return n(t)?rO(t):zV(t,r)},zq)}var $p=$f("Date",function(t){return t instanceof Date}),$h=globalThis&&globalThis.__spreadArray||function(t,n,r){if(r||2===arguments.length)for(var i,o=0,a=n.length;o<a;o++)!i&&o in n||(i||(i=Array.prototype.slice.call(n,0,o)),i[o]=n[o]);return t.concat(i||Array.prototype.slice.call(n))},$m=function(t,n){return{get:t,reverseGet:n}},$g=function(t){return $x(t.get,rs(t.reverseGet,rr))},$y=function(t){return $E(rs(t.get,r_),t.reverseGet)},$v=function(t){return $L(rs(t.get,r_),rs(t.reverseGet,rr))},$b=function(t){return $B(function(n){return function(r){return function(i){return n.map(r(t.get(i)),function(n){return t.reverseGet(n)})}}})},$x=function(t,n){return{get:t,set:n}},$_=function(t){return $L(rs(t.get,r_),t.set)},$S=function(t){return $B(function(n){return function(r){return function(i){return n.map(r(t.get(i)),function(n){return t.set(n)(i)})}}})},$T=function(t){return function(n){return $x(function(r){return t.get(n.get(r))},function(r){return function(i){return n.set(t.set(r)(n.get(i)))(i)}})}},$w=function(t){return function(n){return $E(rs(n.getOption,p6(t.getOption)),rs(t.reverseGet,n.reverseGet))}},$O=function(t){return function(n){return $U($j(t))($_(n))}},$k=function(){return $x(rn,rr)},$C=function(t){return function(n){return $x(function(r){return n.get(r)[t]},function(r){return function(i){var o,a=n.get(i);return r===a[t]?i:n.set(Object.assign({},a,((o={})[t]=r,o)))(i)}})}},$I=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return function(n){return $x(function(r){for(var i=n.get(r),o={},a=0;a<t.length;a++){var u=t[a];o[u]=i[u]}return o},function(r){return function(i){for(var o=n.get(i),a=0;a<t.length;a++){var u=t[a];if(r[u]!==o[u])return n.set(Object.assign({},o,r))(i)}return i}})}},$M=function(t){return function(n){return $x(function(r){return n.get(r)[t]},function(r){return function(i){var o=n.get(i);if(r===o[t])return i;var a=o.slice();return a[t]=r,n.set(a)(i)}})}},$R=function(t){return function(n){var r;return rp(n,$T(({at:r=function(t){return $x(function(n){return El(t,n)},hC(function(){return Eo(t)},function(n){return Er(t,n)}))}}).at(t)))}},$E=function(t,n){return{getOption:t,reverseGet:n}},$j=function(t){return $L(t.getOption,function(n){return $N(n)(t)})},$A=function(t){return $B(function(n){return function(r){return function(i){return rp(t.getOption(i),hC(function(){return n.of(i)},function(o){return n.map(r(o),function(n){return $N(n)(t)(i)})}))}}})},$N=function(t){var n;return n=function(){return t},function(t){var r,i,o=(r=t,function(t){return rp(r.getOption(t),p0(function(i){var o=n(i);return o===i?t:r.reverseGet(o)}))});return function(t){return rp(o(t),hI(function(){return t}))}}},$P=function(t){return $E(pA(t),rn)},$L=function(t,n){return{getOption:t,set:n}},$F=function(t){return $B(function(n){return function(r){return function(i){return rp(t.getOption(i),hC(function(){return n.of(i)},function(o){return n.map(r(o),function(n){return t.set(n)(i)})}))}}})},$D=function(t){return function(n){return function(r){return rp(n.getOption(r),p0(function(i){var o=t(i);return o===i?r:n.set(o)(r)}))}}},$W=function(t){return function(n){var r=$D(t)(n);return function(t){return rp(r(t),hI(function(){return t}))}}},$U=function(t){return function(n){return $L(rs(n.getOption,p6(t.getOption)),function(r){return $W(t.set(r))(n)})}},$z=function(t,n,r){if(r[t]===n)return r;var i=$h([r[0]],r.slice(1),!0);return i[t]=n,i},$B=function(t){return{modifyF:t}};function $V(t){return function(n){return $B(function(r){return function(i){return n.modifyF(r)(t.modifyF(r)(i))}})}}var $$={URI:"Identity",map:function(t,n){return n(t)},of:rn,ap:function(t,n){return t(n)}},$q=function(t){return{index:t}},$K=rs($g,$T),$H=function(t){return rs($_,$U(t))},$G=function(t){return rs($S,$V(t))},$Z=function(t){return function(n){return function(r){var i=n.get(r),o=t(i);return i===o?r:n.set(o)(r)}}},$Y=function(t){return $O($E(hF,rn))(t)},$J=function(t){var n;return rs($_,function(n){return rp(n,$U($q(function(t){return $L(function(n){return sW(t,n)},function(n){return function(r){return rp(sW(t,r),hC(function(){return r},function(){return cF(t,n,r)}))}})}).index(t)))})},$Q=function(t){var n;return rs($_,function(n){return rp(n,$U($q(function(t){return $L(function(n){return sW(t,n)},function(n){return function(r){return rp(sW(t,r),hC(function(){return r},function(){return $z(t,n,r)}))}})}).index(t)))})},$X=function(t){var n;return rs($_,function(n){return rp(n,$U($q(function(t){return $L(function(n){return El(t,n)},function(n){return function(r){return r[t]===n||hk(El(t,r))?r:Er(t,n)(r)}})}).index(t)))})},$0=$O($E(rn,r_)),$1=$O($E(pP,rO)),$2=$O($E(function(t){return gi(t)?r_(t.left):rx},rw)),$3=function(t,n){return function(r){return $4(r,t,n)}},$4=function(t,n,r){return $x(rs(t.get,n),rs(r,t.set))},$5="monocle-ts/Lens",$6={URI:$5,compose:function(t,n){return $T(t)(n)}},$9={URI:$5,compose:$6.compose,id:$k};let $8=Object.freeze(Object.defineProperty({__proto__:null,Category:$9,Invariant:{URI:$5,imap:$4},Semigroupoid:$6,URI:$5,asOptional:$_,asTraversal:$S,atKey:$R,component:$M,compose:$T,composeIso:$K,composeLens:$T,composeOptional:$H,composePrism:$O,composeTraversal:$G,filter:function(t){return $O($P(t))},findFirst:function(t){var n;return $H($L(sY(t),function(n){return function(r){return rp(sZ(t)(r),hC(function(){return r},function(t){return cF(t,n,r)}))}}))},findFirstNonEmpty:function(t){var n;return $H($L(sY(t),function(n){return function(r){return rp(sZ(t)(r),hC(function(){return r},function(t){return $z(t,n,r)}))}}))},fromNullable:$Y,id:$k,imap:$3,index:$J,indexNonEmpty:$Q,key:$X,left:$2,lens:$x,modify:$Z,modifyF:function(t){return function(n){return function(r){return function(i){return rp(r.get(i),n,function(n){return t.map(n,function(t){return r.set(t)(i)})})}}}},prop:$C,props:$I,right:$1,some:$0,traverse:function(t){var n,r;return rs($S,$V($B(function(n){var r,i="Identity"===n.URI?t.map:t.traverse(n);return function(t){return function(n){return i(n,t)}}})))}},Symbol.toStringTag,{value:"Module"}));var $7=function(t){return function(n){return n.modifyF($$)(t)}},qe=function(t){return new qa(t.get,t.reverseGet)},qt=function(t){return new qu(t.get,t.set)},qn=function(t){return new qs(t.getOption,t.reverseGet)},qr=function(t){return new qc(t.getOption,t.set)},qi=function(t){return new qd(t.modifyF)},qo=function(t,n,r){var i;return r===t[n]?t:Object.assign({},t,((i={})[n]=r,i))},qa=function(){function t(t,n){this.get=t,this.reverseGet=n,this._tag="Iso",this.unwrap=this.get,this.to=this.get,this.wrap=this.reverseGet,this.from=this.reverseGet}return t.prototype.reverse=function(){var t;return qe($m(this.reverseGet,this.get))},t.prototype.modify=function(t){var n,r;return r=this,function(n){return r.reverseGet(t(r.get(n)))}},t.prototype.asLens=function(){return qt($g(this))},t.prototype.asPrism=function(){return qn($y(this))},t.prototype.asOptional=function(){return qr($v(this))},t.prototype.asTraversal=function(){return qi($b(this))},t.prototype.asFold=function(){var t=this;return new qp(function(){return function(n){return function(r){return n(t.get(r))}}})},t.prototype.asGetter=function(){var t=this;return new qf(function(n){return t.get(n)})},t.prototype.asSetter=function(){var t=this;return new qh(function(n){return t.modify(n)})},t.prototype.compose=function(t){var n,r;return qe((r=this,$m(rs(r.get,t.get),rs(t.reverseGet,r.reverseGet))))},t.prototype.composeIso=function(t){return this.compose(t)},t.prototype.composeLens=function(t){return qt(rp(this,$g,$T(t)))},t.prototype.composePrism=function(t){return qn(rp(this,$y,$w(t)))},t.prototype.composeOptional=function(t){return qr(rp(this,$v,$U(t)))},t.prototype.composeTraversal=function(t){return qi(rp(this,$b,$V(t)))},t.prototype.composeFold=function(t){return this.asFold().compose(t)},t.prototype.composeGetter=function(t){return this.asGetter().compose(t)},t.prototype.composeSetter=function(t){return this.asSetter().compose(t)},t}(),qu=function(){function t(t,n){this.get=t,this.set=n,this._tag="Lens"}return t.fromPath=function(){var n=t.fromProp();return function(t){var r=n(t[0]);return t.slice(1).reduce(function(t,r){return t.compose(n(r))},r)}},t.fromProp=function(){return function(t){return qt(rp($k(),$C(t)))}},t.fromProps=function(){return function(t){return qt(rp($k(),$I.apply($8,t)))}},t.fromNullableProp=function(){return function(n,r){return new t(function(t){var i=hF(t[n]);return hk(i)?r:i.value},function(t){return function(r){return qo(r,n,t)}})}},t.prototype.modify=function(t){return $Z(t)(this)},t.prototype.asOptional=function(){return qr($_(this))},t.prototype.asTraversal=function(){return qi($S(this))},t.prototype.asSetter=function(){var t=this;return new qh(function(n){return t.modify(n)})},t.prototype.asGetter=function(){var t=this;return new qf(function(n){return t.get(n)})},t.prototype.asFold=function(){var t=this;return new qp(function(){return function(n){return function(r){return n(t.get(r))}}})},t.prototype.compose=function(t){return qt($T(t)(this))},t.prototype.composeLens=function(t){return this.compose(t)},t.prototype.composeGetter=function(t){return this.asGetter().compose(t)},t.prototype.composeFold=function(t){return this.asFold().compose(t)},t.prototype.composeOptional=function(t){return qr(rp(this,$_,$U(t)))},t.prototype.composeTraversal=function(t){return qi(rp(this,$S,$V(t)))},t.prototype.composeSetter=function(t){return this.asSetter().compose(t)},t.prototype.composeIso=function(t){return qt(rp(this,$T(rp(t,$g))))},t.prototype.composePrism=function(t){return qr($O(t)(this))},t}(),qs=function(){function t(t,n){this.getOption=t,this.reverseGet=n,this._tag="Prism"}return t.fromPredicate=function(t){return qn($P(t))},t.some=function(){return ql},t.prototype.modify=function(t){var n=this;return function(r){var i=n.modifyOption(t)(r);return hk(i)?r:i.value}},t.prototype.modifyOption=function(t){var n=this;return function(r){return h0.map(n.getOption(r),function(i){var o=t(i);return o===i?r:n.reverseGet(o)})}},t.prototype.set=function(t){return this.modify(function(){return t})},t.prototype.asOptional=function(){return qr($j(this))},t.prototype.asTraversal=function(){return qi($A(this))},t.prototype.asSetter=function(){var t=this;return new qh(function(n){return t.modify(n)})},t.prototype.asFold=function(){var t=this;return new qp(function(n){return function(r){return function(i){var o=t.getOption(i);return hk(o)?n.empty:r(o.value)}}})},t.prototype.compose=function(t){return qn($w(t)(this))},t.prototype.composePrism=function(t){return this.compose(t)},t.prototype.composeOptional=function(t){return qr(rp(this,$j,$U(t)))},t.prototype.composeTraversal=function(t){return qi(rp(this,$A,$V(t)))},t.prototype.composeFold=function(t){return this.asFold().compose(t)},t.prototype.composeSetter=function(t){return this.asSetter().compose(t)},t.prototype.composeIso=function(t){return qn(rp(this,$w(rp(t,$y))))},t.prototype.composeLens=function(t){var n;return qr((n=t,function(t){return $U($_(n))($j(t))})(this))},t.prototype.composeGetter=function(t){return this.asFold().compose(t.asFold())},t}(),ql=new qs(rn,r_),qc=function(){function t(t,n){this.getOption=t,this.set=n,this._tag="Optional"}return t.fromPath=function(){var n=t.fromNullableProp();return function(t){var r=n(t[0]);return t.slice(1).reduce(function(t,r){return t.compose(n(r))},r)}},t.fromNullableProp=function(){return function(n){return new t(function(t){return hF(t[n])},function(t){return function(r){return null==r[n]?r:qo(r,n,t)}})}},t.fromOptionProp=function(){var t=qu.fromProp();return function(n){return t(n).composePrism(ql)}},t.prototype.modify=function(t){return $W(t)(this)},t.prototype.modifyOption=function(t){return $D(t)(this)},t.prototype.asTraversal=function(){return qi($F(this))},t.prototype.asFold=function(){var t=this;return new qp(function(n){return function(r){return function(i){var o=t.getOption(i);return hk(o)?n.empty:r(o.value)}}})},t.prototype.asSetter=function(){var t=this;return new qh(function(n){return t.modify(n)})},t.prototype.compose=function(t){return qr($U(t)(this))},t.prototype.composeOptional=function(t){return this.compose(t)},t.prototype.composeTraversal=function(t){return qi(rp(this,$F,$V(t)))},t.prototype.composeFold=function(t){return this.asFold().compose(t)},t.prototype.composeSetter=function(t){return this.asSetter().compose(t)},t.prototype.composeLens=function(t){return qr(rp(this,$U(rp(t,$_))))},t.prototype.composePrism=function(t){return qr(rp(this,$U(rp(t,$j))))},t.prototype.composeIso=function(t){return qr(rp(this,$U(rp(t,$v))))},t.prototype.composeGetter=function(t){return this.asFold().compose(t.asFold())},t}(),qd=function(){function t(t){this.modifyF=t,this._tag="Traversal"}return t.prototype.modify=function(t){return $7(t)(this)},t.prototype.set=function(t){var n;return $7(function(){return t})(this)},t.prototype.filter=function(t){var n;return qi($V($A($P(t)))(this))},t.prototype.asFold=function(){var t=this;return new qp(function(n){return function(r){return t.modifyF(mo(n))(function(t){return rn(r(t))})}})},t.prototype.asSetter=function(){var t=this;return new qh(function(n){return t.modify(n)})},t.prototype.compose=function(t){return qi($V(t)(this))},t.prototype.composeTraversal=function(t){return this.compose(t)},t.prototype.composeFold=function(t){return this.asFold().compose(t)},t.prototype.composeSetter=function(t){return this.asSetter().compose(t)},t.prototype.composeOptional=function(t){return this.compose(t.asTraversal())},t.prototype.composeLens=function(t){return qi(rp(this,$V(rp(t,$S))))},t.prototype.composePrism=function(t){return qi(rp(this,$V(rp(t,$A))))},t.prototype.composeIso=function(t){return qi(rp(this,$V(rp(t,$b))))},t.prototype.composeGetter=function(t){return this.asFold().compose(t.asFold())},t}(),qf=function(){function t(t){this.get=t,this._tag="Getter"}return t.prototype.asFold=function(){var t=this;return new qp(function(){return function(n){return function(r){return n(t.get(r))}}})},t.prototype.compose=function(n){var r=this;return new t(function(t){return n.get(r.get(t))})},t.prototype.composeGetter=function(t){return this.compose(t)},t.prototype.composeFold=function(t){return this.asFold().compose(t)},t.prototype.composeLens=function(t){return this.compose(t.asGetter())},t.prototype.composeIso=function(t){return this.compose(t.asGetter())},t.prototype.composeTraversal=function(t){return this.asFold().compose(t.asFold())},t.prototype.composeOptional=function(t){return this.asFold().compose(t.asFold())},t.prototype.composePrism=function(t){return this.asFold().compose(t.asFold())},t}(),qp=function(){function t(t){this.foldMap=t,this._tag="Fold",this.getAll=t(fw())(a3),this.exist=t(wN),this.all=t(wA),this.foldMapFirst=t(h3())}return t.prototype.compose=function(n){var r=this;return new t(function(t){return function(i){return r.foldMap(t)(n.foldMap(t)(i))}})},t.prototype.composeFold=function(t){return this.compose(t)},t.prototype.composeGetter=function(t){return this.compose(t.asFold())},t.prototype.composeTraversal=function(t){return this.compose(t.asFold())},t.prototype.composeOptional=function(t){return this.compose(t.asFold())},t.prototype.composeLens=function(t){return this.compose(t.asFold())},t.prototype.composePrism=function(t){return this.compose(t.asFold())},t.prototype.composeIso=function(t){return this.compose(t.asFold())},t.prototype.find=function(t){return this.foldMapFirst(pA(t))},t.prototype.headOption=function(t){return this.find(function(){return!0})(t)},t}(),qh=function(){function t(t){this.modify=t,this._tag="Setter"}return t.prototype.set=function(t){return this.modify(rr(t))},t.prototype.compose=function(n){var r=this;return new t(function(t){return r.modify(n.modify(t))})},t.prototype.composeSetter=function(t){return this.compose(t)},t.prototype.composeTraversal=function(t){return this.compose(t.asSetter())},t.prototype.composeOptional=function(t){return this.compose(t.asSetter())},t.prototype.composeLens=function(t){return this.compose(t.asSetter())},t.prototype.composePrism=function(t){return this.compose(t.asSetter())},t.prototype.composeIso=function(t){return this.compose(t.asSetter())},t}(),qm=new qa(rn,rn),qg=VD({_tag:BO("None")}),qy=BO("Some");function qv(t,n){return void 0===n&&(n="Option<"+t.name+">"),Vj([qg,VD({_tag:qy,value:t},"Some<"+t.name+">")],n)}var qb=new z$("DateFromISOString",function(t){return t instanceof Date},function(t,n){return rp(Bp.validate(t,n),mQ(function(r){var i=new Date(r);return isNaN(i.getTime())?zV(t,n):rO(i)}))},function(t){return t.toISOString()});function qx(t){var n=Object.create(Object.getPrototypeOf(t));return Object.assign(n,t),n}var q_=new z$("DateFromNumber",function(t){return t instanceof Date},function(t,n){return rp(Bm.validate(t,n),mQ(function(r){var i=new Date(r);return isNaN(i.getTime())?zV(t,n):rO(i)}))},function(t){return t.getTime()});function qS(t,n,r){void 0===r&&(r=t.name);var i=qx(t);return i.validate=n,i.decode=function(t){return n(t,VK(i))},i.name=r,i}var qT,qw,qO,qk=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,qC=VX(Bp,qw=function(t){return qk.test(t)},"UUID"),qI=new z$("BooleanFromString",Bb.is,function(t,n){return rp(Bp.validate(t,n),mQ(function(r){return"true"===r?rO(!0):"false"===r?rO(!1):zV(t,n)}))},String);function qM(t){switch(t._tag){case"InterfaceType":return t.props;case"ExactType":return qM(t.type)}}var qR=qu.fromProp(),qE=$f("RegExp",function(t){return"[object RegExp]"===Object.prototype.toString.call(t)}),qj=new z$("DateFromUnixTime",function(t){return t instanceof Date},function(t,n){return rp(V_.validate(t,n),mQ(function(r){var i=new Date(1e3*r);return isNaN(i.getTime())?zV(t,n):rO(i)}))},function(t){return Math.floor(t.getTime()/1e3)}),qA=new z$("NumberFromString",Bm.is,function(t,n){return rp(Bp.validate(t,n),mQ(function(r){var i=+r;return isNaN(i)||""===r.trim()?zV(t,n):rO(i)}))},String),qN=new z$("IntFromString",V_.is,function(t,n){return rp(qA.validate(t,n),mQ(function(r){return V_.is(r)?rO(r):zV(t,n)}))},qA.encode),qP=VT("JsonArray",function(){return VF(qF)}),qL=VT("JsonRecord",function(){return VR(Bp,qF)}),qF=Vj([Bb,Bm,Bp,Bo,qP,qL],"Json"),qD=new z$("JsonFromString",qF.is,function(t,n){try{return rO(JSON.parse(t))}catch{return zV(t,n)}},function(t){return JSON.stringify(t)}),qW=BO("Left"),qU=BO("Right"),qz=new z$("BigIntFromString",function(t){return"bigint"==typeof t},function(t,n){return rp(Bp.validate(t,n),mQ(function(r){if(!$l.is(r.trim()))return zV(t,n);try{return rO(BigInt(r))}catch{return zV(t,n)}}))},String),qB=new z$("BooleanFromNumber",Bb.is,function(t,n){return rp(Bm.validate(t,n),m$(function(t){return 0!==t}))},Number);let qV=Object.freeze(Object.defineProperty({__proto__:null,BigIntFromString:qz,BooleanFromNumber:qB,BooleanFromString:qI,DateFromISOString:qb,DateFromNumber:q_,DateFromUnixTime:qj,IntFromString:qN,Json:qF,JsonArray:qP,JsonFromString:qD,JsonRecord:qL,NonEmptyString:$l,NumberFromString:qA,UUID:qC,clone:qx,date:$p,either:function(t,n,r){return void 0===r&&(r="Either<"+t.name+", "+n.name+">"),Vj([VD({_tag:qW,left:t},"Left<"+t.name+">"),VD({_tag:qU,right:n},"Right<"+t.name+">")],r)},fromNewtype:function(t,n){return void 0===n&&(n="fromNewtype("+t.name+")"),new z$(n,function(n){return t.is(n)},function(n,r){return rp(t.validate(n,r),m$(qm.wrap))},function(n){return t.encode(qm.unwrap(n))})},fromNullable:function(t,n,r){return void 0===r&&(r="fromNullable("+t.name+")"),qS(t,function(r,i){return null==r?rO(n):t.validate(r,i)},r)},fromRefinement:$f,getLenses:function(t){var n={};for(var r in qM(t))n[r]=qR(r);return n},mapOutput:$i,nonEmptyArray:$c,option:qv,optionFromNullable:function(t,n){return void 0===n&&(n="Option<"+t.name+">"),new z$(n,qv(t).is,function(n,r){return null==n?rO(rx):rp(t.validate(n,r),m$(r_))},function(n){return hB(rp(n,p0(t.encode)))})},readonlyNonEmptyArray:function(t,n){return void 0===n&&(n="ReadonlyNonEmptyArray<"+t.name+">"),$c(t,n)},readonlySetFromArray:function(t,n,r){return void 0===r&&(r="ReadonlySet<"+t.name+">"),$d(t,n,r)},regexp:qE,setFromArray:$d,withEncode:function(t,n,r){return void 0===r&&(r=t.name),new z$(r,t.is,t.validate,n)},withFallback:function(t,n,r){return void 0===r&&(r="withFallback("+t.name+")"),qS(t,function(r,i){return gv(function(){return rO(n)})(t.validate(r,i))},r)},withMessage:function(t,n){return qS(t,function(r,i){return m9(function(){return[{value:r,context:i,message:n(r,i),actual:r}]})(t.validate(r,i))})},withValidate:qS},Symbol.toStringTag,{value:"Module"})),q$=C(qV),qq=C($o);Object.defineProperty($n,"__esModule",{value:!0}),$n.withCustomError=$n.addType=$n.isEmpty=$n.objectToMap=$n.grouped=$n.formatDate=$n.formatDateTime=$n.filterDouble=$n.refineType=$n.nullable=void 0;let qK=n1,qH=(0,qK.__importStar)(V4);$n.nullable=function(t){return qH.union([t,qH.null,qH.undefined])},$n.refineType=function(t,n,r){return new qH.Type(n,t.is,(n,i)=>(0,$r.pipe)(t.validate(n,i),UG.either.chain(t=>r(t)?qH.success(t):qH.failure(n,i))),t.encode)},$n.filterDouble=function(t){if(""===t)return null;let n=Number(t);return Number.isNaN(n)?null:n},$n.formatDateTime=function(t){return t.toISOString().replace(/\.\d{3}Z$/,"+0000")},$n.formatDate=function(t){return t.toISOString().replace(/T.*/,"")},$n.grouped=function(t,n){return t.reduce((t,r,i)=>(i%n==0?t.push([r]):t[Math.floor(i/n)].push(r),t),[])},$n.objectToMap=function(t){return new Map(Object.entries(t))},$n.isEmpty=function(t){for(let n in t)return!1;return!0},$n.addType=function(t,n){return(0,qq.mapOutput)(t,t=>({...t,__TYPE__:n}))},$n.withCustomError=function(t,n){return(0,q$.withValidate)(t,(r,i)=>UG.either.mapLeft(t=>t.find(t=>t.message)?t:[{value:r,context:i,message:n(r,i),actual:r}])(t.validate(r,i)))},Object.defineProperty($t,"__esModule",{value:!0}),$t.WidgetKey=void 0;let qG=n1,qZ=(0,qG.__importStar)(V4),qY=RegExp("^[^<>]+$");$t.WidgetKey=(0,$n.refineType)(qZ.string,"WidgetKey",t=>0===t.length||qY.test(t)),function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(V9,t),(0,n.__exportStar)(V7,t),(0,n.__exportStar)($t,t)}(V6);var qJ={},qQ={},qX={},q0={},q1={};Object.defineProperty(q1,"__esModule",{value:!0}),q1.clone=void 0,q1.clone=function(t){var n=Object.create(Object.getPrototypeOf(t));return Object.assign(n,t),n};var q2=k&&k.__createBinding||(Object.create?function(t,n,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return n[r]}})}:function(t,n,r,i){void 0===i&&(i=r),t[i]=n[r]}),q3=k&&k.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),q4=k&&k.__importStar||function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&q2(n,t,r);return q3(n,t),n};Object.defineProperty(q0,"__esModule",{value:!0}),q0.withValidate=void 0;var q5=q4(V4);q0.withValidate=function(t,n,r){void 0===r&&(r=t.name);var i=q1.clone(t);return i.validate=n,i.decode=function(t){return n(t,q5.getDefaultContext(i))},i.name=r,i};var q6=k&&k.__createBinding||(Object.create?function(t,n,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return n[r]}})}:function(t,n,r,i){void 0===i&&(i=r),t[i]=n[r]}),q9=k&&k.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),q8=k&&k.__importStar||function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&q6(n,t,r);return q9(n,t),n};Object.defineProperty(qX,"__esModule",{value:!0}),qX.withFallback=void 0;var q7=q8(V4);qX.withFallback=function(t,n,r){return void 0===r&&(r="withFallback("+t.name+")"),q0.withValidate(t,function(r,i){return UZ.orElse(function(){return q7.success(n)})(t.validate(r,i))},r)};var Ke={},Kt={};Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.EmptyArray=Kt.EmptyObject=Kt.Boolean=Kt.NumberOrNull=Kt.Number=Kt.StringOrNull=Kt.String=void 0;let Kn=n1,Kr=(0,Kn.__importStar)(V4);Kt.String=(0,$n.withCustomError)(Kr.string,()=>"The value must be a string"),Kt.StringOrNull=(0,$n.withCustomError)(Kr.union([Kr.string,Kr.null]),()=>"The value must be a string or null"),Kt.Number=(0,$n.withCustomError)(Kr.number,()=>"The value must be a number"),Kt.NumberOrNull=(0,$n.withCustomError)(Kr.union([Kr.number,Kr.null]),()=>"The value must be a number or null"),Kt.Boolean=(0,$n.withCustomError)(Kr.boolean,()=>"The value must be a boolean"),Kt.EmptyObject=Kr.UnknownRecord.pipe(new Kr.Type("emptyObject",t=>Kr.UnknownRecord.is(t),(t,n)=>Object.keys(t).length>0?Kr.failure(t,n,"The object is not empty."):Kr.success({}),Kr.identity)),Kt.EmptyArray=new Kr.Type("emptyArray",t=>Kr.UnknownArray.is(t)&&0===t.length,(t,n)=>(0,UQ.pipe)(Kr.UnknownArray.decode(t),UG.either.chain(r=>r.length>0?Kr.failure(t,n,"The array is not empty."):Kr.success([]))),()=>[]);var Ki={};let Ko=C(gU);var Ka={};Object.defineProperty(Ka,"__esModule",{value:!0});let Ku=n1,Ks=(0,Ku.__importStar)(V4);Ka.default=new Ks.Type("dateFromStringOrNumber",t=>t instanceof Date,(t,n)=>(0,$r.pipe)(Ks.union([Ks.number,Ks.string]).validate(t,n),(0,Ko.chain)(r=>{let i=new Date(r);return isNaN(i.getTime())?Ks.failure(t,n):Ks.success(i)})),t=>t);var Kl={};Object.defineProperty(Kl,"__esModule",{value:!0});let Kc=n1,Kd=(0,Kc.__importStar)(V4);Kl.default=new Kd.Type("dateFromTsMs",t=>t instanceof Date,(t,n)=>(0,$r.pipe)(Kd.number.validate(t,n),(0,Ko.chain)(r=>{let i=new Date(r);return isNaN(i.getTime())?Kd.failure(t,n):Kd.success(i)})),t=>t.getTime());var Kf={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.EmptyArrayOrElse=t.EmptyObjectOrElse=t.NullOrElse=t.DefaultOrElse=void 0;let n=n1,r=(0,n.__importStar)(V4),i=t=>n=>new r.Type(`DefaultOrElse<${t.name}, ${n.name}>`,t=>null===t||n.is(t),(i,o)=>(0,UZ.isRight)(t.validate(i,o))?r.success(null):n.validate(i,o),t=>t?n.encode(t):void 0);t.DefaultOrElse=i;let o=n=>(0,t.DefaultOrElse)(r.null)(n);t.NullOrElse=o;let a=n=>(0,t.DefaultOrElse)(Kt.EmptyObject)(n);t.EmptyObjectOrElse=a;let u=n=>(0,t.DefaultOrElse)(Kt.EmptyArray)(n);t.EmptyArrayOrElse=u}(Kf);var Kp={};Object.defineProperty(Kp,"__esModule",{value:!0});let Kh=n1,Km=(0,Kh.__importStar)(V4);Kp.default=new Km.Type("IntFromNumber",Km.Int.is,(t,n)=>(0,$r.pipe)(Km.number.validate(t,n),(0,Ko.chain)(t=>Km.Int.is(t)?Km.success(t):Km.success(Math.round(t)))),Km.Int.encode);var Kg={};Object.defineProperty(Kg,"__esModule",{value:!0});let Ky=n1,Kv=(0,Ky.__importStar)(V4),Kb=/^([0-9]+)px$/;Kg.default=new Kv.Type("IntFromPixels",Kv.Int.is,(t,n)=>(0,$r.pipe)(Kv.string.validate(t,n),(0,Ko.chain)(r=>{try{let i=r.match(Kb);if(!i)return Kv.failure(t,n);let o=parseInt(i[1]);return Kv.success(o)}catch{return Kv.failure(t,n)}})),String);var Kx={};Object.defineProperty(Kx,"__esModule",{value:!0});let K_=n1,KS=(0,K_.__importStar)(V4);Kx.default=(0,$n.withCustomError)((0,$n.refineType)(KS.string,"nonEmptyString",t=>t.trim().length>0),()=>"The value must be a non-empty string");var KT={},Kw={};Object.defineProperty(Kw,"__esModule",{value:!0});let KO=n1,Kk=(0,KO.__importStar)(V4);Kw.default=(0,$n.nullable)(Kk.string),Object.defineProperty(KT,"__esModule",{value:!0});let KC=n1,KI=(0,KC.__importDefault)(Kw);KT.default=new V4.Type("nonEmptyStringOrNull",t=>"string"==typeof t||null===t,(t,n)=>(0,$r.pipe)(KI.default.validate(t,n),(0,Ko.chain)(t=>"string"==typeof t&&t.length>0?(0,V4.success)(t):(0,V4.success)(null))),t=>t);var KM={};Object.defineProperty(KM,"__esModule",{value:!0});let KR=n1,KE=(0,KR.__importStar)(V4);KM.default=(0,$n.nullable)(KE.number);var Kj={};Object.defineProperty(Kj,"__esModule",{value:!0});let KA=n1,KN=(0,KA.__importStar)(V4);Kj.default=(t,n,r)=>Kt.Number.pipe(new KN.Type("numberInRange",t=>Kt.Number.is(t),(i,o)=>i>n||i<t?KN.failure(i,o,`${r} must be a number between ${t} and ${n}`):KN.success(i),KN.identity));var KP={};Object.defineProperty(KP,"__esModule",{value:!0});let KL=n1,KF=(0,KL.__importStar)(V4);KP.default=new KF.Type("StringFromInt",KF.string.is,(t,n)=>(0,$r.pipe)(KF.boolean.validate(t,n),(0,Ko.chain)(t=>KF.success(t.toString()))),t=>t);var KD={};Object.defineProperty(KD,"__esModule",{value:!0});let KW=n1,KU=(0,KW.__importStar)(V4);function Kz(){return Gt||(Gt=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.StringOrNull=t.StringFromNumber=t.StringFromBoolean=t.NumberRange=t.NumberOrNull=t.NonEmptyStringOrNull=t.NonEmptyString=t.IntFromPixels=t.IntFromNumber=t.Function=t.DateFromTsMs=t.DateFromStringOrNumber=t.DateFromString=void 0;let n=n1;(0,n.__exportStar)(Kt,t);var r=function(){if(Ge)return Ki;Ge=1,Object.defineProperty(Ki,"__esModule",{value:!0});let t=n1,n=(0,t.__importStar)(V4),r=Kz();return Ki.default=new n.Type("dateFromString",t=>t instanceof Date,(t,i)=>(0,$r.pipe)(r.String.validate(t,i),(0,Ko.chain)(r=>{let o=new Date(r);return isNaN(o.getTime())?n.failure(t,i):n.success(o)})),t=>t.toISOString()),Ki}();Object.defineProperty(t,"DateFromString",{enumerable:!0,get:function(){return(0,n.__importDefault)(r).default}}),Object.defineProperty(t,"DateFromStringOrNumber",{enumerable:!0,get:function(){return(0,n.__importDefault)(Ka).default}}),Object.defineProperty(t,"DateFromTsMs",{enumerable:!0,get:function(){return(0,n.__importDefault)(Kl).default}}),(0,n.__exportStar)(Kf,t),t.Function=(0,n.__importStar)($n),Object.defineProperty(t,"IntFromNumber",{enumerable:!0,get:function(){return(0,n.__importDefault)(Kp).default}}),Object.defineProperty(t,"IntFromPixels",{enumerable:!0,get:function(){return(0,n.__importDefault)(Kg).default}}),Object.defineProperty(t,"NonEmptyString",{enumerable:!0,get:function(){return(0,n.__importDefault)(Kx).default}}),Object.defineProperty(t,"NonEmptyStringOrNull",{enumerable:!0,get:function(){return(0,n.__importDefault)(KT).default}}),Object.defineProperty(t,"NumberOrNull",{enumerable:!0,get:function(){return(0,n.__importDefault)(KM).default}}),Object.defineProperty(t,"NumberRange",{enumerable:!0,get:function(){return(0,n.__importDefault)(Kj).default}}),Object.defineProperty(t,"StringFromBoolean",{enumerable:!0,get:function(){return(0,n.__importDefault)(KP).default}}),Object.defineProperty(t,"StringFromNumber",{enumerable:!0,get:function(){return(0,n.__importDefault)(KD).default}}),Object.defineProperty(t,"StringOrNull",{enumerable:!0,get:function(){return(0,n.__importDefault)(Kw).default}})}(Ke)),Ke}KD.default=new KU.Type("StringFromInt",KU.string.is,(t,n)=>(0,$r.pipe)(KU.number.validate(t,n),(0,Ko.chain)(t=>KU.success(t.toString()))),t=>t);var KB={},KV={},K$={},Kq={},KK={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanField=t.BooleanConfig=t.BooleanFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.BooleanFieldType="Boolean",t.BooleanConfig=n.exact(n.partial({label:r.StringOrNull,default_value:n.boolean,placeholder_true:n.string,placeholder_false:n.string})),t.BooleanField=n.exact(n.intersection([n.type({type:n.literal(t.BooleanFieldType)}),n.partial({config:t.BooleanConfig})]))}(KK);var KH={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Color=t.ColorConfig=t.ColorFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.ColorFieldType="Color",t.ColorConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string})),t.Color=n.exact(n.intersection([n.type({type:n.literal(t.ColorFieldType)}),n.partial({fieldset:r.StringOrNull,config:t.ColorConfig})]))}(KH);var KG={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Date=t.DateConfig=t.DateFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.DateFieldType="Date",t.DateConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,default:n.string})),t.Date=n.exact(n.intersection([n.type({type:n.literal(t.DateFieldType)}),n.partial({fieldset:r.StringOrNull,config:t.DateConfig})]))}(KG);var KZ={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Embed=t.EmbedConfig=t.EmbedFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.EmbedFieldType="Embed",t.EmbedConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,useAsTitle:n.boolean})),t.Embed=n.exact(n.intersection([n.type({type:n.literal(t.EmbedFieldType)}),n.partial({fieldset:r.StringOrNull,config:t.EmbedConfig})]))}(KZ);var KY={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.GeoPoint=t.GeoPointConfig=t.GeoPointFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.GeoPointFieldType="GeoPoint",t.GeoPointConfig=n.exact(n.partial({label:r.StringOrNull})),t.GeoPoint=n.exact(n.intersection([n.type({type:n.literal(t.GeoPointFieldType)}),n.partial({fieldset:r.StringOrNull,config:t.GeoPointConfig})]))}(KY);var KJ={},KQ={},KX={},K0={},K1={};Object.defineProperty(K1,"__esModule",{value:!0}),K1.pipe=K1.pipeable=void 0,K1.pipeable=function(t){var n,r,i,o,a,u,s,l,c,d,f,p,h,m,g,y={};if("function"==typeof t.map){var v=function(n){return function(r){return t.map(r,n)}};y.map=v}if("function"==typeof t.contramap){var b=function(n){return function(r){return t.contramap(r,n)}};y.contramap=b}if("function"==typeof t.mapWithIndex){var x=function(n){return function(r){return t.mapWithIndex(r,n)}};y.mapWithIndex=x}if("function"==typeof t.ap){var _=function(n){return function(r){return t.ap(r,n)}},S=function(n){return function(r){return t.ap(t.map(r,function(t){return function(){return t}}),n)}};y.ap=_,y.apFirst=S,y.apSecond=function(n){return function(r){return t.ap(t.map(r,function(){return function(t){return t}}),n)}}}if("function"==typeof t.chain){var T=function(n){return function(r){return t.chain(r,n)}},w=function(n){return function(r){return t.chain(r,function(r){return t.map(n(r),function(){return r})})}},O=function(n){return t.chain(n,UQ.identity)};y.chain=T,y.chainFirst=w,y.flatten=O}if("function"==typeof t.bimap){var k=function(n,r){return function(i){return t.bimap(i,n,r)}},C=function(n){return function(r){return t.mapLeft(r,n)}};y.bimap=k,y.mapLeft=C}if("function"==typeof t.extend){var I=function(n){return function(r){return t.extend(r,n)}},M=function(n){return t.extend(n,UQ.identity)};y.extend=I,y.duplicate=M}if("function"==typeof t.reduce){var R=function(n,r){return function(i){return t.reduce(i,n,r)}},E=function(n){var r=t.foldMap(n);return function(t){return function(n){return r(n,t)}}},j=function(n,r){return function(i){return t.reduceRight(i,n,r)}};y.reduce=R,y.foldMap=E,y.reduceRight=j}if("function"==typeof t.reduceWithIndex){var A=function(n,r){return function(i){return t.reduceWithIndex(i,n,r)}},N=function(n){var r=t.foldMapWithIndex(n);return function(t){return function(n){return r(n,t)}}},P=function(n,r){return function(i){return t.reduceRightWithIndex(i,n,r)}};y.reduceWithIndex=A,y.foldMapWithIndex=N,y.reduceRightWithIndex=P}if("function"==typeof t.alt){var L=function(n){return function(r){return t.alt(r,n)}};y.alt=L}if("function"==typeof t.compact&&(y.compact=t.compact,y.separate=t.separate),"function"==typeof t.filter){var F=function(n){return function(r){return t.filter(r,n)}},D=function(n){return function(r){return t.filterMap(r,n)}},W=function(n){return function(r){return t.partition(r,n)}},U=function(n){return function(r){return t.partitionMap(r,n)}};y.filter=F,y.filterMap=D,y.partition=W,y.partitionMap=U}if("function"==typeof t.filterWithIndex){var z=function(n){return function(r){return t.filterWithIndex(r,n)}},B=function(n){return function(r){return t.filterMapWithIndex(r,n)}},V=function(n){return function(r){return t.partitionWithIndex(r,n)}},$=function(n){return function(r){return t.partitionMapWithIndex(r,n)}};y.filterWithIndex=z,y.filterMapWithIndex=B,y.partitionWithIndex=V,y.partitionMapWithIndex=$}if("function"==typeof t.promap){var q=function(n,r){return function(i){return t.promap(i,n,r)}};y.promap=q}if("function"==typeof t.compose){var K=function(n){return function(r){return t.compose(r,n)}};y.compose=K}if("function"==typeof t.throwError){var H=function(n){return function(r){return"None"===r._tag?t.throwError(n()):t.of(r.value)}},G=function(n){return"Left"===n._tag?t.throwError(n.left):t.of(n.right)},Z=function(n,r){return function(i){return n(i)?t.of(i):t.throwError(r(i))}},Y=function(n,r){return function(i){return t.chain(i,function(i){return n(i)?t.of(i):t.throwError(r(i))})}};y.fromOption=H,y.fromEither=G,y.fromPredicate=Z,y.filterOrElse=Y}return y},K1.pipe=UQ.pipe;var K2=k&&k.__createBinding||(Object.create?function(t,n,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return n[r]}})}:function(t,n,r,i){void 0===i&&(i=r),t[i]=n[r]}),K3=k&&k.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),K4=k&&k.__importStar||function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&K2(n,t,r);return K3(n,t),n};Object.defineProperty(K0,"__esModule",{value:!0}),K0.NumberFromString=void 0;var K5=K4(V4);K0.NumberFromString=new K5.Type("NumberFromString",K5.number.is,function(t,n){return K1.pipe(K5.string.validate(t,n),UZ.chain(function(r){var i=+r;return isNaN(i)||""===r.trim()?K5.failure(t,n):K5.success(i)}))},String);var K6=k&&k.__createBinding||(Object.create?function(t,n,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return n[r]}})}:function(t,n,r,i){void 0===i&&(i=r),t[i]=n[r]}),K9=k&&k.__setModuleDefault||(Object.create?function(t,n){Object.defineProperty(t,"default",{enumerable:!0,value:n})}:function(t,n){t.default=n}),K8=k&&k.__importStar||function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&K6(n,t,r);return K9(n,t),n};Object.defineProperty(KX,"__esModule",{value:!0}),KX.IntFromString=void 0;var K7=K8(V4);KX.IntFromString=new K7.Type("IntFromString",K7.Int.is,function(t,n){return K1.pipe(K0.NumberFromString.validate(t,n),UZ.chain(function(r){return K7.Int.is(r)?K7.success(r):K7.failure(t,n)}))},K0.NumberFromString.encode),Object.defineProperty(KQ,"__esModule",{value:!0});let He=n1,Ht=(0,He.__importStar)(V4),Hn=Kz(),Hr=new Ht.Type("SideConstraints",t=>!t||"number"==typeof t,(t,n)=>UZ.either.chain(Ht.union([Ht.literal("auto"),Ht.literal(""),Ht.Int,KX.IntFromString,Hn.IntFromNumber,Hn.IntFromPixels,Ht.null]).validate(t,n),t=>"auto"===t||""===t?Ht.success(null):Ht.success(t)),t=>t),Hi=Ht.partial({width:Hr,height:Hr});KQ.default=Hi,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Image=t.ImageConfig=t.Thumbnail=t.ImageFieldType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Kz(),o=(0,n.__importDefault)(KQ);t.ImageFieldType="Image",t.Thumbnail=r.exact(r.intersection([r.type({name:r.string}),o.default])),t.ImageConfig=r.exact(r.partial({label:i.StringOrNull,placeholder:r.string,constraint:o.default,thumbnails:r.readonlyArray(t.Thumbnail)})),t.Image=r.exact(r.intersection([r.type({type:r.literal(t.ImageFieldType)}),r.partial({fieldset:i.StringOrNull,config:t.ImageConfig})]))}(KJ);var Ho={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.IntegrationField=t.IntegrationFieldConfig=t.IntegrationFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.IntegrationFieldType="IntegrationFields",t.IntegrationFieldConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,catalog:n.string})),t.IntegrationField=n.exact(n.intersection([n.type({type:n.literal(t.IntegrationFieldType)}),n.partial({fieldset:r.StringOrNull,config:t.IntegrationFieldConfig})]))}(Ho);var Ha={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Link=t.LinkConfig=t.LinkFieldType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Kz(),o=t=>{if(t instanceof Array&&t.reduce((t,n)=>t&&"string"==typeof n,!0))return r.success(t)},a=t=>{if("string"==typeof t)return r.success([t])},u=new r.Type("MasksArrayString",t=>t instanceof Array,(t,n)=>UZ.either.chain(r.union([r.array(r.string),r.string]).validate(t,n),i=>o(i)||a(i)||r.failure(t,n)),t=>t);t.LinkFieldType="Link",t.LinkConfig=r.exact(r.partial({label:i.StringOrNull,useAsTitle:r.boolean,placeholder:r.string,select:(0,qX.withFallback)(r.union([r.literal("media"),r.literal("document"),r.literal("web"),r.null]),null),customtypes:r.readonlyArray(r.string),masks:u,tags:u,allowTargetBlank:r.boolean})),t.Link=r.exact(r.intersection([r.type({type:r.literal(t.LinkFieldType)}),r.partial({fieldset:i.StringOrNull,config:t.LinkConfig})]))}(Ha);var Hu={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Number=t.NumberConfig=t.NumberFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.NumberFieldType="Number",t.NumberConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,min:n.union([n.number,K0.NumberFromString]),max:n.union([n.number,K0.NumberFromString]),step:n.union([n.number,K0.NumberFromString])})),t.Number=n.exact(n.intersection([n.type({type:n.literal(t.NumberFieldType)}),n.partial({fieldset:r.StringOrNull,config:t.NumberConfig})]))}(Hu);var Hs={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Range=t.RangeConfig=t.RangeFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.RangeFieldType="Range",t.RangeConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,min:n.union([n.number,K0.NumberFromString]),max:n.union([n.number,K0.NumberFromString]),step:n.union([n.number,K0.NumberFromString])})),t.Range=n.exact(n.intersection([n.type({type:n.literal(t.RangeFieldType)}),n.partial({fieldset:r.StringOrNull,config:t.RangeConfig})]))}(Hs);var Hl={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.RichText=t.RichTextConfig=t.RichTextNodeTypeCodec=t.RichTextNodeType=t.DEFAULT_OPTION=t.RichTextFieldType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Kz(),o=(0,n.__importDefault)(KQ);t.RichTextFieldType="StructuredText",t.DEFAULT_OPTION="paragraph",t.RichTextNodeType={heading1:"heading1",heading2:"heading2",heading3:"heading3",heading4:"heading4",heading5:"heading5",heading6:"heading6",paragraph:"paragraph",strong:"strong",em:"em",preformatted:"preformatted",hyperlink:"hyperlink",image:"image",embed:"embed",list:"list-item",orderedList:"o-list-item",rtl:"rtl"},t.RichTextNodeTypeCodec=r.keyof({[t.RichTextNodeType.heading1]:null,[t.RichTextNodeType.heading2]:null,[t.RichTextNodeType.heading3]:null,[t.RichTextNodeType.heading4]:null,[t.RichTextNodeType.heading5]:null,[t.RichTextNodeType.heading6]:null,[t.RichTextNodeType.paragraph]:null,[t.RichTextNodeType.strong]:null,[t.RichTextNodeType.em]:null,[t.RichTextNodeType.preformatted]:null,[t.RichTextNodeType.hyperlink]:null,[t.RichTextNodeType.image]:null,[t.RichTextNodeType.embed]:null,[t.RichTextNodeType.list]:null,[t.RichTextNodeType.orderedList]:null,[t.RichTextNodeType.rtl]:null});let a=new r.Type("RichTextOptions",t=>"string"==typeof t,n=>(0,UQ.pipe)(r.union([r.string,r.null]).decode(n),UG.either.map(n=>{if(!n)return t.DEFAULT_OPTION;let r=n.split(",").map(t=>t.trim()).filter(n=>(0,UZ.getOrElseW)(()=>{})(t.RichTextNodeTypeCodec.decode(n)));return r.length?r.join(","):t.DEFAULT_OPTION})),t=>t),u=t=>{if(!t)return r.success([])},s=t=>{if(t instanceof Object){if(!Object.entries(t).length)return r.success([]);if(t[""])return r.success(t[""].map(t=>t.name));let n=Object.entries(t).reduce((t,[,n])=>t.concat(n.map(t=>t.name)),[]).filter(Boolean);return r.success(n)}},l=t=>{if(t instanceof Array&&t.reduce((t,n)=>t&&"string"==typeof n,!0))return r.success(t)},c=t=>{if("string"==typeof t)return r.success([t])},d=new r.Type("RichTextLabels",t=>t instanceof Array,(t,n)=>{let i=r.record(r.string,r.readonlyArray(r.record(r.literal("name"),r.string))),o=r.readonlyArray(r.string);return(0,UQ.pipe)(r.union([i,o,r.string,r.null]).decode(t),UG.either.chain(i=>u(i)||l(i)||s(i)||c(i)||r.failure(t,n)))},t=>t);t.RichTextConfig=r.exact(r.partial({label:i.StringOrNull,placeholder:r.string,useAsTitle:r.boolean,single:a,multi:a,imageConstraint:o.default,labels:d,allowTargetBlank:r.boolean})),t.RichText=r.exact(r.intersection([r.type({type:r.literal(t.RichTextFieldType)}),r.partial({fieldset:i.StringOrNull,config:t.RichTextConfig})]))}(Hl);var Hc={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Select=t.SelectConfig=t.SelectFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.SelectFieldType="Select",t.SelectConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,default_value:n.string,options:n.readonlyArray(n.union([n.string,r.StringFromNumber,r.StringFromBoolean]))})),t.Select=n.exact(n.intersection([n.type({type:n.literal(t.SelectFieldType)}),n.partial({fieldset:r.StringOrNull,config:t.SelectConfig})]))}(Hc);var Hd={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Separator=t.SeparatorConfig=t.SeparatorFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.SeparatorFieldType="Separator",t.SeparatorConfig=n.exact(n.partial({label:r.StringOrNull})),t.Separator=n.exact(n.intersection([n.type({type:n.literal(t.SeparatorFieldType)}),n.partial({config:t.SeparatorConfig})]))}(Hd);var Hf={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Text=t.TextConfig=t.TextFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.TextFieldType="Text",t.TextConfig=n.exact(n.partial({label:r.StringOrNull,useAsTitle:n.boolean,placeholder:n.string})),t.Text=n.exact(n.intersection([n.type({type:n.literal(t.TextFieldType)}),n.partial({fieldset:r.StringOrNull,config:t.TextConfig})]))}(Hf);var Hp={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Timestamp=t.TimestampConfig=t.TimestampFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.TimestampFieldType="Timestamp",t.TimestampConfig=n.exact(n.partial({label:r.StringOrNull,placeholder:n.string,default:n.string})),t.Timestamp=n.exact(n.intersection([n.type({type:n.literal(t.TimestampFieldType)}),n.partial({fieldset:r.StringOrNull,config:t.TimestampConfig})]))}(Hp),Object.defineProperty(Kq,"__esModule",{value:!0}),Kq.NestableWidget=void 0;let Hh=n1,Hm=(0,Hh.__importStar)(V4);Kq.NestableWidget=Hm.union([KH.Color,KK.BooleanField,KZ.Embed,KY.GeoPoint,KG.Date,Hu.Number,Hs.Range,Hl.RichText,Hc.Select,Hd.Separator,Hf.Text,Hp.Timestamp,Ha.Link,KJ.Image,Ho.IntegrationField]),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Group=t.GroupConfig=t.GroupFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.GroupFieldType="Group",t.GroupConfig=n.exact(n.partial({label:r.StringOrNull,repeat:n.boolean,fields:n.record(V6.WidgetKey,Kq.NestableWidget)})),t.Group=n.exact(n.intersection([n.type({type:n.literal(t.GroupFieldType)}),n.partial({fieldset:r.StringOrNull,icon:n.string,description:n.string,config:t.GroupConfig})]))}(K$);var Hg={};!function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(KK,t),(0,n.__exportStar)(KH,t),(0,n.__exportStar)(KG,t),(0,n.__exportStar)(KZ,t),(0,n.__exportStar)(KY,t),(0,n.__exportStar)(KJ,t),(0,n.__exportStar)(Ho,t),(0,n.__exportStar)(Ha,t),(0,n.__exportStar)(Kq,t),(0,n.__exportStar)(Hu,t),(0,n.__exportStar)(Hs,t),(0,n.__exportStar)(Hl,t),(0,n.__exportStar)(Hc,t),(0,n.__exportStar)(Hd,t),(0,n.__exportStar)(Hf,t),(0,n.__exportStar)(Hp,t)}(Hg);var Hy={},Hv={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isCompositeSlice=t.CompositeSlice=t.CompositeSliceConfig=t.CompositeSliceType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.CompositeSliceType="Slice",t.CompositeSliceConfig=n.exact(n.partial({label:r.StringOrNull})),t.CompositeSlice=n.exact(n.intersection([n.type({type:n.literal(t.CompositeSliceType)}),n.partial({fieldset:r.StringOrNull,description:n.string,icon:n.string,display:n.string,"non-repeat":n.record(V6.WidgetKey,Kq.NestableWidget),repeat:n.record(V6.WidgetKey,Kq.NestableWidget),config:t.CompositeSliceConfig})])),t.isCompositeSlice=function(t){return"Slice"===t.type}}(Hv);var Hb={};Object.defineProperty(Hb,"__esModule",{value:!0}),Hb.isLegacySlice=Hb.LegacySlice=void 0;let Hx=n1,H_=(0,Hx.__importStar)(V4);Hb.LegacySlice=H_.union([Kq.NestableWidget,K$.Group]),Hb.isLegacySlice=function(t){return"Slice"!==t.type&&"SharedSlice"!==t.type};var HS={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.isDynamicSharedSlice=t.isStaticSharedSlice=t.SharedSlice=t.SharedSliceType=t.Variation=void 0;let n=(0,n1.__importStar)(V4);t.Variation=n.exact(n.intersection([n.type({id:n.string,name:n.string,description:n.string,imageUrl:(0,qX.withFallback)(n.string,"https://images.prismic.io/slice-machine/621a5ec4-0387-4bc5-9860-2dd46cbc07cd_default_ss.png?auto=compress,format"),docURL:n.string,version:n.string}),n.partial({display:n.string,primary:n.record(V6.WidgetKey,Kq.NestableWidget),items:n.record(V6.WidgetKey,Kq.NestableWidget)})])),t.SharedSliceType="SharedSlice";let r=n.string,i=n.string;t.SharedSlice=n.exact(n.intersection([n.type({id:n.string,type:n.literal(t.SharedSliceType),name:n.string,variations:n.readonlyArray(t.Variation)}),n.partial({description:n.string,legacyPaths:n.record(r,i)})])),t.isStaticSharedSlice=function(t){return"SharedSlice"===t.type},t.isDynamicSharedSlice=function(t){return"SharedSlice"===t.type}}(HS);var HT={};Object.defineProperty(HT,"__esModule",{value:!0}),HT.SharedSliceRef=void 0;let Hw=n1,HO=(0,Hw.__importStar)(V4);HT.SharedSliceRef=HO.exact(HO.type({type:HO.literal(HS.SharedSliceType)})),function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Slices=t.DynamicSlices=t.StaticSlices=t.slicesReader=t.DynamicSlicesConfig=t.StaticSlicesConfig=t.slicesConfigReader=t.SlicesLabels=t.SlicesFieldType=t.LegacySlicesFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();function i(i){return n.exact(n.partial({label:r.StringOrNull,labels:t.SlicesLabels,choices:n.record(V6.WidgetKey,n.union([Hb.LegacySlice,Hv.CompositeSlice,i]))}))}t.LegacySlicesFieldType="Choice",t.SlicesFieldType="Slices",t.SlicesLabels=n.union([n.record(n.string,n.readonlyArray(n.exact(n.intersection([n.type({name:n.string}),n.partial({display:n.string})])))),n.null]),t.slicesConfigReader=i,t.StaticSlicesConfig=i(HS.SharedSlice),t.DynamicSlicesConfig=i(HT.SharedSliceRef);let o={toStatic(t,n){let r=Object.entries(t.choices||{}).reduce((t,[r,i])=>{if("SharedSlice"!==i.type)return{...t,[r]:i};{let o=n.get(r);return o?{...t,[r]:o}:t}},{});return{...t,choices:r}}};function a(i){return n.exact(n.intersection([n.type({type:n.keyof({[t.SlicesFieldType]:null,[t.LegacySlicesFieldType]:null})}),n.partial({fieldset:r.StringOrNull,config:i})]))}t.slicesReader=a,t.StaticSlices=a(t.StaticSlicesConfig),t.DynamicSlices=a(t.DynamicSlicesConfig),t.Slices={toStatic:(t,n)=>t.config?{...t,config:o.toStatic(t.config,n)}:t}}(Hy);var Hk={};!function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.UID=t.UIDConfig=t.UIDFieldType=void 0;let n=(0,n1.__importStar)(V4),r=Kz();t.UIDFieldType="UID",t.UIDConfig=n.exact(n.partial({label:r.StringOrNull,useAsTitle:n.boolean,placeholder:n.string})),t.UID=n.exact(n.intersection([n.type({type:n.literal(t.UIDFieldType)}),n.partial({fieldset:r.StringOrNull,config:t.UIDConfig})]))}(Hk),Object.defineProperty(KV,"__esModule",{value:!0}),KV.Widgets=KV.FieldType=KV.DynamicWidget=KV.StaticWidget=KV.widgetReader=void 0;let HC=n1,HI=(0,HC.__importStar)(V4);function HM(t){return HI.union([Hk.UID,Kq.NestableWidget,K$.Group,t])}KV.widgetReader=HM,KV.StaticWidget=HM(Hy.StaticSlices),KV.DynamicWidget=HM(Hy.DynamicSlices),KV.FieldType=HI.keyof({[Hg.ColorFieldType]:null,[Hg.BooleanFieldType]:null,[Hg.NumberFieldType]:null,[Hg.EmbedFieldType]:null,[Hg.GeoPointFieldType]:null,[Hg.DateFieldType]:null,[Hg.RangeFieldType]:null,[Hg.RichTextFieldType]:null,[Hg.SelectFieldType]:null,[Hg.SeparatorFieldType]:null,[Hg.TextFieldType]:null,[Hg.TimestampFieldType]:null,[Hg.LinkFieldType]:null,[Hg.ImageFieldType]:null,[Hg.IntegrationFieldType]:null,[Hk.UIDFieldType]:null,[K$.GroupFieldType]:null,[Hy.SlicesFieldType]:null,[Hy.LegacySlicesFieldType]:null}),KV.Widgets={toStatic(t,n){switch(t.type){case"Choice":case"Slices":return Hy.Slices.toStatic(t,n);default:return t}}},Object.defineProperty(KB,"__esModule",{value:!0}),KB.Sections=KB.DynamicSection=KB.StaticSection=KB.sectionReader=void 0;let HR=n1,HE=(0,HR.__importStar)(V4);function Hj(t){return HE.record(V6.WidgetKey,t)}KB.sectionReader=Hj,KB.StaticSection=Hj(KV.StaticWidget),KB.DynamicSection=Hj(KV.DynamicWidget),KB.Sections={toStatic:(t,n)=>Object.entries(t).reduce((t,[r,i])=>({...t,[r]:KV.Widgets.toStatic(i,n)}),{})},function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.collectSharedSlices=t.flattenCustomTypeFields=t.filterMissingSharedSlices=t.collectWidgets=t.validateSlices=t.toStatic=t.flattenSections=t.flattenWidgets=t.CustomType=t.StaticCustomType=t.CustomTypeFormat=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Kz();t.CustomTypeFormat={page:"page",custom:"custom"};class o extends Error{constructor(t){super(),Object.defineProperty(this,"slices",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"message",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.slices=t,this.message=this._formatError(t)}_formatError(t){return`The following slices doesn't exists in your Prismic repository:
|
|
3
3
|
${t.map(t=>` - ${t}`).join(`
|
|
4
4
|
`)}
|
|
5
|
-
`}}function a(n){return r.exact(r.intersection([r.type({id:r.string,label:i.StringOrNull,repeatable:(0,qX.withFallback)(r.boolean,!0),json:r.record(r.string,n),status:(0,qX.withFallback)(r.boolean,!0)}),r.partial({hash:r.string,format:(0,qX.withFallback)(r.keyof(t.CustomTypeFormat),"custom")})]))}function u(t){return Object.entries(t.json).reduce((t,[,n])=>{let r=Object.entries(n);return t.concat(r)},[])}function s(t,n){let r=Object.entries(t.json).reduce((t,[r,i])=>{let o=Object.entries(i).reduce((t,[r,i])=>{let o=n(r,i);return o?{...t,[r]:o}:t},{});return{...t,[r]:o}},{});return{...t,json:r}}t.StaticCustomType=a(KB.StaticSection),t.CustomType=a(KB.DynamicSection),t.flattenWidgets=u,t.flattenSections=function(t){return Object.entries(t.json).reduce((t,[,n])=>{let r=Object.entries(n);return t.concat(r)},[])},t.toStatic=function(t,n){let r=Object.entries(t.json).reduce((t,[r,i])=>({...t,[r]:KB.Sections.toStatic(i,n)}),{});return{...t,json:r}},t.validateSlices=function(t,n){let r=(function(t){var n;let r=u(t).filter(([,t])=>"Slices"===t.type).reduce((t,[,n])=>{let r=Object.entries(n.config&&n.config.choices?n.config.choices:{}).filter(([,t])=>"SharedSlice"===t.type).map(([t])=>t);return t.concat(r)},[]);return function(t){return r.map(t)}})(t)(t=>{if(!n.get(t))return t}).filter(Boolean);return r.length>0?(0,UZ.left)(new o(r)):(0,UZ.right)(t)},t.collectWidgets=s,t.filterMissingSharedSlices=function(t,n){return s(t,(t,r)=>{if("Slices"===r.type){if(!r.config||!r.config.choices)return r;let i=Object.entries(r.config.choices).reduce((t,[r,i])=>"SharedSlice"!==i.type||n.get(r)?{...t,[r]:i}:t,{}),o={...r.config,choices:i};return{...r,config:o}}return r})},t.flattenCustomTypeFields=function(t){return Object.values(t.json).reduce((t,n)=>({...t,...n}),{})},t.collectSharedSlices=function(t){return Object.entries(t.fields).reduce((t,[,n])=>{var r;return"Slices"===n.type||"Choice"===n.type?{...t,...Object.entries((null===(r=n.config)||void 0===r?void 0:r.choices)||{}).reduce((t,[n,r])=>"SharedSlice"===r.type?{...t,[n]:r}:t,{})}:t},{})}}(qQ);var HA,HN,HP={},HL={};Object.defineProperty(HA=HL,"__esModule",{value:!0}),HA.DiffOperation=void 0,(HN=HA.DiffOperation||(HA.DiffOperation={})).Added="added",HN.Removed="removed",HN.Updated="updated";var HF={},HD={},HW={};Object.defineProperty(HW,"__esModule",{value:!0}),HW.HexaColor=void 0;let HU=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;HW.HexaColor={is:t=>HU.test(t)};var Hz={};Object.defineProperty(Hz,"__esModule",{value:!0}),Hz.toRecord=void 0,Hz.toRecord=function(t,n){return t.reduce((t,r)=>{let i=n(r);return{...t,[i]:r}},{})};var HB={};Object.defineProperty(HB,"__esModule",{value:!0}),HB.mapValues=HB.isObject=HB.withOptionals=HB.isNotEmpty=HB.zipObjects=void 0;let HV=n1,H$=(0,HV.__importStar)(V4);HB.zipObjects=function(t,n){return[...new Set(Object.keys(t||{}).concat(Object.keys(n||{})))].reduce((r,i)=>{let o=null==t?void 0:t[i],a=null==n?void 0:n[i];return{...r,[i]:{left:o,right:a}}},{})},HB.isNotEmpty=function(t){return Boolean(Object.keys(t).length)},HB.withOptionals=function(t,n){return{...t,...n.reduce((t,[n,r])=>r?{...t,[n]:r}:t,{})}};let Hq=H$.record(H$.string,H$.unknown);HB.isObject=function(t){return(0,UZ.isRight)(Hq.decode(t))},HB.mapValues=function(t,n){return Object.entries(t).reduce((t,[r,i])=>({...t,[r]:n(i,r)}),{})},Object.defineProperty(HD,"__esModule",{value:!0}),HD.Objects=HD.Arrays=HD.HexaColorCode=void 0;let HK=n1;HD.HexaColorCode=(0,HK.__importStar)(HW),HD.Arrays=(0,HK.__importStar)(Hz),HD.Objects=(0,HK.__importStar)(HB);var HH={};function HG(t,n){let r=HD.Objects.zipObjects(t,n),i=Object.entries(r).reduce((t,[n,r])=>{if(JSON.stringify(null==r?void 0:r.left)===JSON.stringify(null==r?void 0:r.right))return t;let i=(()=>{if(!(!(null!=r&&r.left)&&!(null!=r&&r.right)))return null!=r&&r.left&&!r.right?{op:HL.DiffOperation.Removed}:!(null!=r&&r.left)&&null!=r&&r.right?{op:HL.DiffOperation.Added,value:r.right}:{op:HL.DiffOperation.Updated,value:r.right}})();return i?{...t,[n]:i}:t},{});return HD.Objects.isNotEmpty(i)?i:void 0}Object.defineProperty(HH,"__esModule",{value:!0}),HH.VariationComparator=void 0,HH.VariationComparator={compare(t,n){if(t&&!n)return{op:HL.DiffOperation.Removed};if(!t&&n)return{op:HL.DiffOperation.Added,value:n};let r=function(t,n){let r=HD.Objects.zipObjects(t,n);return Object.entries(r).reduce((t,[n,r])=>"primary"===n||"items"===n||(null==r?void 0:r.left)===(null==r?void 0:r.right)?t:{...t,[n]:null==r?void 0:r.right},{})}(t,n),i=HG(null==t?void 0:t.primary,null==n?void 0:n.primary),o=HG(null==t?void 0:t.items,null==n?void 0:n.items),a={...r,...i?{primary:i}:{},...o?{items:o}:{}};if(HD.Objects.isNotEmpty(a))return{op:HL.DiffOperation.Updated,value:a}}},Object.defineProperty(HF,"__esModule",{value:!0}),HF.SliceComparator=void 0,HF.SliceComparator={compare(t,n){if(!t&&n)return{op:HL.DiffOperation.Added,value:n};if(t&&!n)return{op:HL.DiffOperation.Removed};let r=function(t,n){let r=HD.Objects.zipObjects(t,n);return Object.entries(r).reduce((t,[n,r])=>"variations"===n||(null==r?void 0:r.left)===(null==r?void 0:r.right)?t:{...t,[n]:null==r?void 0:r.right},{})}(t,n),i=HD.Objects.zipObjects(t&&HD.Arrays.toRecord(t.variations,t=>t.id),n&&HD.Arrays.toRecord(n.variations,t=>t.id)),o=Object.entries(i).reduce((t,[n,r])=>{if(!r)return t;let i=HH.VariationComparator.compare(r.left,r.right);return i?{...t,[n]:i}:t},{}),a={...r,...HD.Objects.isNotEmpty(o)?{variations:o}:{}};if(HD.Objects.isNotEmpty(a))return{op:HL.DiffOperation.Updated,value:a}}},function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(HL,t),(0,n.__exportStar)(HF,t),(0,n.__exportStar)(HH,t)}(HP);var HZ,HY,HJ={},HQ={};HZ=HQ,HY=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},Object.defineProperty(HZ,"__esModule",{value:!0}),HZ.ImageConstraint=void 0,Object.defineProperty(HZ,"ImageConstraint",{enumerable:!0,get:function(){return HY(KQ).default}});var HX={},H0={};Object.defineProperty(H0,"__esModule",{value:!0});var H1={};Object.defineProperty(H1,"__esModule",{value:!0}),H1.SlicesTypes=void 0;let H2=n1,H3=(0,H2.__importStar)(V4);H1.SlicesTypes=H3.keyof({[Hv.CompositeSliceType]:null,[HS.SharedSliceType]:null}),function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(Hv,t),(0,n.__exportStar)(Hb,t),(0,n.__exportStar)(HS,t),(0,n.__exportStar)(HT,t),(0,n.__exportStar)(H0,t),(0,n.__exportStar)(Hy,t),(0,n.__exportStar)(H1,t)}(HX),function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(K$,t),(0,n.__exportStar)(Hg,t),(0,n.__exportStar)(HQ,t),(0,n.__exportStar)(HX,t),(0,n.__exportStar)(Hk,t),(0,n.__exportStar)(KV,t)}(HJ),function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(qQ,t),(0,n.__exportStar)(HP,t),(0,n.__exportStar)(KB,t),(0,n.__exportStar)(HJ,t)}(qJ);var H4,H5,H6,H9,H8,H7,Ge,Gt,Gn,Gr={},Gi={},Go={};function Ga(){if(Gn)return Go;Gn=1,Object.defineProperty(Go,"__esModule",{value:!0}),Go.hasContentType=Go.hasFieldContentType=void 0;let t=ZV();function n(t){return"object"==typeof t&&null!==t&&"__TYPE__"in t}return Go.hasFieldContentType=function(r){return n(r)&&r.__TYPE__===t.FieldContentType&&(null==r?void 0:r.type)!==void 0&&"string"==typeof r.type&&(0,UZ.isRight)(t.FieldType.decode(r.type))},Go.hasContentType=n,Go}function Gu(){return Gp||(Gp=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.EmptyContent=t.EmptyLegacy=t.isEmptyContent=t.EmptyContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga();t.EmptyContentType="EmptyContent";let o=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.EmptyContentType;t.isEmptyContent=o;let a=r.union([r.null,r.type({value:r.null})]),u=n=>new r.Type("EmptyLegacy",t.isEmptyContent,r=>(0,UQ.pipe)(a.decode(r),UG.either.map(()=>({type:n,__TYPE__:t.EmptyContentType}))),()=>null);t.EmptyLegacy=u,t.EmptyContent=r.strict({type:r.string,__TYPE__:r.literal(t.EmptyContentType)})}(Gi)),Gi}var Gs={},Gl={};Object.defineProperty(Gl,"__esModule",{value:!0}),Gl.defaultCtx=Gl.getFieldCtx=Gl.LegacyContentCtx=Gl.FieldOrSliceType=void 0;let Gc=n1,Gd=(0,Gc.__importStar)(V4);Gl.FieldOrSliceType=Gd.union([HJ.FieldType,HJ.SlicesTypes]);class Gf{constructor(t,n,r){Object.defineProperty(this,"fieldKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"prefixedKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keyOfType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fieldPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fieldType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.fieldKey=t,this.fieldPath=n||[],this.allTypes=r||new Map;let i=Array.of(this.fieldPath,[this.fieldKey]).flat().join(".");this.prefixedKey=i,this.keyOfType=`${i}_TYPE`,this.fieldType=this.allTypes.get(this.prefixedKey)}}Gl.LegacyContentCtx=Gf,Gl.getFieldCtx=function(t,n,r){return new Gf(t,[...n.fieldPath,n.fieldKey,...r||[]],n.allTypes)},Gl.defaultCtx=function(t,n=new Map){return new Gf(t,[],n)};var Gp,Gh,Gm={},Gg={};function Gy(){return Gh||(Gh=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanContentDefaultValue=t.BooleanContent=t.BooleanLegacy=t.isBooleanContent=t.BooleanContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga();t.BooleanContentType="BooleanContent";let o=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.BooleanContentType;t.isBooleanContent=o;let a=n=>new r.Type("BooleanLegacy",t.isBooleanContent,n=>(0,UQ.pipe)(r.boolean.decode(n),UG.either.map(n=>t.BooleanContent.encode({value:n,__TYPE__:t.BooleanContentType}))),t=>({content:t.value,types:{[n.keyOfType]:"Boolean"}}));t.BooleanLegacy=a,t.BooleanContent=r.strict({__TYPE__:r.literal(t.BooleanContentType),value:r.boolean});let u=n=>{var r;return(null===(r=n.config)||void 0===r?void 0:r.default_value)!==void 0?{__TYPE__:t.BooleanContentType,value:n.config.default_value||!1}:void 0};t.BooleanContentDefaultValue=u}(Gg)),Gg}var Gv,Gb={};function Gx(){return Gv||(Gv=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.EmbedContent=t.EmbedLegacy=t.EmbedContentLegacy=t.isEmbedContent=t.EmbedContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Kz(),o=Ga();t.EmbedContentType="EmbedContent";let a=n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.EmbedContentType;t.isEmbedContent=a,t.EmbedContentLegacy=r.exact(r.intersection([r.type({embed_url:r.string,type:r.string}),r.partial({version:r.union([r.string,r.number,r.null]),title:i.StringOrNull,author_name:i.StringOrNull,author_url:i.StringOrNull,provider_name:i.StringOrNull,provider_url:i.StringOrNull,cache_age:r.union([r.string,r.number,r.null]),thumbnail_url:i.StringOrNull,thumbnail_width:i.NumberOrNull,thumbnail_height:i.NumberOrNull,html:i.StringOrNull})]));let u=n=>new r.Type("EmbedLegacy",t.isEmbedContent,n=>(0,UQ.pipe)(t.EmbedContentLegacy.decode(n),UG.either.map(r=>({...r,all:n,__TYPE__:t.EmbedContentType}))),t=>({content:t.all,types:{[n.keyOfType]:"Embed"}}));t.EmbedLegacy=u,t.EmbedContent=r.intersection([t.EmbedContentLegacy,r.strict({__TYPE__:r.literal(t.EmbedContentType),all:r.unknown})])}(Gb)),Gb}var G_={},GS={},GT={};Object.defineProperty(GT,"__esModule",{value:!0});let Gw=n1,GO=(0,Gw.__importStar)(V4);GT.default=new GO.Type("TrimmedString",GO.string.is,(t,n)=>(0,$r.pipe)(GO.string.validate(t,n),(0,Ko.chain)(t=>GO.success(function(t){let n=0;for(;n<t.length&&t[n]<=" ";)n++;let r=t.length;for(;n<r&&t[r-1]<=" ";)r--;return t.substring(n,r)}(t)))),t=>t);var Gk={};function GC(){return GI||(GI=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContent=t.ColorLegacy=t.isColorContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Color"===t.type;t.isColorContent=a;let u=n=>new r.Type("ColorLegacy",t.isColorContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.ColorContent.encode({value:n,type:HJ.ColorFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.ColorFieldType}}));t.ColorLegacy=u,t.ColorContent=r.strict({type:r.literal(HJ.ColorFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)})}(GS)),GS}Object.defineProperty(Gk,"__esModule",{value:!0}),Gk.FieldContentType=void 0,Gk.FieldContentType="FieldContent";var GI,GM,GR={};function GE(){return GM||(GM=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DateContent=t.DateLegacy=t.isDateContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Date"===t.type;t.isDateContent=a;let u=n=>new r.Type("DateLegacy",t.isDateContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.DateContent.encode({value:n,type:HJ.DateFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.DateFieldType}}));t.DateLegacy=u,t.DateContent=r.strict({type:r.literal(HJ.DateFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)})}(GR)),GR}var Gj,GA={};function GN(){return Gj||(Gj=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.NumberContent=t.NumberLegacy=t.isNumberContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Number"===t.type;t.isNumberContent=a;let u=n=>new r.Type("NumberLegacy",t.isNumberContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.NumberContent.encode({value:n,type:HJ.NumberFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.NumberFieldType}}));t.NumberLegacy=u,t.NumberContent=r.strict({type:r.literal(HJ.NumberFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)})}(GA)),GA}var GP,GL={};function GF(){return GP||(GP=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.RangeContent=t.RangeLegacy=t.isRangeContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Range"===t.type;t.isRangeContent=a;let u=n=>new r.Type("RangeLegacy",t.isRangeContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.RangeContent.encode({value:n,type:HJ.RangeFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.RangeFieldType}}));t.RangeLegacy=u,t.RangeContent=r.strict({type:r.literal(HJ.RangeFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)})}(GL)),GL}var GD,GW={};function GU(){return GD||(GD=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SelectContentDefaultValue=t.SelectContent=t.SelectLegacy=t.isSelectContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Select"===t.type;t.isSelectContent=a;let u=n=>new r.Type("SelectLegacy",t.isSelectContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.SelectContent.encode({value:n,type:HJ.SelectFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.SelectFieldType}}));t.SelectLegacy=u,t.SelectContent=r.strict({type:r.literal(HJ.SelectFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)});let s=t=>{var n;return!(null===(n=t.config)||void 0===n)&&n.default_value?{__TYPE__:Gk.FieldContentType,type:HJ.SelectFieldType,value:t.config.default_value||""}:void 0};t.SelectContentDefaultValue=s}(GW)),GW}var Gz,GB={};function GV(){return Gz||(Gz=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.TextContent=t.TextLegacy=t.isTextContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Text"===t.type;t.isTextContent=a;let u=n=>new r.Type("TextLegacy",t.isTextContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.TextContent.encode({value:n,type:HJ.TextFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.TextFieldType}}));t.TextLegacy=u,t.TextContent=r.strict({type:r.literal(HJ.TextFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)})}(GB)),GB}var G$,Gq={};function GK(){return G$||(G$=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.TimestampContent=t.TimestampLegacy=t.isTimestampContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Timestamp"===t.type;t.isTimestampContent=a;let u=n=>new r.Type("TimestampLegacy",t.isTimestampContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.TimestampContent.encode({value:n,type:HJ.TimestampFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.TimestampFieldType}}));t.TimestampLegacy=u,t.TimestampContent=r.strict({type:r.literal(HJ.TimestampFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)})}(Gq)),Gq}function GH(){return GG||(GG=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.FieldContent=t.FieldType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=GC(),o=GE(),a=GN(),u=GF(),s=GU(),l=GV(),c=GK();t.FieldType=r.keyof({Text:null,Date:null,Timestamp:null,Color:null,Number:null,Range:null,Select:null}),t.FieldContent=r.union([o.DateContent,i.ColorContent,a.NumberContent,u.RangeContent,s.SelectContent,l.TextContent,c.TimestampContent]),(0,n.__exportStar)(GC(),t),(0,n.__exportStar)(Gk,t),(0,n.__exportStar)(GE(),t),(0,n.__exportStar)(GN(),t),(0,n.__exportStar)(GF(),t),(0,n.__exportStar)(GU(),t),(0,n.__exportStar)(GV(),t),(0,n.__exportStar)(GK(),t)}(G_)),G_}var GG,GZ,GY={};function GJ(){return GZ||(GZ=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.GeoPointContent=t.GeoPointLegacy=t.isGeoPointContent=t.GeoPointContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga();t.GeoPointContentType="GeoPointContent";let o=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.GeoPointContentType;t.isGeoPointContent=o;let a=r.strict({position:r.strict({lat:r.number,lng:r.number})}),u=n=>new r.Type("GeoPointLegacy",t.isGeoPointContent,n=>(0,$r.pipe)(a.decode(n),UG.either.map(n=>t.GeoPointContent.encode({...n,__TYPE__:t.GeoPointContentType}))),t=>({content:{position:t.position},types:{[n.keyOfType]:"GeoPoint"}}));t.GeoPointLegacy=u,t.GeoPointContent=r.intersection([a,r.strict({__TYPE__:r.literal(t.GeoPointContentType)})])}(GY)),GY}var GQ,GX={};function G0(){return GQ||(GQ=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ImageContent=t.ImageLegacy=t.ImageContentView=t.isImageContent=t.ImageContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Kz(),o=Ga();t.ImageContentType="ImageContent";let a=n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.ImageContentType;t.isImageContent=a;let u=r.exact(r.type({id:r.string,url:r.string,width:r.number,height:r.number}));t.ImageContentView=r.exact(r.intersection([r.type({origin:u,width:r.number,height:r.number,edit:r.type({zoom:r.number,crop:r.type({x:r.number,y:r.number}),background:r.string})}),r.partial({url:r.string,credits:i.NonEmptyStringOrNull,alt:i.NonEmptyStringOrNull,provider:i.StringOrNull})]));let s=r.intersection([t.ImageContentView,r.partial({thumbnails:r.record(r.string,t.ImageContentView)})]),l=n=>new r.Type("ImageLegacy",t.isImageContent,n=>(0,UQ.pipe)(s.decode(n),UG.either.map(n=>t.ImageContent.encode({...n,__TYPE__:t.ImageContentType}))),t=>({content:(0,HB.withOptionals)({edit:t.edit,height:t.height,origin:t.origin,width:t.width},[["alt",t.alt],["credits",t.credits],["provider",t.provider],["thumbnails",t.thumbnails],["url",t.url]]),types:{[n.keyOfType]:"Image"}}));t.ImageLegacy=l,t.ImageContent=r.intersection([s,r.strict({__TYPE__:r.literal(t.ImageContentType)})])}(GX)),GX}var G1,G2={};function G3(){return G1||(G1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.IntegrationFieldContent=t.IntegrationFieldLegacy=t.isIntegrationFieldContent=t.IntegrationFieldContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga();t.IntegrationFieldContentType="IntegrationFieldsContent";let o=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.IntegrationFieldContentType;t.isIntegrationFieldContent=o;let a=n=>new r.Type("IntegrationFieldLegacy",t.isIntegrationFieldContent,n=>(0,UQ.pipe)(r.string.decode(n),UG.either.map(n=>t.IntegrationFieldContent.encode({value:n,__TYPE__:t.IntegrationFieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:"IntegrationFields"}}));t.IntegrationFieldLegacy=a,t.IntegrationFieldContent=r.strict({__TYPE__:r.literal(t.IntegrationFieldContentType),value:r.string})}(G2)),G2}var G4,G5={};function G6(){return G4||(G4=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.LinkContent=t.Link=t.LinkContentLegacy=t.LinkLegacy=t.isLinkContent=t.LinkContentType=t.ExternalLinkContent=t.ExternalLinkType=t.DocumentLinkContent=t.DocumentLinkType=t.FileLinkContent=t.FileLinkType=t.ImageLinkContent=t.ImageLinkType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Kz(),o=Ga();t.ImageLinkType="ImageLink";let a=r.exact(r.intersection([r.type({id:r.string,url:r.string,height:r.string,width:r.string,size:r.string,name:r.string,kind:r.string}),r.partial({date:i.StringOrNull})])),u=new r.Type("ImageLink",n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.ImageLinkType,n=>(0,UQ.pipe)(a.decode(n),UG.either.map(n=>t.ImageLinkContent.encode({...n,__TYPE__:t.ImageLinkType}))),t=>a.encode(t));t.ImageLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.ImageLinkType)}),a]),t.FileLinkType="FileLink";let s=r.exact(r.intersection([r.type({id:r.string,url:r.string,name:r.string,kind:r.string,size:(0,q$.withFallback)(r.string,"0")}),r.partial({date:(0,$n.nullable)(r.string)})])),l=new r.Type("FileLink",n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.FileLinkType,n=>(0,UQ.pipe)(s.decode(n),UG.either.map(n=>t.FileLinkContent.encode({...n,__TYPE__:t.FileLinkType}))),t=>s.encode(t));t.FileLinkContent=r.intersection([s,r.exact(r.intersection([r.type({__TYPE__:r.literal(t.FileLinkType)}),r.partial({size:(0,q$.withFallback)(r.string,"0")})]))]),t.DocumentLinkType="DocumentLink";let c=r.strict({id:i.NonEmptyString}),d=new r.Type("DocumentLink",n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.DocumentLinkType,n=>(0,UQ.pipe)(c.decode(n),UG.either.map(n=>t.DocumentLinkContent.encode({...n,__TYPE__:t.DocumentLinkType}))),t=>c.encode(t));t.DocumentLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.DocumentLinkType)}),c]),t.ExternalLinkType="ExternalLink";let f=r.exact(r.intersection([r.type({url:r.string}),r.partial({kind:r.literal("web"),target:i.StringOrNull,preview:(0,$n.nullable)(r.partial({title:r.string}))})])),p=new r.Type("ExternalLink",n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.ExternalLinkType,n=>(0,UQ.pipe)(f.decode(n),UG.either.map(n=>t.ExternalLinkContent.encode({...n,__TYPE__:t.ExternalLinkType}))),t=>f.encode(t));t.ExternalLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.ExternalLinkType)}),f]),t.LinkContentType="LinkContent";let h=n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.LinkContentType;t.isLinkContent=h,t.LinkLegacy=r.union([u,l,d,p]);let m=n=>new r.Type("LinkLegacy",t.isLinkContent,n=>(0,UQ.pipe)(t.LinkLegacy.decode(n),UG.either.map(n=>t.LinkContent.encode({value:n,__TYPE__:t.LinkContentType}))),r=>({content:t.LinkLegacy.encode(r.value),types:{[n.keyOfType]:"Link"}}));t.LinkContentLegacy=m,t.Link=r.union([t.ImageLinkContent,t.FileLinkContent,t.DocumentLinkContent,t.ExternalLinkContent]),t.LinkContent=r.strict({__TYPE__:r.literal(t.LinkContentType),value:t.Link})}(G5)),G5}var G9,G8={},G7={},Ze={};function Zt(){return G9||(G9=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Block=t.BlockLegacy=t.TextBlock=t.checkEmbedBlock=t.EmbedBlock=t.checkImageBlock=t.ImageBlock=t.ValidatedSpans=t.SpanLegacy=t.Span=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Kz(),o=Gx(),a=G0(),u=G6(),s=t=>r.strict({data:t,start:r.number,end:r.number,type:r.literal(Hg.RichTextNodeType.hyperlink)}),l=r.strict({data:(0,q$.withFallback)(r.string,""),start:r.number,end:r.number,type:r.literal("label")}),c=r.strict({start:r.number,end:r.number,type:r.keyof({[Hg.RichTextNodeType.strong]:null,[Hg.RichTextNodeType.em]:null,"list-item":null})});t.Span=r.union([s(u.Link),l,c]),t.SpanLegacy=r.union([s(u.LinkLegacy),l,c]);let d=t=>new r.Type("ValidatedSpans",n=>Array.isArray(n)&&n.every(t.is),(n,i)=>{if(!Array.isArray(n))return r.failure(n,i);{let o=n.reduce((n,r)=>{let i=t.decode(r);return(0,UZ.isLeft)(i)?n:[...n,i.right]},[]).sort((t,n)=>t.start-n.start);return r.success(o)}},n=>n.reduce((n,r)=>{let i=t.encode(r);return[...n,i]},[]));t.ValidatedSpans=d;let f=t=>r.exact(r.intersection([r.type({type:r.literal(Hg.RichTextNodeType.image),data:r.intersection([a.ImageContentView,r.partial({linkTo:(0,$n.nullable)(t)})])}),r.partial({label:i.StringOrNull,direction:i.StringOrNull})]));t.ImageBlock=f(u.Link);let p=f(u.LinkLegacy);t.checkImageBlock=function(t){return t.type===Hg.RichTextNodeType.image};let h=r.exact(r.intersection([r.type({type:r.literal(Hg.RichTextNodeType.embed),data:r.unknown}),r.partial({label:i.StringOrNull,direction:i.StringOrNull})])),m=new r.Type("EmbedBlockLegacy",t=>"embed"===t.type,n=>(0,UQ.pipe)(h.decode(n),UG.either.chain(t=>UG.either.map(n=>[t,n])(o.EmbedContentLegacy.decode(t.data))),UG.either.map(([n,r])=>t.EmbedBlock.encode({...n,data:{...r,__TYPE__:o.EmbedContentType,all:n.data}}))),t=>({...h.encode(t),data:o.EmbedContentLegacy.encode(t.data)}));t.EmbedBlock=r.exact(r.intersection([r.type({type:r.literal(Hg.RichTextNodeType.embed),data:o.EmbedContent}),r.partial({label:i.StringOrNull,direction:i.StringOrNull})])),t.checkEmbedBlock=function(t){return t.type===Hg.RichTextNodeType.embed};let g=n=>r.exact(r.intersection([r.type({type:(0,$n.refineType)(Hg.RichTextNodeTypeCodec,`string which isn't ${Hg.RichTextNodeType.image} ${Hg.RichTextNodeType.embed}`,t=>t!==Hg.RichTextNodeType.image&&t!==Hg.RichTextNodeType.embed),content:r.intersection([r.type({text:r.string}),r.partial({spans:(0,t.ValidatedSpans)(n)})])}),r.partial({label:r.string,direction:r.string})]));t.TextBlock=g(t.Span);let y=g(t.SpanLegacy),v=r.union([m,p,y]);t.BlockLegacy=new r.Type("BlockLegacy",t=>m.is(t)||p.is(t)||y.is(t),t=>v.decode(t),n=>t.ImageBlock.is(n)?p.encode(n):t.EmbedBlock.is(n)?m.encode(n):y.encode(n)),t.Block=r.union([t.ImageBlock,t.EmbedBlock,t.TextBlock])}(Ze)),Ze}function Zn(){return Zr||(Zr=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.RichTextLegacy=t.RichTextContent=t.isRichTextContent=t.RichTextContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga(),o=Zt();t.RichTextContentType="StructuredTextContent";let a=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.RichTextContentType;t.isRichTextContent=a;let u=r.array(o.BlockLegacy);t.RichTextContent=r.strict({__TYPE__:r.literal(t.RichTextContentType),value:r.array(o.Block)}),(0,n.__exportStar)(Zt(),t);let s=n=>new r.Type("RichTextLegacy",t.isRichTextContent,n=>(0,UQ.pipe)(u.decode(n),UG.either.map(n=>({value:n,__TYPE__:t.RichTextContentType}))),t=>({content:u.encode(t.value),types:{[n.keyOfType]:"StructuredText"}}));t.RichTextLegacy=s}(G7)),G7}var Zr,Zi,Zo={};function Za(){return Zi||(Zi=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SeparatorContent=t.SeparatorLegacy=t.isSeparatorContent=t.SeparatorContentType=void 0;let n=(0,n1.__importStar)(V4),r=Ga();t.SeparatorContentType="SeparatorContent";let i=n=>(0,r.hasContentType)(n)&&n.__TYPE__===t.SeparatorContentType;t.isSeparatorContent=i;let o=r=>new n.Type("SeparatorLegacy",t.isSeparatorContent,()=>n.success(t.SeparatorContent.encode({__TYPE__:t.SeparatorContentType})),()=>({content:{},types:{[r.keyOfType]:"Separator"}}));t.SeparatorLegacy=o,t.SeparatorContent=n.strict({__TYPE__:n.literal(t.SeparatorContentType)})}(Zo)),Zo}function Zu(){return Zl||(Zl=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(Gy(),t),(0,n.__exportStar)(Gx(),t),(0,n.__exportStar)(GH(),t),(0,n.__exportStar)(GJ(),t),(0,n.__exportStar)(G0(),t),(0,n.__exportStar)(G3(),t),(0,n.__exportStar)(G6(),t),(0,n.__exportStar)(function(){if(Zs)return G8;Zs=1,Object.defineProperty(G8,"__esModule",{value:!0}),G8.NestableLegacy=G8.isNestableContent=G8.NestableContentDefaultValue=G8.NestableContent=void 0;let t=n1,n=(0,t.__importStar)(V4),r=Gu(),i=Gy(),o=Gx(),a=GH(),u=GJ(),s=G0(),l=G3(),c=G6(),d=Zn(),f=Za();G8.NestableContent=n.union([r.EmptyContent,i.BooleanContent,o.EmbedContent,a.TextContent,a.TimestampContent,a.SelectContent,a.RangeContent,a.NumberContent,a.DateContent,a.ColorContent,u.GeoPointContent,s.ImageContent,l.IntegrationFieldContent,c.LinkContent,d.RichTextContent,f.SeparatorContent]);let p=t=>{switch(t.type){case"Boolean":return(0,i.BooleanContentDefaultValue)(t);case"Select":return(0,a.SelectContentDefaultValue)(t);default:return}};G8.NestableContentDefaultValue=p;let h=t=>(0,a.isTextContent)(t)||(0,a.isColorContent)(t)||(0,a.isDateContent)(t)||(0,a.isTimestampContent)(t)||(0,a.isNumberContent)(t)||(0,a.isRangeContent)(t)||(0,a.isSelectContent)(t)||(0,u.isGeoPointContent)(t)||(0,d.isRichTextContent)(t)||(0,i.isBooleanContent)(t)||(0,o.isEmbedContent)(t)||(0,s.isImageContent)(t)||(0,l.isIntegrationFieldContent)(t)||(0,c.isLinkContent)(t)||(0,f.isSeparatorContent)(t)||(0,r.isEmptyContent)(t);G8.isNestableContent=h;let m=t=>({decode(n){if(!t.fieldType)return;let p=(0,r.EmptyLegacy)(t.fieldType).decode(n);if((0,UZ.isRight)(p))return p;let h=(()=>{switch(t.fieldType){case"Text":return(0,a.TextLegacy)(t);case"Color":return(0,a.ColorLegacy)(t);case"Date":return(0,a.DateLegacy)(t);case"Timestamp":return(0,a.TimestampLegacy)(t);case"Number":return(0,a.NumberLegacy)(t);case"Range":return(0,a.RangeLegacy)(t);case"Select":return(0,a.SelectLegacy)(t);case"GeoPoint":return(0,u.GeoPointLegacy)(t);case"StructuredText":return(0,d.RichTextLegacy)(t);case"Boolean":return(0,i.BooleanLegacy)(t);case"Embed":return(0,o.EmbedLegacy)(t);case"Image":return(0,s.ImageLegacy)(t);case"IntegrationFields":return(0,l.IntegrationFieldLegacy)(t);case"Link":return(0,c.LinkContentLegacy)(t);case"Separator":return(0,f.SeparatorLegacy)(t);default:return}})();if(h)return h.decode(n)},encode(n){switch(n.__TYPE__){case Gk.FieldContentType:return"Text"===n.type?(0,a.TextLegacy)(t).encode(n):"Color"===n.type?(0,a.ColorLegacy)(t).encode(n):"Range"===n.type?(0,a.RangeLegacy)(t).encode(n):"Date"===n.type?(0,a.DateLegacy)(t).encode(n):"Number"===n.type?(0,a.NumberLegacy)(t).encode(n):"Timestamp"===n.type?(0,a.TimestampLegacy)(t).encode(n):"Select"===n.type?(0,a.SelectLegacy)(t).encode(n):void 0;case u.GeoPointContentType:return(0,u.GeoPointLegacy)(t).encode(n);case d.RichTextContentType:return(0,d.RichTextLegacy)(t).encode(n);case o.EmbedContentType:return(0,o.EmbedLegacy)(t).encode(n);case i.BooleanContentType:return(0,i.BooleanLegacy)(t).encode(n);case s.ImageContentType:return(0,s.ImageLegacy)(t).encode(n);case l.IntegrationFieldContentType:return(0,l.IntegrationFieldLegacy)(t).encode(n);case c.LinkContentType:return(0,c.LinkContentLegacy)(t).encode(n);case f.SeparatorContentType:return(0,f.SeparatorLegacy)(t).encode(n);default:return}}});return G8.NestableLegacy=m,G8}(),t),(0,n.__exportStar)(Zn(),t),(0,n.__exportStar)(Za(),t)}(Gm)),Gm}var Zs,Zl,Zc,Zd={};function Zf(){if(Zc)return Zd;Zc=1,Object.defineProperty(Zd,"__esModule",{value:!0}),Zd.repeatableContentWithDefaultNestableContentValues=Zd.withDefaultNestableContentValues=void 0;let t=Zu();return Zd.withDefaultNestableContentValues=function(n,r){return Object.entries(n).reduce((n,[i,o])=>{if(void 0===r[i]){let a=(0,t.NestableContentDefaultValue)(o);return void 0!==a?{...n,[i]:a}:n}return n},r)},Zd.repeatableContentWithDefaultNestableContentValues=function(n,r){let i=Object.entries(n);return r.map(n=>i.reduce((r,[i,o])=>{if(!n.value.find(([t])=>t===i)){let a=(0,t.NestableContentDefaultValue)(o);return{...r,value:[...r.value,...a?[[i,a]]:[]]}}return r},n))},Zd}function Zp(){return Zh||(Zh=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.traverseGroupItemsContent=t.traverseGroupContent=t.groupContentWithDefaultValues=t.GroupContent=t.isGroupContent=t.GroupContentType=t.GroupLegacy=t.GroupItemLegacy=t.GroupItemContent=t.GroupItemContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga(),o=Zu(),a=Zf();t.GroupItemContentType="GroupItemContent",t.GroupItemContent=r.strict({__TYPE__:r.literal(t.GroupItemContentType),value:r.array(r.tuple([r.string,o.NestableContent]))});let u=r.record(r.string,r.unknown),s=n=>new r.Type("GroupItemLegacy",n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.GroupItemContentType,r=>(0,UQ.pipe)(u.decode(r),UG.either.map(r=>({value:Object.entries(r).reduce((t,[r,i])=>{let a=(0,Gl.getFieldCtx)(r,n),u=(0,o.NestableLegacy)(a).decode(i);return!u||(0,UZ.isLeft)(u)?t:[...t,[r,u.right]]},[]),__TYPE__:t.GroupItemContentType}))),t=>t.value.reduce((t,[r,i])=>{let a=(0,Gl.getFieldCtx)(r,n),u=(0,o.NestableLegacy)(a).encode(i);return u?{content:{...t.content,[r]:u.content},types:{...t.types,...u.types}}:t},{content:{},types:{}}));t.GroupItemLegacy=s;let l=n=>{let i=r.array(r.union([r.null,(0,t.GroupItemLegacy)(n)])),o=r.array((0,t.GroupItemLegacy)(n));return new r.Type("GroupLegacy",t.isGroupContent,n=>(0,UQ.pipe)(i.decode(n),UG.either.map(n=>({value:n.map(n=>null===n?{__TYPE__:t.GroupItemContentType,value:[]}:n),__TYPE__:t.GroupContentType}))),t=>{let r=o.encode(t.value);return{content:r.map(t=>t.content),types:r.reduce((t,n)=>({...t,...n.types}),{[n.keyOfType]:"Group"})}})};t.GroupLegacy=l,t.GroupContentType="GroupContentType";let c=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.GroupContentType;function d({path:t,model:n,content:r}){return i=>r.map((r,a)=>{let u=t.concat([{key:a.toString(),type:"GroupItem"}]),s=r.value.reduce((t,[r,a])=>{let s=null==n?void 0:n[r],l=i({path:u.concat([{key:r,type:"Widget"}]),key:r,apiId:r,model:s,content:a});return l&&(0,o.isNestableContent)(l)?t.concat([[r,l]]):t},[]);return{__TYPE__:r.__TYPE__,value:s}})}t.isGroupContent=c,t.GroupContent=r.strict({__TYPE__:r.literal(t.GroupContentType),value:r.array(t.GroupItemContent)}),t.groupContentWithDefaultValues=function(t,n){var r;let i=null===(r=t.config)||void 0===r?void 0:r.fields;return i?{...n,value:(0,a.repeatableContentWithDefaultNestableContentValues)(i,n.value)}:n},t.traverseGroupContent=function({path:t,key:n,apiId:r,model:i,content:o}){return a=>{var u;let s=d({path:t,model:null===(u=null==i?void 0:i.config)||void 0===u?void 0:u.fields,content:o.value})(a);return a({path:t,key:n,apiId:r,model:i,content:{__TYPE__:o.__TYPE__,value:s}})}},t.traverseGroupItemsContent=d}(Gs)),Gs}var Zh,Zm,Zg={},Zy={},Zv={},Zb={};function Zx(){if(Zm)return Zb;Zm=1,Object.defineProperty(Zb,"__esModule",{value:!0}),Zb.RepeatableWidgets=Zb.RepeatableWidgetsLegacy=void 0;let t=(0,n1.__importStar)(V4),n=Zp(),r=Zu(),i=r=>t.array((0,n.GroupItemLegacy)(r));Zb.RepeatableWidgetsLegacy=i;let o=t.tuple([t.string,r.NestableContent]),a=t.strict({__TYPE__:t.literal(n.GroupItemContentType),value:t.array(o)});return Zb.RepeatableWidgets=t.array(a),Zb}function Z_(){return ZS||(ZS=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.migrateCompositeSlice=t.traverseCompositeSliceContent=t.compositeSliceContentWithDefaultValues=t.CompositeSliceContent=t.CompositeSliceLegacy=t.isCompositeSliceContent=t.CompositeSliceContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga(),o=Zp(),a=Zu(),u=Zf(),s=Zx();t.CompositeSliceContentType="CompositeSliceContent";let l=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.CompositeSliceContentType;t.isCompositeSliceContent=l;let c=r.exact(r.partial({repeat:r.array(r.unknown),"non-repeat":r.UnknownRecord})),d=n=>new r.Type("CompositeSliceLegacy",t.isCompositeSliceContent,r=>(0,UQ.pipe)(c.decode(r),UG.either.map(r=>{let i=(()=>{let t=(0,Gl.getFieldCtx)("repeat",n),i=(0,s.RepeatableWidgetsLegacy)(t).decode(r.repeat);if(!(!i||(0,UZ.isLeft)(i)))return i.right})()||[];return{nonRepeat:Object.entries(r["non-repeat"]||{}).reduce((t,[r,i])=>{let o=(0,Gl.getFieldCtx)(r,n,["non-repeat"]);if(!o)return t;let u=(0,a.NestableLegacy)(o).decode(i);return!u||(0,UZ.isLeft)(u)?t:{...t,[r]:u.right}},{}),repeat:i,__TYPE__:t.CompositeSliceContentType}})),t=>{let r=Object.entries(t.nonRepeat).reduce((t,[r,i])=>{let o=(0,Gl.getFieldCtx)(r,n,["non-repeat"]),u=(0,a.NestableLegacy)(o).encode(i);return u?{content:{...t.content,[r]:u.content},types:{...t.types,...u.types}}:t},{content:{},types:{}}),i=(()=>{let r=(0,Gl.getFieldCtx)("repeat",n);return(0,s.RepeatableWidgetsLegacy)(r).encode(t.repeat)})()||[];return{content:{"non-repeat":r.content,repeat:i.map(t=>t.content)},types:{[n.keyOfType]:"Slice",...r.types,...i.reduce((t,n)=>({...t,...n.types}),{})}}});t.CompositeSliceLegacy=d,t.CompositeSliceContent=r.strict({__TYPE__:r.literal(t.CompositeSliceContentType),nonRepeat:r.record(r.string,a.NestableContent),repeat:s.RepeatableWidgets}),t.compositeSliceContentWithDefaultValues=function(t,n){var r,i;let o=(0,u.withDefaultNestableContentValues)(null!==(r=t["non-repeat"])&&void 0!==r?r:{},n.nonRepeat),a=(0,u.repeatableContentWithDefaultNestableContentValues)(null!==(i=t.repeat)&&void 0!==i?i:{},n.repeat);return{...n,nonRepeat:o,repeat:a}},t.traverseCompositeSliceContent=function({path:t,sliceKey:n,sliceName:r,model:i,content:u}){return(s,l)=>{let c=Object.entries(u.widget.nonRepeat).reduce((o,[u,l])=>{var c,d,f;let p=(null==i?void 0:i.type)==="SharedSlice"?null===(d=null===(c=null==i?void 0:i.fields)||void 0===c?void 0:c.primary)||void 0===d?void 0:d[u]:null===(f=null==i?void 0:i["non-repeat"])||void 0===f?void 0:f[u],h=s({path:t.concat([{key:"non-repeat",type:"primary"},{key:u,type:"Widget"}]),key:u,apiId:r,model:p,content:l});return h?(0,a.isNestableContent)(h)?{...o,[u]:h}:(console.warn(`Warn: Non nestable content with key [${u}] detected in a composite slice [${r}] with key [${n}]`),o):o},{}),d=(0,o.traverseGroupItemsContent)({path:t.concat([{key:"repeat",type:"items"}]),model:(null==i?void 0:i.type)==="SharedSlice"?null==i?void 0:i.fields.items:null==i?void 0:i.repeat,content:u.widget.repeat})(s);return l({key:n,apiId:r,path:t,model:i,content:{...u,widget:{__TYPE__:"CompositeSliceContent",repeat:d,nonRepeat:c}}})}},t.migrateCompositeSlice=function(t,n){let[,r]=n.key.split("$");return{key:`${t.sliceName}$${r}`,name:t.sliceName,maybeLabel:n.maybeLabel,widget:{__TYPE__:"SharedSliceContent",variation:t.variationId,primary:Object.entries(n.widget.nonRepeat).reduce((r,[i,o])=>{var a;return!(null===(a=t.fields.primary)||void 0===a)&&a[i]?{...r,[i]:o}:(console.warn(`The widget ${i} in the non-repeat zone of the composite slice [${t.sliceName}] with key [${n.key}] doesn't exist in the model.`),r)},{}),items:n.widget.repeat.map(r=>({__TYPE__:"GroupItemContent",value:r.value.reduce((r,[i,o])=>{var a;return!(null===(a=t.fields.items)||void 0===a)&&a[i]?r.concat([[i,o]]):(console.warn(`The widget ${i} in the repeat zone of the composite slice [${t.sliceName}] with key [${n.key}] doesn't exist in the model.`),r)},[])}),[])}}}}(Zv)),Zv}var ZS,ZT,Zw={};function ZO(){return ZT||(ZT=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.traverseSharedSliceContent=t.sharedSliceContentWithDefaultValues=t.SharedSliceContent=t.SharedSliceLegacy=t.isSharedSliceContent=t.SharedSliceContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga(),o=Zp(),a=Zu(),u=Zf(),s=Zx();t.SharedSliceContentType="SharedSliceContent";let l=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.SharedSliceContentType;t.isSharedSliceContent=l;let c=r.exact(r.type({variation:r.string,items:(0,q$.withFallback)(r.array(r.unknown),[]),primary:(0,q$.withFallback)(r.UnknownRecord,{})})),d=n=>new r.Type("SharedSliceLegacy",t.isSharedSliceContent,r=>(0,UQ.pipe)(c.decode(r),UG.either.map(r=>{let i=(()=>{let t=(0,Gl.getFieldCtx)("items",n,["variations",r.variation]),i=(0,s.RepeatableWidgetsLegacy)(t).decode(r.items);if(!(!i||(0,UZ.isLeft)(i)))return i.right})()||[],o=Object.entries(r.primary).reduce((t,[i,o])=>{let u=(0,Gl.getFieldCtx)(i,n,["variations",r.variation,"primary"]),s=(0,a.NestableLegacy)(u).decode(o);return!s||(0,UZ.isLeft)(s)?t:{...t,[i]:s.right}},{});return{variation:r.variation,primary:o,items:i,__TYPE__:t.SharedSliceContentType}})),t=>{let r=Object.entries(t.primary).reduce((r,[i,o])=>{let u=(0,Gl.getFieldCtx)(i,n,["variations",t.variation,"primary"]),s=(0,a.NestableLegacy)(u).encode(o);return s?{content:{...r.content,[i]:s.content},types:{...r.types,...s.types}}:r},{content:{},types:{}}),i=(()=>{let r=(0,Gl.getFieldCtx)("items",n,["variations",t.variation]);return(0,s.RepeatableWidgetsLegacy)(r).encode(t.items)})()||[];return{content:{primary:r.content,items:i.map(t=>t.content),variation:t.variation},types:{[n.keyOfType]:"SharedSlice",...r.types,...i.reduce((t,n)=>({...t,...n.types}),{})}}});t.SharedSliceLegacy=d,t.SharedSliceContent=r.strict({__TYPE__:r.literal(t.SharedSliceContentType),variation:r.string,primary:r.record(r.string,a.NestableContent),items:s.RepeatableWidgets}),t.sharedSliceContentWithDefaultValues=function(t,n){var r,i;let o=t.variations.find(t=>t.id===n.variation),a=null!==(r=null==o?void 0:o.primary)&&void 0!==r?r:{},s=null!==(i=null==o?void 0:o.items)&&void 0!==i?i:{},l=(0,u.withDefaultNestableContentValues)(a,n.primary),c=(0,u.repeatableContentWithDefaultNestableContentValues)(s,n.items);return{...n,primary:l,items:c}},t.traverseSharedSliceContent=function({path:t,sliceKey:n,sliceName:r,model:i,content:u}){return(s,l)=>{let c=Object.entries(u.widget.primary).reduce((o,[u,l])=>{var c,d;let f=null===(d=null===(c=null==i?void 0:i.fields)||void 0===c?void 0:c.primary)||void 0===d?void 0:d[u],p=s({path:t.concat([{key:"primary",type:"primary"},{key:u,type:"Widget"}]),key:u,apiId:r,model:f,content:l});return p?(0,a.isNestableContent)(p)?{...o,[u]:p}:(console.warn(`Warn: Non nestable content with key [${u}] detected in a shared slice [${r}] with key [${n}]`),o):o},{}),d=(0,o.traverseGroupItemsContent)({path:t.concat([{key:"items",type:"items"}]),model:null==i?void 0:i.fields.items,content:u.widget.items})(s);return l({key:n,apiId:r,path:t,model:i,content:{...u,widget:{__TYPE__:"SharedSliceContent",variation:u.widget.variation,primary:c,items:d}}})}}}(Zw)),Zw}var Zk,ZC={};function ZI(){if(Zk)return ZC;Zk=1,Object.defineProperty(ZC,"__esModule",{value:!0}),ZC.migrateSimpleSlice=ZC.traverseSimpleSliceContent=ZC.SimpleSliceLegacy=ZC.isSimpleSliceContent=ZC.SimpleSliceContent=void 0;let t=(0,n1.__importStar)(V4),n=Zp(),r=Zu();ZC.SimpleSliceContent=t.union([r.NestableContent,n.GroupContent]);let i=t=>(0,r.isNestableContent)(t)||(0,n.isGroupContent)(t);ZC.isSimpleSliceContent=i;let o=t=>({decode:"Group"===t.fieldType?(0,n.GroupLegacy)(t).decode.bind(null):(0,r.NestableLegacy)(t).decode.bind(null),encode:i=>"GroupContentType"===i.__TYPE__?(0,n.GroupLegacy)(t).encode(i):(0,r.NestableLegacy)(t).encode(i)});return ZC.SimpleSliceLegacy=o,ZC.traverseSimpleSliceContent=function({path:t,sliceKey:r,sliceName:i,model:o,content:a}){return(u,s)=>{var l;if((0,n.isGroupContent)(a.widget)){let c=(0,n.traverseGroupContent)({path:t,key:a.key,apiId:a.name,model:(null==o?void 0:o.type)==="Group"?o:(null==o?void 0:o.type)==="SharedSlice"?{type:"Group",config:{fields:o.fields.items||{}}}:void 0,content:a.widget})(u);return c&&s({key:a.key,apiId:a.name,path:t,model:o,content:{...a,widget:c}})}let d=u({key:a.key,apiId:a.name,path:t,model:(null==o?void 0:o.type)==="SharedSlice"?null===(l=o.fields.primary)||void 0===l?void 0:l[a.name]:(null==o?void 0:o.type)!=="Group"?o:void 0,content:a.widget});return d&&s({key:r,apiId:i,path:t,model:o,content:{...a,widget:d}})}},ZC.migrateSimpleSlice=function(t,n){var r;let[,i]=n.key.split("$"),o=`${t.sliceName}$${i}`;return"GroupContentType"===n.widget.__TYPE__?{key:o,name:t.sliceName,maybeLabel:n.maybeLabel,widget:{__TYPE__:"SharedSliceContent",variation:t.variationId,primary:{},items:n.widget.value.map(n=>({__TYPE__:"GroupItemContent",value:n.value.reduce((n,[r,i])=>{var o;return!(null===(o=t.fields.items)||void 0===o)&&o[r]?n.concat([[r,i]]):n},[])}),[])}}:{key:o,name:t.sliceName,maybeLabel:n.maybeLabel,widget:{__TYPE__:"SharedSliceContent",variation:t.variationId,primary:!(null===(r=t.fields.primary)||void 0===r)&&r[n.name]?{[n.name]:n.widget}:{},items:[]}}},ZC}function ZM(){return ZR||(ZR=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SliceContent=t.SliceLegacy=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Z_(),o=ZO(),a=ZI(),u=t=>({decode:n=>(()=>{switch(t.fieldType){case"Slice":return(0,i.CompositeSliceLegacy)(t);case"SharedSlice":return(0,o.SharedSliceLegacy)(t);default:return(0,a.SimpleSliceLegacy)(t)}})().decode(n),encode(n){switch(n.__TYPE__){case"SharedSliceContent":return(0,o.SharedSliceLegacy)(t).encode(n);case"CompositeSliceContent":return(0,i.CompositeSliceLegacy)(t).encode(n);default:return(0,a.SimpleSliceLegacy)(t).encode(n)}}});t.SliceLegacy=u,t.SliceContent=r.union([i.CompositeSliceContent,o.SharedSliceContent,a.SimpleSliceContent]),(0,n.__exportStar)(Z_(),t),(0,n.__exportStar)(ZO(),t),(0,n.__exportStar)(ZI(),t)}(Zy)),Zy}var ZR,ZE,Zj={};function ZA(){if(ZE)return Zj;ZE=1,Object.defineProperty(Zj,"__esModule",{value:!0}),Zj.migrateSliceItem=Zj.SlicesItemLegacy=Zj.sliceItemContentWithDefaultValues=Zj.isSimpleSliceItemContent=Zj.isCompositeSliceItemContent=Zj.isSharedSliceItemContent=Zj.SliceItemContent=void 0;let t=n1,n=(0,t.__importStar)(V4),r=Zp(),i=Zu(),o=Zf(),a=ZM(),u=Z_(),s=ZO(),l=ZI();function c(t){return(0,u.isCompositeSliceContent)(t.widget)}function d(t){return(0,r.isGroupContent)(t.widget)||(0,i.isNestableContent)(t.widget)}Zj.SliceItemContent=n.type({key:n.string,name:n.string,maybeLabel:n.union([n.string,n.undefined]),widget:a.SliceContent}),Zj.isSharedSliceItemContent=function(t){return(0,s.isSharedSliceContent)(t.widget)},Zj.isCompositeSliceItemContent=c,Zj.isSimpleSliceItemContent=d,Zj.sliceItemContentWithDefaultValues=function(t,n){var i;if("SharedSlice"===t.type&&(0,s.isSharedSliceContent)(n))return(0,a.sharedSliceContentWithDefaultValues)(t,n);if("Slice"===t.type&&(0,u.isCompositeSliceContent)(n))return(0,a.compositeSliceContentWithDefaultValues)(t,n);if("Group"===t.type&&(0,r.isGroupContent)(n)&&!(null===(i=t.config)||void 0===i)&&i.fields){let l=(0,o.repeatableContentWithDefaultNestableContentValues)(t.config.fields,n.value);return{...n,value:l}}return n};let f=n.exact(n.intersection([n.type({key:n.string,value:n.unknown}),n.partial({label:(0,$n.nullable)(n.string)})])),p=t=>new n.Type("SlicesItemLegacy",t=>((0,s.isSharedSliceContent)(t.widget),(0,u.isCompositeSliceContent)(t.widget),(0,l.isSimpleSliceContent)(t.widget)),(r,i)=>(0,UQ.pipe)(f.decode(r),UG.either.chain(o=>{var u;let s=o.key.indexOf("$"),l=o.key.substring(0,s>0?s:void 0),c=(0,Gl.getFieldCtx)(l,t),d=(0,a.SliceLegacy)(c).decode(o.value);return!d||(0,UZ.isLeft)(d)?n.failure(r,i):n.success({key:o.key,name:l,maybeLabel:null!==(u=o.label)&&void 0!==u?u:void 0,widget:d.right})})),n=>{let r=(0,Gl.getFieldCtx)(n.name,t),i=(0,a.SliceLegacy)(r).encode(n.widget);return{content:{key:n.key,label:n.maybeLabel,value:(null==i?void 0:i.content)||{}},types:(null==i?void 0:i.types)||{}}});Zj.SlicesItemLegacy=p;let h=({model:t,content:n})=>c(n)&&(null==t?void 0:t.type)==="SharedSlice"?(0,u.migrateCompositeSlice)(t,n):d(n)&&(null==t?void 0:t.type)==="SharedSlice"?(0,l.migrateSimpleSlice)(t,n):n;return Zj.migrateSliceItem=h,Zj}var ZN,ZP={};function ZL(){return ZF||(ZF=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(ZM(),t),(0,n.__exportStar)(ZA(),t),(0,n.__exportStar)((ZN||(ZN=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.traverseSlices=t.slicesContentWithDefaultValues=t.SlicesContent=t.SlicesLegacy=t.isSlicesContent=t.SlicesContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga(),o=Z_(),a=ZO(),u=ZI(),s=ZA();t.SlicesContentType="SliceContentType";let l=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.SlicesContentType;t.isSlicesContent=l;let c=n=>{let i=r.array((0,s.SlicesItemLegacy)(n));return new r.Type("SlicesLegacy",t.isSlicesContent,n=>(0,UQ.pipe)(i.decode(n),UG.either.map(n=>({__TYPE__:t.SlicesContentType,value:n}))),t=>{let r=i.encode(t.value);return{content:r.map(t=>t.content),types:r.reduce((t,n)=>({...t,...n.types}),{[n.keyOfType]:"Slices"})}})};t.SlicesLegacy=c,t.SlicesContent=r.type({__TYPE__:r.literal(t.SlicesContentType),value:r.array(s.SliceItemContent)}),t.slicesContentWithDefaultValues=function(t,n){var r;let i=null===(r=null==t?void 0:t.config)||void 0===r?void 0:r.choices;if(void 0===i)return n;let o=n.value.map(t=>{let n=i[t.name];if(n){let r=(0,s.sliceItemContentWithDefaultValues)(n,t.widget);return{...t,widget:r}}return t});return{...n,value:o}},t.traverseSlices=function({path:t,key:n,model:r,content:i}){return({transformWidget:l=({content:t})=>t,transformSlice:c=({content:t})=>t})=>{let d=i.value.reduce((n,i)=>{let d=r&&function(t,n,r){var i,o;let a=null===(o=null===(i=null==n?void 0:n.config)||void 0===i?void 0:i.choices)||void 0===o?void 0:o[r.name];return(()=>{if((0,s.isSharedSliceItemContent)(r)&&a&&(0,qJ.isStaticSharedSlice)(a)){let t=a.variations.find(t=>t.id===r.widget.variation);return t?{type:"SharedSlice",sliceName:a.id,variationId:t.id,fields:{primary:t.primary||{},items:t.items||{}}}:void 0}})()||(()=>{var i;let o=V5.ContentPath.append(V5.ContentPath.serialize(t),r.name),a=Object.values((null===(i=null==n?void 0:n.config)||void 0===i?void 0:i.choices)||{}).find(t=>{var n;return!!(0,qJ.isStaticSharedSlice)(t)&&!!(!(null===(n=t.legacyPaths)||void 0===n)&&n[o])});if(!a)return;let u=null==a?void 0:a.variations.find(t=>{var n;return t.id===(null===(n=a.legacyPaths)||void 0===n?void 0:n[o])});if(u)return{type:"SharedSlice",sliceName:a.id,variationId:u.id,fields:{primary:u.primary||{},items:u.items||{}}}})()||(()=>{if(a){if((0,qJ.isCompositeSlice)(a))return{type:"Slice","non-repeat":a["non-repeat"]||{},repeat:a.repeat||{}};if((0,qJ.isLegacySlice)(a))return a}})()}(t,r,i),f=(0,s.isSharedSliceItemContent)(i)?(0,a.traverseSharedSliceContent)({path:t.concat({key:i.key,type:"SharedSlice"}),sliceKey:i.key,sliceName:i.name,model:(null==d?void 0:d.type)==="SharedSlice"?d:void 0,content:i})(l,c):(0,s.isCompositeSliceItemContent)(i)?(0,o.traverseCompositeSliceContent)({path:t.concat({key:i.key,type:"Slice"}),sliceKey:i.key,sliceName:i.name,model:(null==d?void 0:d.type)==="Slice"||(null==d?void 0:d.type)==="SharedSlice"?d:void 0,content:i})(l,c):(0,s.isSimpleSliceItemContent)(i)?(0,u.traverseSimpleSliceContent)({path:t.concat({key:i.key,type:"LegacySlice"}),sliceKey:i.key,sliceName:i.name,model:d&&(null==d?void 0:d.type)!=="Slice"?d:void 0,content:i})(l,c):void 0;return f?n.concat(f):n},[]);return l({path:t,key:n,apiId:n,model:r,content:{__TYPE__:i.__TYPE__,value:d}})}}}(ZP)),ZP),t)}(Zg)),Zg}var ZF,ZD,ZW={};function ZU(){return ZD||(ZD=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.UIDContent=t.UIDLegacy=t.isUIDContent=t.UIDContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga();t.UIDContentType="UIDContent";let o=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.UIDContentType;t.isUIDContent=o;let a=n=>new r.Type("UIDLegacy",t.isUIDContent,n=>(0,UQ.pipe)(r.string.decode(n),UG.either.map(n=>t.UIDContent.encode({value:n,__TYPE__:t.UIDContentType}))),t=>({content:t.value,types:{[n.keyOfType]:"UID"}}));t.UIDLegacy=a,t.UIDContent=r.type({__TYPE__:r.literal(t.UIDContentType),value:r.string})}(ZW)),ZW}var Zz,ZB={};function ZV(){return i||(i=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(Gu(),t),(0,n.__exportStar)(Zp(),t),(0,n.__exportStar)(Zu(),t),(0,n.__exportStar)(ZL(),t),(0,n.__exportStar)(ZU(),t),(0,n.__exportStar)(function(){if(Zz)return ZB;Zz=1,Object.defineProperty(ZB,"__esModule",{value:!0}),ZB.WidgetLegacy=ZB.isWidgetContent=ZB.WidgetContent=void 0;let t=(0,n1.__importStar)(V4),n=Zp(),r=Zu(),i=ZL(),o=ZU();ZB.WidgetContent=t.union([n.GroupContent,r.NestableContent,o.UIDContent,i.SlicesContent]);let a=t=>(0,n.isGroupContent)(t)||(0,r.isNestableContent)(t)||(0,o.isUIDContent)(t)||(0,i.isSlicesContent)(t);ZB.isWidgetContent=a;let u=t=>({decode(a){if(!t.fieldType)return;let u=(()=>{switch(t.fieldType){case"UID":return(0,o.UIDLegacy)(t);case"Group":return(0,n.GroupLegacy)(t);case"Choice":case"Slices":return(0,i.SlicesLegacy)(t);default:return(0,r.NestableLegacy)(t)}})();if(u)return u.decode(a)},encode(a){switch(a.__TYPE__){case o.UIDContentType:return(0,o.UIDLegacy)(t).encode(a);case n.GroupContentType:return(0,n.GroupLegacy)(t).encode(a);case i.SlicesContentType:return(0,i.SlicesLegacy)(t).encode(a);default:return(0,r.NestableLegacy)(t).encode(a)}}});return ZB.WidgetLegacy=u,ZB}(),t)}(Gr)),Gr}Object.defineProperty(n2,"__esModule",{value:!0}),n2.migrateDocument=n2.collectWidgets=n2.traverseDocument=n2.fillDocumentWithDefaultValues=n2.DocumentLegacy=n2.Document=void 0;let Z$=n1,Zq=(0,Z$.__importStar)(V4),ZK=ZV();n2.Document=Zq.record(V6.WidgetKey,ZK.WidgetContent);let ZH=Zq.record(V6.WidgetKey,Zq.unknown),ZG=t=>new Zq.Type("Document",t=>!!t&&"object"==typeof t,n=>(0,UQ.pipe)(ZH.decode(n),UG.either.map(n=>Object.entries(n).reduce((n,[r,i])=>{let o=(0,Gl.defaultCtx)(r,t),a=(0,ZK.WidgetLegacy)(o).decode(i);return!a||(0,UZ.isLeft)(a)?n:{...n,[r]:a.right}},{}))),n=>Object.entries(n).reduce((n,[r,i])=>{let o=(0,Gl.defaultCtx)(r,t),a=(0,ZK.WidgetLegacy)(o).encode(i);return a?{content:{...n.content,[r]:a.content},types:{...n.types,...a.types}}:n},{content:{},types:{}}));function ZZ(t){let n=Object.entries(t),{types:r,widgets:i}=n.reduce((t,[n,r])=>{if(n.endsWith("_TYPE")){let i=Gl.FieldOrSliceType.decode(r);if((0,UZ.isRight)(i))return{...t,types:t.types.set(n.substring(0,n.length-5),i.right)}}return n.endsWith("_POSITION")||n.endsWith("_TYPE")?t:{...t,widgets:{...t.widgets,[n]:r}}},{types:new Map,widgets:{}}),o=t.slugs_INTERNAL||[],a=t.uid;return{widgets:i,types:r,uid:a,slugs:o}}function ZY(t){return{customTypeId:null==t?void 0:t.id,fields:Object.fromEntries((0,qJ.flattenSections)(t))}}function ZJ({document:t,customType:n}){let r=n&&qJ.StaticCustomType.is(n)?ZY(n):n;return({transformWidget:n=({content:t})=>t,transformSlice:i=({content:t})=>t})=>{let o=r&&Object.entries(r.fields).reduce((t,[n,r])=>({...t,[n]:r}),{});return Object.entries(t).reduce((t,[a,u])=>{let s=o&&o[a],l=V5.ContentPath.make([{key:null==r?void 0:r.customTypeId,type:"CustomType"},{key:a,type:"Widget"}]),c=(()=>{switch(u.__TYPE__){case"SliceContentType":return(0,ZK.traverseSlices)({path:l,key:a,model:(null==s?void 0:s.type)==="Slices"||(null==s?void 0:s.type)==="Choice"?s:void 0,content:u})({transformWidget:n,transformSlice:i});case"GroupContentType":return(0,ZK.traverseGroupContent)({path:l,key:a,apiId:a,model:(null==s?void 0:s.type)==="Group"?s:void 0,content:u})(n);default:return n({path:l,key:a,apiId:a,model:(null==s?void 0:s.type)!=="Group"&&(null==s?void 0:s.type)!=="Slices"&&(null==s?void 0:s.type)!=="Choice"?s:void 0,content:u})}})();return{...t,...c?{[a]:c}:{}}},{})}}function ZQ(t,n){let r=qJ.StaticCustomType.is(n)?ZY(n):n;return Object.values((0,qJ.collectSharedSlices)(r)).some(t=>Boolean(t.legacyPaths))?ZJ({document:t,customType:n})({transformSlice:ZK.migrateSliceItem}):t}n2.DocumentLegacy={_codec:ZG,extractMetadata:ZZ,parse:function(t,n){let r=(0,UQ.pipe)(Zq.record(V6.WidgetKey,Zq.unknown).decode(t),UG.either.chain(t=>{let{types:n,widgets:r}=ZZ(t);return ZG(n).decode(r)}));return(0,UZ.isLeft)(r)?void 0:ZQ(r.right,n)},encode:function(t){let n=ZG().encode(t);return{...n.content,...n.types}}},n2.fillDocumentWithDefaultValues=function(t,n){let{fields:r}=t&&qJ.StaticCustomType.is(t)?ZY(t):t;return Object.entries(r).reduce((t,[r,i])=>{let o=n[r],a=(()=>{switch(i.type){case"Group":return(0,ZK.isGroupContent)(o)?(0,ZK.groupContentWithDefaultValues)(i,o):o;case"Choice":case"Slices":return(0,ZK.isSlicesContent)(o)?(0,ZK.slicesContentWithDefaultValues)(i,o):o;default:return void 0===o&&qJ.NestableWidget.is(i)?(0,ZK.NestableContentDefaultValue)(i):o}})();return a?{...t,[r]:a}:t},n)},n2.traverseDocument=ZJ,n2.collectWidgets=function(t,n){let r={};return ZJ({document:t})({transformWidget({content:t,path:i}){let o=V5.ContentPath.serialize(i);return n(t,i)&&(r[o]=t),t}}),r},n2.migrateDocument=ZQ,function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(n2,t),(0,n.__exportStar)(ZV(),t),(0,n.__exportStar)(Gl,t)}(n0);let ZX=(0,o.createContext)({update(){}});function Z0(t){var n;return(null==(n=t.config)?void 0:n.label)??("Boolean"===t.type||"Separator"===t.type?void 0:t.fieldset)??t.type}function Z1(t,n){var r,i,o;return"Boolean"===t.type?(n?null==(r=t.config)?void 0:r.placeholder_true:null==(i=t.config)?void 0:i.placeholder_false)||"...":(null==(o=t.config)?void 0:o.placeholder)||"..."}function Z2(t){var n;let{content:r,field:i,id:o,readOnly:a,onContentChange:s}=t,l=(null==r?void 0:r.value)??(null==(n=i.config)?void 0:n.default_value)??!1;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"toggleOff"}),M.jsx(u.Qy,{htmlFor:o,children:Z0(i)}),M.jsxs(u.JO,{children:[M.jsx(u.xu,{padding:4,alignItems:"center",children:M.jsx(u.xv,{children:Z1(i,l)})}),M.jsx(u.rs,{id:o,sx:{alignSelf:"center",marginLeft:"auto",marginRight:12},checked:l,onCheckedChange(t){var n;a||s((n=t,{__TYPE__:"BooleanContent",value:n}))}})]})]})}function Z3(t){let{id:n,field:r,content:i,onContentChange:o}=t;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"colorLens"}),M.jsx(u.Qy,{id:n,children:Z0(r)}),M.jsx(u.JO,{children:M.jsx(u.xu,{padding:{left:4},alignItems:"center",children:M.jsx(u.TC,{onValueChange(t){var n;return o((n=t,void 0===n?void 0:{__TYPE__:"FieldContent",type:"Color",value:n}))},value:null==i?void 0:i.value,"aria-labelledby":n,placeholder:Z1(r)})})})]})}function Z4(t){let{id:n,readOnly:r,field:i,content:o,onContentChange:a}=t,s=null!=o&&o.value?(0,l._O)(o.value):void 0;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"dateRange"}),M.jsx(u.Qy,{id:n,children:Z0(i)}),M.jsx(u.JO,{children:M.jsx(u.xu,{padding:{left:4,right:12},width:"100%",flexDirection:"column",justifyContent:"center",children:M.jsx(u.Wr,{mode:"date","aria-labelledby":n,disabled:r,value:s,onValueChange:t=>a(function(t){if(t)return{__TYPE__:"FieldContent",type:"Date",value:function(t){let n=`${t.getFullYear()}`.padStart(4,"0"),r=`${t.getMonth()+1}`.padStart(2,"0"),i=`${t.getDate()}`.padStart(2,"0");return`${n}-${r}-${i}`}(t)}}(t))})})})]})}let Z5=(0,o.forwardRef)(function(t,n){return M.jsx(u.oi,{...t,padding:Z6,ref:n})}),Z6={input:{inline:4},adornment:{inline:12}};function Z9(t){this.content=t}Z9.prototype={constructor:Z9,find:function(t){for(var n=0;n<this.content.length;n+=2)if(this.content[n]===t)return n;return -1},get:function(t){var n=this.find(t);return -1==n?void 0:this.content[n+1]},update:function(t,n,r){var i=r&&r!=t?this.remove(r):this,o=i.find(t),a=i.content.slice();return -1==o?a.push(r||t,n):(a[o+1]=n,r&&(a[o]=r)),new Z9(a)},remove:function(t){var n=this.find(t);if(-1==n)return this;var r=this.content.slice();return r.splice(n,2),new Z9(r)},addToStart:function(t,n){return new Z9([t,n].concat(this.remove(t).content))},addToEnd:function(t,n){var r=this.remove(t).content.slice();return r.push(t,n),new Z9(r)},addBefore:function(t,n,r){var i=this.remove(n),o=i.content.slice(),a=i.find(t);return o.splice(-1==a?o.length:a,0,n,r),new Z9(o)},forEach:function(t){for(var n=0;n<this.content.length;n+=2)t(this.content[n],this.content[n+1])},prepend:function(t){return(t=Z9.from(t)).size?new Z9(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=Z9.from(t)).size?new Z9(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var n=this;t=Z9.from(t);for(var r=0;r<t.content.length;r+=2)n=n.remove(t.content[r]);return n},toObject:function(){var t={};return this.forEach(function(n,r){t[n]=r}),t},get size(){return this.content.length>>1}},Z9.from=function(t){if(t instanceof Z9)return t;var n=[];if(t)for(var r in t)n.push(r,t[r]);return new Z9(n)};class Z8{constructor(t,n){if(this.content=t,this.size=n||0,null==n)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,i=0,o){for(let a=0,u=0;u<n;a++){let s=this.content[a],l=u+s.nodeSize;if(l>t&&!1!==r(s,i+u,o||null,a)&&s.content.size){let c=u+1;s.nodesBetween(Math.max(0,t-c),Math.min(s.content.size,n-c),r,i+c)}u=l}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,i){let o="",a=!0;return this.nodesBetween(t,n,(u,s)=>{u.isText?(o+=u.text.slice(Math.max(t,s)-s,n-s),a=!r):u.isLeaf?(i?o+="function"==typeof i?i(u):i:u.type.spec.leafText&&(o+=u.type.spec.leafText(u)),a=!r):!a&&u.isBlock&&(o+=r,a=!0)},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new Z8(i,this.size+t.size)}cut(t,n=this.size){if(0==t&&n==this.size)return this;let r=[],i=0;if(n>t)for(let o=0,a=0;a<n;o++){let u=this.content[o],s=a+u.nodeSize;s>t&&((a<t||s>n)&&(u=u.isText?u.cut(Math.max(0,t-a),Math.min(u.text.length,n-a)):u.cut(Math.max(0,t-a-1),Math.min(u.content.size,n-a-1))),r.push(u),i+=u.nodeSize),a=s}return new Z8(r,i)}cutByIndex(t,n){return t==n?Z8.empty:0==t&&n==this.content.length?this:new Z8(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new Z8(i,o)}addToStart(t){return new Z8([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Z8(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];t(i,r,n),r+=i.nodeSize}}findDiffStart(t,n=0){return function t(n,r,i){for(let o=0;;o++){if(o==n.childCount||o==r.childCount)return n.childCount==r.childCount?null:i;let a=n.child(o),u=r.child(o);if(a==u){i+=a.nodeSize;continue}if(!a.sameMarkup(u))return i;if(a.isText&&a.text!=u.text){for(let s=0;a.text[s]==u.text[s];s++)i++;return i}if(a.content.size||u.content.size){let l=t(a.content,u.content,i+1);if(null!=l)return l}i+=a.nodeSize}}(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return function t(n,r,i,o){for(let a=n.childCount,u=r.childCount;;){if(0==a||0==u)return a==u?null:{a:i,b:o};let s=n.child(--a),l=r.child(--u),c=s.nodeSize;if(s==l){i-=c,o-=c;continue}if(!s.sameMarkup(l))return{a:i,b:o};if(s.isText&&s.text!=l.text){let d=0,f=Math.min(s.text.length,l.text.length);for(;d<f&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,i--,o--;return{a:i,b:o}}if(s.content.size||l.content.size){let p=t(s.content,l.content,i-1,o-1);if(p)return p}i-=c,o-=c}}(this,t,n,r)}findIndex(t,n=-1){if(0==t)return Ye(0,t);if(t==this.size)return Ye(this.content.length,t);if(t>this.size||t<0)throw RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=i+this.child(r).nodeSize;if(o>=t)return o==t||n>0?Ye(r+1,o):Ye(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return Z8.empty;if(!Array.isArray(n))throw RangeError("Invalid input for Fragment.fromJSON");return new Z8(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Z8.empty;let n,r=0;for(let i=0;i<t.length;i++){let o=t[i];r+=o.nodeSize,i&&o.isText&&t[i-1].sameMarkup(o)?(n||(n=t.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new Z8(n||t,r)}static from(t){if(!t)return Z8.empty;if(t instanceof Z8)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Z8([t],t.nodeSize);throw RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Z8.empty=new Z8([],0);let Z7={index:0,offset:0};function Ye(t,n){return Z7.index=t,Z7.offset=n,Z7}function Yt(t,n){if(t===n)return!0;if(!(t&&"object"==typeof t)||!(n&&"object"==typeof n))return!1;let r=Array.isArray(t);if(Array.isArray(n)!=r)return!1;if(r){if(t.length!=n.length)return!1;for(let i=0;i<t.length;i++)if(!Yt(t[i],n[i]))return!1}else{for(let o in t)if(!(o in n)||!Yt(t[o],n[o]))return!1;for(let a in n)if(!(a in t))return!1}return!0}let Yn=class t{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let i=0;i<t.length;i++){let o=t[i];if(this.eq(o))return t;if(this.type.excludes(o.type))n||(n=t.slice(0,i));else{if(o.type.excludes(this.type))return t;!r&&o.type.rank>this.type.rank&&(n||(n=t.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Yt(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(n){if(!n||Array.isArray(n)&&0==n.length)return t.none;if(n instanceof t)return[n];let r=n.slice();return r.sort((t,n)=>t.type.rank-n.type.rank),r}};Yn.none=[];class Yr extends Error{}class Yi{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=function t(n,r,i,o){let{index:a,offset:u}=n.findIndex(r),s=n.maybeChild(a);if(u==r||s.isText)return o&&!o.canReplace(a,a,i)?null:n.cut(0,r).append(i).append(n.cut(r));let l=t(s.content,r-u-1,i);return l&&n.replaceChild(a,s.copy(l))}(this.content,t+this.openStart,n);return r&&new Yi(r,this.openStart,this.openEnd)}removeBetween(t,n){return new Yi(function t(n,r,i){let{index:o,offset:a}=n.findIndex(r),u=n.maybeChild(o),{index:s,offset:l}=n.findIndex(i);if(a==r||u.isText){if(l!=i&&!n.child(s).isText)throw RangeError("Removing non-flat range");return n.cut(0,r).append(n.cut(i))}if(o!=s)throw RangeError("Removing non-flat range");return n.replaceChild(o,u.copy(t(u.content,r-a-1,i-a-1)))}(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return Yi.empty;let r=n.openStart||0,i=n.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw RangeError("Invalid input for Slice.fromJSON");return new Yi(Z8.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let a=t.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new Yi(t,r,i)}}function Yo(t,n){if(!n.type.compatibleContent(t.type))throw new Yr("Cannot join "+n.type.name+" onto "+t.type.name)}function Ya(t,n,r){let i=t.node(r);return Yo(i,n.node(r)),i}function Yu(t,n){let r=n.length-1;r>=0&&t.isText&&t.sameMarkup(n[r])?n[r]=t.withText(n[r].text+t.text):n.push(t)}function Ys(t,n,r,i){let o=(n||t).node(r),a=0,u=n?n.index(r):o.childCount;t&&(a=t.index(r),t.depth>r?a++:t.textOffset&&(Yu(t.nodeAfter,i),a++));for(let s=a;s<u;s++)Yu(o.child(s),i);n&&n.depth==r&&n.textOffset&&Yu(n.nodeBefore,i)}function Yl(t,n){return t.type.checkContent(n),t.copy(n)}function Yc(t,n,r){let i=[];return Ys(null,t,r,i),t.depth>r&&Yu(Yl(Ya(t,n,r+1),Yc(t,n,r+1)),i),Ys(n,null,r,i),new Z8(i)}Yi.empty=new Yi(Z8.empty,0,0);class Yd{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(n);return r?t.child(n).cut(r):i}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):0==t?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[3*n],i=0==n?0:this.path[3*n-1]+1;for(let o=0;o<t;o++)i+=r.child(o).nodeSize;return i}marks(){let t=this.parent,n=this.index();if(0==t.content.size)return Yn.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),i=t.maybeChild(n);if(!r){let o=r;r=i,i=o}let a=r.marks;for(var u=0;u<a.length;u++)!1!==a[u].type.spec.inclusive||i&&a[u].isInSet(i.marks)||(a=a[u--].removeFromSet(a));return a}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=t.parent.maybeChild(t.index());for(var o=0;o<r.length;o++)!1!==r[o].type.spec.inclusive||i&&r[o].isInSet(i.marks)||(r=r[o--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new Ym(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let a=t;;){let{index:u,offset:s}=a.content.findIndex(o),l=o-s;if(r.push(a,u,i+s),!l||(a=a.child(u)).isText)break;o=l-1,i+=s+1}return new Yd(n,r,o)}static resolveCached(t,n){for(let r=0;r<Yf.length;r++){let i=Yf[r];if(i.pos==n&&i.doc==t)return i}let o=Yf[Yp]=Yd.resolve(t,n);return Yp=(Yp+1)%Yh,o}}let Yf=[],Yp=0,Yh=12;class Ym{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}let Yg=Object.create(null),Yy=class t{constructor(t,n,r,i=Yn.none){this.type=t,this.attrs=n,this.marks=i,this.content=r||Z8.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,i=0){this.content.nodesBetween(t,n,r,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,i){return this.content.textBetween(t,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&Yt(this.attrs,n||t.defaultAttrs||Yg)&&Yn.sameSet(this.marks,r||Yn.none)}copy(n=null){return n==this.content?this:new t(this.type,this.attrs,n,this.marks)}mark(n){return n==this.marks?this:new t(this.type,this.attrs,this.content,n)}cut(t,n=this.content.size){return 0==t&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return Yi.empty;let i=this.resolve(t),o=this.resolve(n),a=r?0:i.sharedDepth(n),u=i.start(a),s=i.node(a).content.cut(i.pos-u,o.pos-u);return new Yi(s,i.depth-a,o.depth-a)}replace(t,n,r){return function(t,n,r){if(r.openStart>t.depth)throw new Yr("Inserted content deeper than insertion position");if(t.depth-r.openStart!=n.depth-r.openEnd)throw new Yr("Inconsistent open depths");return function t(n,r,i,o){let a=n.index(o),u=n.node(o);if(a==r.index(o)&&o<n.depth-i.openStart){let s=t(n,r,i,o+1);return u.copy(u.content.replaceChild(a,s))}if(!i.content.size)return Yl(u,Yc(n,r,o));if(i.openStart||i.openEnd||n.depth!=o||r.depth!=o){let{start:l,end:c}=function(t,n){let r=n.depth-t.openStart,i=n.node(r).copy(t.content);for(let o=r-1;o>=0;o--)i=n.node(o).copy(Z8.from(i));return{start:i.resolveNoCache(t.openStart+r),end:i.resolveNoCache(i.content.size-t.openEnd-r)}}(i,n);return Yl(u,function t(n,r,i,o,a){let u=n.depth>a&&Ya(n,r,a+1),s=o.depth>a&&Ya(i,o,a+1),l=[];return Ys(null,n,a,l),u&&s&&r.index(a)==i.index(a)?(Yo(u,s),Yu(Yl(u,t(n,r,i,o,a+1)),l)):(u&&Yu(Yl(u,Yc(n,r,a+1)),l),Ys(r,i,a,l),s&&Yu(Yl(s,Yc(i,o,a+1)),l)),Ys(o,null,a,l),new Z8(l)}(n,l,c,r,o))}{let d=n.parent,f=d.content;return Yl(d,f.cut(0,n.parentOffset).append(i.content).append(f.cut(r.parentOffset)))}}(t,n,r,0)}(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(t);if(!(n=n.maybeChild(r)))return null;if(i==t||n.isText)return n;t-=i+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(t){return Yd.resolveCached(this,t)}resolveNoCache(t){return Yd.resolve(this,t)}rangeHasMark(t,n,r){let i=!1;return n>t&&this.nodesBetween(t,n,t=>(r.isInSet(t.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),Yb(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=Z8.empty,i=0,o=r.childCount){let a=this.contentMatchAt(t).matchFragment(r,i,o),u=a&&a.matchFragment(this.content,n);if(!u||!u.validEnd)return!1;for(let s=i;s<o;s++)if(!this.type.allowsMarks(r.child(s).marks))return!1;return!0}canReplaceWith(t,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(t).matchType(r),a=o&&o.matchFragment(this.content,n);return!!a&&a.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content);let t=Yn.none;for(let n=0;n<this.marks.length;n++)t=this.marks[n].addToSet(t);if(!Yn.sameSet(t,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(t=>t.toJSON())),t}static fromJSON(t,n){if(!n)throw RangeError("Invalid input for Node.fromJSON");let r=null;if(n.marks){if(!Array.isArray(n.marks))throw RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if("text"==n.type){if("string"!=typeof n.text)throw RangeError("Invalid text node in JSON");return t.text(n.text,r)}let i=Z8.fromJSON(t,n.content);return t.nodeType(n.type).create(n.attrs,i,r)}};Yy.prototype.text=void 0;class Yv extends Yy{constructor(t,n,r,i){if(super(t,n,null,i),!r)throw RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Yb(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Yv(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Yv(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return 0==t&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function Yb(t,n){for(let r=t.length-1;r>=0;r--)n=t[r].type.name+"("+n+")";return n}class Yx{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){var r;let i=new Y_(t,n);if(null==i.next)return Yx.empty;let o=YS(i);i.next&&i.err("Unexpected trailing text");let a,u=(r=function(t){let n=[[]];return o(a(t,0),r()),n;function r(){return n.push([])-1}function i(t,r,i){let o={term:i,to:r};return n[t].push(o),o}function o(t,n){t.forEach(t=>t.to=n)}function a(t,n){if("choice"==t.type)return t.exprs.reduce((t,r)=>t.concat(a(r,n)),[]);if("seq"==t.type)for(let u=0;;u++){let s=a(t.exprs[u],n);if(u==t.exprs.length-1)return s;o(s,n=r())}else if("star"==t.type){let l=r();return i(n,l),o(a(t.expr,l),l),[i(l)]}else if("plus"==t.type){let c=r();return o(a(t.expr,n),c),o(a(t.expr,c),c),[i(c)]}else{if("opt"==t.type)return[i(n)].concat(a(t.expr,n));if("range"==t.type){let d=n;for(let f=0;f<t.min;f++){let p=r();o(a(t.expr,d),p),d=p}if(-1==t.max)o(a(t.expr,d),d);else for(let h=t.min;h<t.max;h++){let m=r();i(d,m),o(a(t.expr,d),m),d=m}return[i(d)]}if("name"==t.type)return[i(n,void 0,t.value)];throw Error("Unknown expr type")}}}(o),a=Object.create(null),function t(n){let i=[];n.forEach(t=>{r[t].forEach(({term:t,to:n})=>{if(!t)return;let o;for(let a=0;a<i.length;a++)i[a][0]==t&&(o=i[a][1]);YM(r,n).forEach(n=>{o||i.push([t,o=[]]),-1==o.indexOf(n)&&o.push(n)})})});let o=a[n.join(",")]=new Yx(n.indexOf(r.length-1)>-1);for(let u=0;u<i.length;u++){let s=i[u][1].sort(YI);o.next.push({type:i[u][0],next:a[s.join(",")]||t(s)})}return o}(YM(r,0)));return function(t,n){for(let r=0,i=[t];r<i.length;r++){let o=i[r],a=!o.validEnd,u=[];for(let s=0;s<o.next.length;s++){let{type:l,next:c}=o.next[s];u.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),-1==i.indexOf(c)&&i.push(c)}a&&n.err("Only non-generatable nodes ("+u.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(u,i),u}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(t.child(o).type);return i}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let i=[this];return function o(a,u){let s=a.matchFragment(t,r);if(s&&(!n||s.validEnd))return Z8.from(u.map(t=>t.createAndFill()));for(let l=0;l<a.next.length;l++){let{type:c,next:d}=a.next[l];if(!(c.isText||c.hasRequiredAttrs())&&-1==i.indexOf(d)){i.push(d);let f=o(d,u.concat(c));if(f)return f}}return null}(this,[])}findWrapping(t){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==t)return this.wrapCache[n+1];let r=this.computeWrapping(t);return this.wrapCache.push(t,r),r}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(t)){let a=[];for(let u=i;u.type;u=u.via)a.push(u.type);return a.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:c}=o.next[s];l.isLeaf||l.hasRequiredAttrs()||l.name in n||i.type&&!c.validEnd||(r.push({match:l.contentMatch,type:l,via:i}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function n(r){t.push(r);for(let i=0;i<r.next.length;i++)-1==t.indexOf(r.next[i].next)&&n(r.next[i].next)}(this),t.map((n,r)=>{let i=r+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)i+=(o?", ":"")+n.next[o].type.name+"->"+t.indexOf(n.next[o].next);return i}).join(`
|
|
5
|
+
`}}function a(n){return r.exact(r.intersection([r.type({id:r.string,label:i.StringOrNull,repeatable:(0,qX.withFallback)(r.boolean,!0),json:r.record(r.string,n),status:(0,qX.withFallback)(r.boolean,!0)}),r.partial({hash:r.string,format:(0,qX.withFallback)(r.keyof(t.CustomTypeFormat),"custom")})]))}function u(t){return Object.entries(t.json).reduce((t,[,n])=>{let r=Object.entries(n);return t.concat(r)},[])}function s(t,n){let r=Object.entries(t.json).reduce((t,[r,i])=>{let o=Object.entries(i).reduce((t,[r,i])=>{let o=n(r,i);return o?{...t,[r]:o}:t},{});return{...t,[r]:o}},{});return{...t,json:r}}t.StaticCustomType=a(KB.StaticSection),t.CustomType=a(KB.DynamicSection),t.flattenWidgets=u,t.flattenSections=function(t){return Object.entries(t.json).reduce((t,[,n])=>{let r=Object.entries(n);return t.concat(r)},[])},t.toStatic=function(t,n){let r=Object.entries(t.json).reduce((t,[r,i])=>({...t,[r]:KB.Sections.toStatic(i,n)}),{});return{...t,json:r}},t.validateSlices=function(t,n){let r=(function(t){var n;let r=u(t).filter(([,t])=>"Slices"===t.type).reduce((t,[,n])=>{let r=Object.entries(n.config&&n.config.choices?n.config.choices:{}).filter(([,t])=>"SharedSlice"===t.type).map(([t])=>t);return t.concat(r)},[]);return function(t){return r.map(t)}})(t)(t=>{if(!n.get(t))return t}).filter(Boolean);return r.length>0?(0,UZ.left)(new o(r)):(0,UZ.right)(t)},t.collectWidgets=s,t.filterMissingSharedSlices=function(t,n){return s(t,(t,r)=>{if("Slices"===r.type){if(!r.config||!r.config.choices)return r;let i=Object.entries(r.config.choices).reduce((t,[r,i])=>"SharedSlice"!==i.type||n.get(r)?{...t,[r]:i}:t,{}),o={...r.config,choices:i};return{...r,config:o}}return r})},t.flattenCustomTypeFields=function(t){return Object.values(t.json).reduce((t,n)=>({...t,...n}),{})},t.collectSharedSlices=function(t){return Object.entries(t.fields).reduce((t,[,n])=>{var r;return"Slices"===n.type||"Choice"===n.type?{...t,...Object.entries((null===(r=n.config)||void 0===r?void 0:r.choices)||{}).reduce((t,[n,r])=>"SharedSlice"===r.type?{...t,[n]:r}:t,{})}:t},{})}}(qQ);var HA,HN,HP={},HL={};Object.defineProperty(HA=HL,"__esModule",{value:!0}),HA.DiffOperation=void 0,(HN=HA.DiffOperation||(HA.DiffOperation={})).Added="added",HN.Removed="removed",HN.Updated="updated";var HF={},HD={},HW={};Object.defineProperty(HW,"__esModule",{value:!0}),HW.HexaColor=void 0;let HU=/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;HW.HexaColor={is:t=>HU.test(t)};var Hz={};Object.defineProperty(Hz,"__esModule",{value:!0}),Hz.toRecord=void 0,Hz.toRecord=function(t,n){return t.reduce((t,r)=>{let i=n(r);return{...t,[i]:r}},{})};var HB={};Object.defineProperty(HB,"__esModule",{value:!0}),HB.mapValues=HB.isObject=HB.withOptionals=HB.isNotEmpty=HB.zipObjects=void 0;let HV=n1,H$=(0,HV.__importStar)(V4);HB.zipObjects=function(t,n){return[...new Set(Object.keys(t||{}).concat(Object.keys(n||{})))].reduce((r,i)=>{let o=null==t?void 0:t[i],a=null==n?void 0:n[i];return{...r,[i]:{left:o,right:a}}},{})},HB.isNotEmpty=function(t){return Boolean(Object.keys(t).length)},HB.withOptionals=function(t,n){return{...t,...n.reduce((t,[n,r])=>r?{...t,[n]:r}:t,{})}};let Hq=H$.record(H$.string,H$.unknown);HB.isObject=function(t){return(0,UZ.isRight)(Hq.decode(t))},HB.mapValues=function(t,n){return Object.entries(t).reduce((t,[r,i])=>({...t,[r]:n(i,r)}),{})},Object.defineProperty(HD,"__esModule",{value:!0}),HD.Objects=HD.Arrays=HD.HexaColorCode=void 0;let HK=n1;HD.HexaColorCode=(0,HK.__importStar)(HW),HD.Arrays=(0,HK.__importStar)(Hz),HD.Objects=(0,HK.__importStar)(HB);var HH={};function HG(t,n){let r=HD.Objects.zipObjects(t,n),i=Object.entries(r).reduce((t,[n,r])=>{if(JSON.stringify(null==r?void 0:r.left)===JSON.stringify(null==r?void 0:r.right))return t;let i=(()=>{if(!(!(null!=r&&r.left)&&!(null!=r&&r.right)))return null!=r&&r.left&&!r.right?{op:HL.DiffOperation.Removed}:!(null!=r&&r.left)&&null!=r&&r.right?{op:HL.DiffOperation.Added,value:r.right}:{op:HL.DiffOperation.Updated,value:r.right}})();return i?{...t,[n]:i}:t},{});return HD.Objects.isNotEmpty(i)?i:void 0}Object.defineProperty(HH,"__esModule",{value:!0}),HH.VariationComparator=void 0,HH.VariationComparator={compare(t,n){if(t&&!n)return{op:HL.DiffOperation.Removed};if(!t&&n)return{op:HL.DiffOperation.Added,value:n};let r=function(t,n){let r=HD.Objects.zipObjects(t,n);return Object.entries(r).reduce((t,[n,r])=>"primary"===n||"items"===n||(null==r?void 0:r.left)===(null==r?void 0:r.right)?t:{...t,[n]:null==r?void 0:r.right},{})}(t,n),i=HG(null==t?void 0:t.primary,null==n?void 0:n.primary),o=HG(null==t?void 0:t.items,null==n?void 0:n.items),a={...r,...i?{primary:i}:{},...o?{items:o}:{}};if(HD.Objects.isNotEmpty(a))return{op:HL.DiffOperation.Updated,value:a}}},Object.defineProperty(HF,"__esModule",{value:!0}),HF.SliceComparator=void 0,HF.SliceComparator={compare(t,n){if(!t&&n)return{op:HL.DiffOperation.Added,value:n};if(t&&!n)return{op:HL.DiffOperation.Removed};let r=function(t,n){let r=HD.Objects.zipObjects(t,n);return Object.entries(r).reduce((t,[n,r])=>"variations"===n||(null==r?void 0:r.left)===(null==r?void 0:r.right)?t:{...t,[n]:null==r?void 0:r.right},{})}(t,n),i=HD.Objects.zipObjects(t&&HD.Arrays.toRecord(t.variations,t=>t.id),n&&HD.Arrays.toRecord(n.variations,t=>t.id)),o=Object.entries(i).reduce((t,[n,r])=>{if(!r)return t;let i=HH.VariationComparator.compare(r.left,r.right);return i?{...t,[n]:i}:t},{}),a={...r,...HD.Objects.isNotEmpty(o)?{variations:o}:{}};if(HD.Objects.isNotEmpty(a))return{op:HL.DiffOperation.Updated,value:a}}},function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(HL,t),(0,n.__exportStar)(HF,t),(0,n.__exportStar)(HH,t)}(HP);var HZ,HY,HJ={},HQ={};HZ=HQ,HY=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},Object.defineProperty(HZ,"__esModule",{value:!0}),HZ.ImageConstraint=void 0,Object.defineProperty(HZ,"ImageConstraint",{enumerable:!0,get:function(){return HY(KQ).default}});var HX={},H0={};Object.defineProperty(H0,"__esModule",{value:!0});var H1={};Object.defineProperty(H1,"__esModule",{value:!0}),H1.SlicesTypes=void 0;let H2=n1,H3=(0,H2.__importStar)(V4);H1.SlicesTypes=H3.keyof({[Hv.CompositeSliceType]:null,[HS.SharedSliceType]:null}),function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(Hv,t),(0,n.__exportStar)(Hb,t),(0,n.__exportStar)(HS,t),(0,n.__exportStar)(HT,t),(0,n.__exportStar)(H0,t),(0,n.__exportStar)(Hy,t),(0,n.__exportStar)(H1,t)}(HX),function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(K$,t),(0,n.__exportStar)(Hg,t),(0,n.__exportStar)(HQ,t),(0,n.__exportStar)(HX,t),(0,n.__exportStar)(Hk,t),(0,n.__exportStar)(KV,t)}(HJ),function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(qQ,t),(0,n.__exportStar)(HP,t),(0,n.__exportStar)(KB,t),(0,n.__exportStar)(HJ,t)}(qJ);var H4,H5,H6,H9,H8,H7,Ge,Gt,Gn,Gr={},Gi={},Go={};function Ga(){if(Gn)return Go;Gn=1,Object.defineProperty(Go,"__esModule",{value:!0}),Go.hasContentType=Go.hasFieldContentType=void 0;let t=ZV();function n(t){return"object"==typeof t&&null!==t&&"__TYPE__"in t}return Go.hasFieldContentType=function(r){return n(r)&&r.__TYPE__===t.FieldContentType&&(null==r?void 0:r.type)!==void 0&&"string"==typeof r.type&&(0,UZ.isRight)(t.FieldType.decode(r.type))},Go.hasContentType=n,Go}function Gu(){return Gp||(Gp=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.EmptyContent=t.EmptyLegacy=t.isEmptyContent=t.EmptyContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga();t.EmptyContentType="EmptyContent";let o=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.EmptyContentType;t.isEmptyContent=o;let a=r.union([r.null,r.type({value:r.null})]),u=n=>new r.Type("EmptyLegacy",t.isEmptyContent,r=>(0,UQ.pipe)(a.decode(r),UG.either.map(()=>({type:n,__TYPE__:t.EmptyContentType}))),()=>null);t.EmptyLegacy=u,t.EmptyContent=r.strict({type:r.string,__TYPE__:r.literal(t.EmptyContentType)})}(Gi)),Gi}var Gs={},Gl={};Object.defineProperty(Gl,"__esModule",{value:!0}),Gl.defaultCtx=Gl.getFieldCtx=Gl.LegacyContentCtx=Gl.FieldOrSliceType=void 0;let Gc=n1,Gd=(0,Gc.__importStar)(V4);Gl.FieldOrSliceType=Gd.union([HJ.FieldType,HJ.SlicesTypes]);class Gf{constructor(t,n,r){Object.defineProperty(this,"fieldKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"prefixedKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"keyOfType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fieldPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fieldType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allTypes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.fieldKey=t,this.fieldPath=n||[],this.allTypes=r||new Map;let i=Array.of(this.fieldPath,[this.fieldKey]).flat().join(".");this.prefixedKey=i,this.keyOfType=`${i}_TYPE`,this.fieldType=this.allTypes.get(this.prefixedKey)}}Gl.LegacyContentCtx=Gf,Gl.getFieldCtx=function(t,n,r){return new Gf(t,[...n.fieldPath,n.fieldKey,...r||[]],n.allTypes)},Gl.defaultCtx=function(t,n=new Map){return new Gf(t,[],n)};var Gp,Gh,Gm={},Gg={};function Gy(){return Gh||(Gh=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.BooleanContentDefaultValue=t.BooleanContent=t.BooleanLegacy=t.isBooleanContent=t.BooleanContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga();t.BooleanContentType="BooleanContent";let o=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.BooleanContentType;t.isBooleanContent=o;let a=n=>new r.Type("BooleanLegacy",t.isBooleanContent,n=>(0,UQ.pipe)(r.boolean.decode(n),UG.either.map(n=>t.BooleanContent.encode({value:n,__TYPE__:t.BooleanContentType}))),t=>({content:t.value,types:{[n.keyOfType]:"Boolean"}}));t.BooleanLegacy=a,t.BooleanContent=r.strict({__TYPE__:r.literal(t.BooleanContentType),value:r.boolean});let u=n=>{var r;return(null===(r=n.config)||void 0===r?void 0:r.default_value)!==void 0?{__TYPE__:t.BooleanContentType,value:n.config.default_value||!1}:void 0};t.BooleanContentDefaultValue=u}(Gg)),Gg}var Gv,Gb={};function Gx(){return Gv||(Gv=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.EmbedContent=t.EmbedLegacy=t.EmbedContentLegacy=t.isEmbedContent=t.EmbedContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Kz(),o=Ga();t.EmbedContentType="EmbedContent";let a=n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.EmbedContentType;t.isEmbedContent=a,t.EmbedContentLegacy=r.exact(r.intersection([r.type({embed_url:r.string,type:r.string}),r.partial({version:r.union([r.string,r.number,r.null]),title:i.StringOrNull,author_name:i.StringOrNull,author_url:i.StringOrNull,provider_name:i.StringOrNull,provider_url:i.StringOrNull,cache_age:r.union([r.string,r.number,r.null]),thumbnail_url:i.StringOrNull,thumbnail_width:i.NumberOrNull,thumbnail_height:i.NumberOrNull,html:i.StringOrNull})]));let u=n=>new r.Type("EmbedLegacy",t.isEmbedContent,n=>(0,UQ.pipe)(t.EmbedContentLegacy.decode(n),UG.either.map(r=>({...r,all:n,__TYPE__:t.EmbedContentType}))),t=>({content:t.all,types:{[n.keyOfType]:"Embed"}}));t.EmbedLegacy=u,t.EmbedContent=r.intersection([t.EmbedContentLegacy,r.strict({__TYPE__:r.literal(t.EmbedContentType),all:r.unknown})])}(Gb)),Gb}var G_={},GS={},GT={};Object.defineProperty(GT,"__esModule",{value:!0});let Gw=n1,GO=(0,Gw.__importStar)(V4);GT.default=new GO.Type("TrimmedString",GO.string.is,(t,n)=>(0,$r.pipe)(GO.string.validate(t,n),(0,Ko.chain)(t=>GO.success(function(t){let n=0;for(;n<t.length&&t[n]<=" ";)n++;let r=t.length;for(;n<r&&t[r-1]<=" ";)r--;return t.substring(n,r)}(t)))),t=>t);var Gk={};function GC(){return GI||(GI=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContent=t.ColorLegacy=t.isColorContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Color"===t.type;t.isColorContent=a;let u=n=>new r.Type("ColorLegacy",t.isColorContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.ColorContent.encode({value:n,type:HJ.ColorFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.ColorFieldType}}));t.ColorLegacy=u,t.ColorContent=r.strict({type:r.literal(HJ.ColorFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)})}(GS)),GS}Object.defineProperty(Gk,"__esModule",{value:!0}),Gk.FieldContentType=void 0,Gk.FieldContentType="FieldContent";var GI,GM,GR={};function GE(){return GM||(GM=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.DateContent=t.DateLegacy=t.isDateContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Date"===t.type;t.isDateContent=a;let u=n=>new r.Type("DateLegacy",t.isDateContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.DateContent.encode({value:n,type:HJ.DateFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.DateFieldType}}));t.DateLegacy=u,t.DateContent=r.strict({type:r.literal(HJ.DateFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)})}(GR)),GR}var Gj,GA={};function GN(){return Gj||(Gj=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.NumberContent=t.NumberLegacy=t.isNumberContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Number"===t.type;t.isNumberContent=a;let u=n=>new r.Type("NumberLegacy",t.isNumberContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.NumberContent.encode({value:n,type:HJ.NumberFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.NumberFieldType}}));t.NumberLegacy=u,t.NumberContent=r.strict({type:r.literal(HJ.NumberFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)})}(GA)),GA}var GP,GL={};function GF(){return GP||(GP=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.RangeContent=t.RangeLegacy=t.isRangeContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Range"===t.type;t.isRangeContent=a;let u=n=>new r.Type("RangeLegacy",t.isRangeContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.RangeContent.encode({value:n,type:HJ.RangeFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.RangeFieldType}}));t.RangeLegacy=u,t.RangeContent=r.strict({type:r.literal(HJ.RangeFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)})}(GL)),GL}var GD,GW={};function GU(){return GD||(GD=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SelectContentDefaultValue=t.SelectContent=t.SelectLegacy=t.isSelectContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Select"===t.type;t.isSelectContent=a;let u=n=>new r.Type("SelectLegacy",t.isSelectContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.SelectContent.encode({value:n,type:HJ.SelectFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.SelectFieldType}}));t.SelectLegacy=u,t.SelectContent=r.strict({type:r.literal(HJ.SelectFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)});let s=t=>{var n;return!(null===(n=t.config)||void 0===n)&&n.default_value?{__TYPE__:Gk.FieldContentType,type:HJ.SelectFieldType,value:t.config.default_value||""}:void 0};t.SelectContentDefaultValue=s}(GW)),GW}var Gz,GB={};function GV(){return Gz||(Gz=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.TextContent=t.TextLegacy=t.isTextContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Text"===t.type;t.isTextContent=a;let u=n=>new r.Type("TextLegacy",t.isTextContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.TextContent.encode({value:n,type:HJ.TextFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.TextFieldType}}));t.TextLegacy=u,t.TextContent=r.strict({type:r.literal(HJ.TextFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)})}(GB)),GB}var G$,Gq={};function GK(){return G$||(G$=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.TimestampContent=t.TimestampLegacy=t.isTimestampContent=void 0;let n=n1,r=(0,n.__importStar)(V4),i=(0,n.__importDefault)(GT),o=Ga(),a=t=>(0,o.hasContentType)(t)&&t.__TYPE__===Gk.FieldContentType&&(0,o.hasFieldContentType)(t)&&"Timestamp"===t.type;t.isTimestampContent=a;let u=n=>new r.Type("TimestampLegacy",t.isTimestampContent,n=>(0,UQ.pipe)(i.default.decode(n),UG.either.map(n=>t.TimestampContent.encode({value:n,type:HJ.TimestampFieldType,__TYPE__:Gk.FieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:HJ.TimestampFieldType}}));t.TimestampLegacy=u,t.TimestampContent=r.strict({type:r.literal(HJ.TimestampFieldType),value:i.default,__TYPE__:r.literal(Gk.FieldContentType)})}(Gq)),Gq}function GH(){return GG||(GG=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.FieldContent=t.FieldType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=GC(),o=GE(),a=GN(),u=GF(),s=GU(),l=GV(),c=GK();t.FieldType=r.keyof({Text:null,Date:null,Timestamp:null,Color:null,Number:null,Range:null,Select:null}),t.FieldContent=r.union([o.DateContent,i.ColorContent,a.NumberContent,u.RangeContent,s.SelectContent,l.TextContent,c.TimestampContent]),(0,n.__exportStar)(GC(),t),(0,n.__exportStar)(Gk,t),(0,n.__exportStar)(GE(),t),(0,n.__exportStar)(GN(),t),(0,n.__exportStar)(GF(),t),(0,n.__exportStar)(GU(),t),(0,n.__exportStar)(GV(),t),(0,n.__exportStar)(GK(),t)}(G_)),G_}var GG,GZ,GY={};function GJ(){return GZ||(GZ=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.GeoPointContent=t.GeoPointLegacy=t.isGeoPointContent=t.GeoPointContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga();t.GeoPointContentType="GeoPointContent";let o=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.GeoPointContentType;t.isGeoPointContent=o;let a=r.strict({position:r.strict({lat:r.number,lng:r.number})}),u=n=>new r.Type("GeoPointLegacy",t.isGeoPointContent,n=>(0,$r.pipe)(a.decode(n),UG.either.map(n=>t.GeoPointContent.encode({...n,__TYPE__:t.GeoPointContentType}))),t=>({content:{position:t.position},types:{[n.keyOfType]:"GeoPoint"}}));t.GeoPointLegacy=u,t.GeoPointContent=r.intersection([a,r.strict({__TYPE__:r.literal(t.GeoPointContentType)})])}(GY)),GY}var GQ,GX={};function G0(){return GQ||(GQ=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ImageContent=t.ImageLegacy=t.ImageContentView=t.isImageContent=t.ImageContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Kz(),o=Ga();t.ImageContentType="ImageContent";let a=n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.ImageContentType;t.isImageContent=a;let u=r.exact(r.type({id:r.string,url:r.string,width:r.number,height:r.number}));t.ImageContentView=r.exact(r.intersection([r.type({origin:u,width:r.number,height:r.number,edit:r.type({zoom:r.number,crop:r.type({x:r.number,y:r.number}),background:r.string})}),r.partial({url:r.string,credits:i.NonEmptyStringOrNull,alt:i.NonEmptyStringOrNull,provider:i.StringOrNull})]));let s=r.intersection([t.ImageContentView,r.partial({thumbnails:r.record(r.string,t.ImageContentView)})]),l=n=>new r.Type("ImageLegacy",t.isImageContent,n=>(0,UQ.pipe)(s.decode(n),UG.either.map(n=>t.ImageContent.encode({...n,__TYPE__:t.ImageContentType}))),t=>({content:(0,HB.withOptionals)({edit:t.edit,height:t.height,origin:t.origin,width:t.width},[["alt",t.alt],["credits",t.credits],["provider",t.provider],["thumbnails",t.thumbnails],["url",t.url]]),types:{[n.keyOfType]:"Image"}}));t.ImageLegacy=l,t.ImageContent=r.intersection([s,r.strict({__TYPE__:r.literal(t.ImageContentType)})])}(GX)),GX}var G1,G2={};function G3(){return G1||(G1=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.IntegrationFieldContent=t.IntegrationFieldLegacy=t.isIntegrationFieldContent=t.IntegrationFieldContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga();t.IntegrationFieldContentType="IntegrationFieldsContent";let o=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.IntegrationFieldContentType;t.isIntegrationFieldContent=o;let a=n=>new r.Type("IntegrationFieldLegacy",t.isIntegrationFieldContent,n=>(0,UQ.pipe)(r.string.decode(n),UG.either.map(n=>t.IntegrationFieldContent.encode({value:n,__TYPE__:t.IntegrationFieldContentType}))),t=>({content:t.value,types:{[n.keyOfType]:"IntegrationFields"}}));t.IntegrationFieldLegacy=a,t.IntegrationFieldContent=r.strict({__TYPE__:r.literal(t.IntegrationFieldContentType),value:r.string})}(G2)),G2}var G4,G5={};function G6(){return G4||(G4=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.LinkContent=t.Link=t.LinkContentLegacy=t.LinkLegacy=t.isLinkContent=t.LinkContentType=t.ExternalLinkContent=t.ExternalLinkType=t.DocumentLinkContent=t.DocumentLinkType=t.FileLinkContent=t.FileLinkType=t.ImageLinkContent=t.ImageLinkType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Kz(),o=Ga();t.ImageLinkType="ImageLink";let a=r.exact(r.intersection([r.type({id:r.string,url:r.string,height:r.string,width:r.string,size:r.string,name:r.string,kind:r.string}),r.partial({date:i.StringOrNull})])),u=new r.Type("ImageLink",n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.ImageLinkType,n=>(0,UQ.pipe)(a.decode(n),UG.either.map(n=>t.ImageLinkContent.encode({...n,__TYPE__:t.ImageLinkType}))),t=>a.encode(t));t.ImageLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.ImageLinkType)}),a]),t.FileLinkType="FileLink";let s=r.exact(r.intersection([r.type({id:r.string,url:r.string,name:r.string,kind:r.string,size:(0,q$.withFallback)(r.string,"0")}),r.partial({date:(0,$n.nullable)(r.string)})])),l=new r.Type("FileLink",n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.FileLinkType,n=>(0,UQ.pipe)(s.decode(n),UG.either.map(n=>t.FileLinkContent.encode({...n,__TYPE__:t.FileLinkType}))),t=>s.encode(t));t.FileLinkContent=r.intersection([s,r.exact(r.intersection([r.type({__TYPE__:r.literal(t.FileLinkType)}),r.partial({size:(0,q$.withFallback)(r.string,"0")})]))]),t.DocumentLinkType="DocumentLink";let c=r.strict({id:i.NonEmptyString}),d=new r.Type("DocumentLink",n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.DocumentLinkType,n=>(0,UQ.pipe)(c.decode(n),UG.either.map(n=>t.DocumentLinkContent.encode({...n,__TYPE__:t.DocumentLinkType}))),t=>c.encode(t));t.DocumentLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.DocumentLinkType)}),c]),t.ExternalLinkType="ExternalLink";let f=r.exact(r.intersection([r.type({url:r.string}),r.partial({kind:r.literal("web"),target:i.StringOrNull,preview:(0,$n.nullable)(r.partial({title:r.string}))})])),p=new r.Type("ExternalLink",n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.ExternalLinkType,n=>(0,UQ.pipe)(f.decode(n),UG.either.map(n=>t.ExternalLinkContent.encode({...n,__TYPE__:t.ExternalLinkType}))),t=>f.encode(t));t.ExternalLinkContent=r.intersection([r.strict({__TYPE__:r.literal(t.ExternalLinkType)}),f]),t.LinkContentType="LinkContent";let h=n=>(0,o.hasContentType)(n)&&n.__TYPE__===t.LinkContentType;t.isLinkContent=h,t.LinkLegacy=r.union([u,l,d,p]);let m=n=>new r.Type("LinkLegacy",t.isLinkContent,n=>(0,UQ.pipe)(t.LinkLegacy.decode(n),UG.either.map(n=>t.LinkContent.encode({value:n,__TYPE__:t.LinkContentType}))),r=>({content:t.LinkLegacy.encode(r.value),types:{[n.keyOfType]:"Link"}}));t.LinkContentLegacy=m,t.Link=r.union([t.ImageLinkContent,t.FileLinkContent,t.DocumentLinkContent,t.ExternalLinkContent]),t.LinkContent=r.strict({__TYPE__:r.literal(t.LinkContentType),value:t.Link})}(G5)),G5}var G9,G8={},G7={},Ze={};function Zt(){return G9||(G9=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Block=t.BlockLegacy=t.TextBlock=t.checkEmbedBlock=t.EmbedBlock=t.checkImageBlock=t.ImageBlock=t.ValidatedSpans=t.SpanLegacy=t.Span=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Kz(),o=Gx(),a=G0(),u=G6(),s=t=>r.strict({data:t,start:r.number,end:r.number,type:r.literal(Hg.RichTextNodeType.hyperlink)}),l=r.strict({data:(0,q$.withFallback)(r.string,""),start:r.number,end:r.number,type:r.literal("label")}),c=r.strict({start:r.number,end:r.number,type:r.keyof({[Hg.RichTextNodeType.strong]:null,[Hg.RichTextNodeType.em]:null,"list-item":null})});t.Span=r.union([s(u.Link),l,c]),t.SpanLegacy=r.union([s(u.LinkLegacy),l,c]);let d=t=>new r.Type("ValidatedSpans",n=>Array.isArray(n)&&n.every(t.is),(n,i)=>{if(!Array.isArray(n))return r.failure(n,i);{let o=n.reduce((n,r)=>{let i=t.decode(r);return(0,UZ.isLeft)(i)?n:[...n,i.right]},[]).sort((t,n)=>t.start-n.start);return r.success(o)}},n=>n.reduce((n,r)=>{let i=t.encode(r);return[...n,i]},[]));t.ValidatedSpans=d;let f=t=>r.exact(r.intersection([r.type({type:r.literal(Hg.RichTextNodeType.image),data:r.intersection([a.ImageContentView,r.partial({linkTo:(0,$n.nullable)(t)})])}),r.partial({label:i.StringOrNull,direction:i.StringOrNull})]));t.ImageBlock=f(u.Link);let p=f(u.LinkLegacy);t.checkImageBlock=function(t){return t.type===Hg.RichTextNodeType.image};let h=r.exact(r.intersection([r.type({type:r.literal(Hg.RichTextNodeType.embed),data:r.unknown}),r.partial({label:i.StringOrNull,direction:i.StringOrNull})])),m=new r.Type("EmbedBlockLegacy",t=>"embed"===t.type,n=>(0,UQ.pipe)(h.decode(n),UG.either.chain(t=>UG.either.map(n=>[t,n])(o.EmbedContentLegacy.decode(t.data))),UG.either.map(([n,r])=>t.EmbedBlock.encode({...n,data:{...r,__TYPE__:o.EmbedContentType,all:n.data}}))),t=>({...h.encode(t),data:o.EmbedContentLegacy.encode(t.data)}));t.EmbedBlock=r.exact(r.intersection([r.type({type:r.literal(Hg.RichTextNodeType.embed),data:o.EmbedContent}),r.partial({label:i.StringOrNull,direction:i.StringOrNull})])),t.checkEmbedBlock=function(t){return t.type===Hg.RichTextNodeType.embed};let g=n=>r.exact(r.intersection([r.type({type:(0,$n.refineType)(Hg.RichTextNodeTypeCodec,`string which isn't ${Hg.RichTextNodeType.image} ${Hg.RichTextNodeType.embed}`,t=>t!==Hg.RichTextNodeType.image&&t!==Hg.RichTextNodeType.embed),content:r.intersection([r.type({text:r.string}),r.partial({spans:(0,t.ValidatedSpans)(n)})])}),r.partial({label:r.string,direction:r.string})]));t.TextBlock=g(t.Span);let y=g(t.SpanLegacy),v=r.union([m,p,y]);t.BlockLegacy=new r.Type("BlockLegacy",t=>m.is(t)||p.is(t)||y.is(t),t=>v.decode(t),n=>t.ImageBlock.is(n)?p.encode(n):t.EmbedBlock.is(n)?m.encode(n):y.encode(n)),t.Block=r.union([t.ImageBlock,t.EmbedBlock,t.TextBlock])}(Ze)),Ze}function Zn(){return Zr||(Zr=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.RichTextLegacy=t.RichTextContent=t.isRichTextContent=t.RichTextContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga(),o=Zt();t.RichTextContentType="StructuredTextContent";let a=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.RichTextContentType;t.isRichTextContent=a;let u=r.array(o.BlockLegacy);t.RichTextContent=r.strict({__TYPE__:r.literal(t.RichTextContentType),value:r.array(o.Block)}),(0,n.__exportStar)(Zt(),t);let s=n=>new r.Type("RichTextLegacy",t.isRichTextContent,n=>(0,UQ.pipe)(u.decode(n),UG.either.map(n=>({value:n,__TYPE__:t.RichTextContentType}))),t=>({content:u.encode(t.value),types:{[n.keyOfType]:"StructuredText"}}));t.RichTextLegacy=s}(G7)),G7}var Zr,Zi,Zo={};function Za(){return Zi||(Zi=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SeparatorContent=t.SeparatorLegacy=t.isSeparatorContent=t.SeparatorContentType=void 0;let n=(0,n1.__importStar)(V4),r=Ga();t.SeparatorContentType="SeparatorContent";let i=n=>(0,r.hasContentType)(n)&&n.__TYPE__===t.SeparatorContentType;t.isSeparatorContent=i;let o=r=>new n.Type("SeparatorLegacy",t.isSeparatorContent,()=>n.success(t.SeparatorContent.encode({__TYPE__:t.SeparatorContentType})),()=>({content:{},types:{[r.keyOfType]:"Separator"}}));t.SeparatorLegacy=o,t.SeparatorContent=n.strict({__TYPE__:n.literal(t.SeparatorContentType)})}(Zo)),Zo}function Zu(){return Zl||(Zl=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(Gy(),t),(0,n.__exportStar)(Gx(),t),(0,n.__exportStar)(GH(),t),(0,n.__exportStar)(GJ(),t),(0,n.__exportStar)(G0(),t),(0,n.__exportStar)(G3(),t),(0,n.__exportStar)(G6(),t),(0,n.__exportStar)(function(){if(Zs)return G8;Zs=1,Object.defineProperty(G8,"__esModule",{value:!0}),G8.NestableLegacy=G8.isNestableContent=G8.NestableContentDefaultValue=G8.NestableContent=void 0;let t=n1,n=(0,t.__importStar)(V4),r=Gu(),i=Gy(),o=Gx(),a=GH(),u=GJ(),s=G0(),l=G3(),c=G6(),d=Zn(),f=Za();G8.NestableContent=n.union([r.EmptyContent,i.BooleanContent,o.EmbedContent,a.TextContent,a.TimestampContent,a.SelectContent,a.RangeContent,a.NumberContent,a.DateContent,a.ColorContent,u.GeoPointContent,s.ImageContent,l.IntegrationFieldContent,c.LinkContent,d.RichTextContent,f.SeparatorContent]);let p=t=>{switch(t.type){case"Boolean":return(0,i.BooleanContentDefaultValue)(t);case"Select":return(0,a.SelectContentDefaultValue)(t);default:return}};G8.NestableContentDefaultValue=p;let h=t=>(0,a.isTextContent)(t)||(0,a.isColorContent)(t)||(0,a.isDateContent)(t)||(0,a.isTimestampContent)(t)||(0,a.isNumberContent)(t)||(0,a.isRangeContent)(t)||(0,a.isSelectContent)(t)||(0,u.isGeoPointContent)(t)||(0,d.isRichTextContent)(t)||(0,i.isBooleanContent)(t)||(0,o.isEmbedContent)(t)||(0,s.isImageContent)(t)||(0,l.isIntegrationFieldContent)(t)||(0,c.isLinkContent)(t)||(0,f.isSeparatorContent)(t)||(0,r.isEmptyContent)(t);G8.isNestableContent=h;let m=t=>({decode(n){if(!t.fieldType)return;let p=(0,r.EmptyLegacy)(t.fieldType).decode(n);if((0,UZ.isRight)(p))return p;let h=(()=>{switch(t.fieldType){case"Text":return(0,a.TextLegacy)(t);case"Color":return(0,a.ColorLegacy)(t);case"Date":return(0,a.DateLegacy)(t);case"Timestamp":return(0,a.TimestampLegacy)(t);case"Number":return(0,a.NumberLegacy)(t);case"Range":return(0,a.RangeLegacy)(t);case"Select":return(0,a.SelectLegacy)(t);case"GeoPoint":return(0,u.GeoPointLegacy)(t);case"StructuredText":return(0,d.RichTextLegacy)(t);case"Boolean":return(0,i.BooleanLegacy)(t);case"Embed":return(0,o.EmbedLegacy)(t);case"Image":return(0,s.ImageLegacy)(t);case"IntegrationFields":return(0,l.IntegrationFieldLegacy)(t);case"Link":return(0,c.LinkContentLegacy)(t);case"Separator":return(0,f.SeparatorLegacy)(t);default:return}})();if(h)return h.decode(n)},encode(n){switch(n.__TYPE__){case Gk.FieldContentType:return"Text"===n.type?(0,a.TextLegacy)(t).encode(n):"Color"===n.type?(0,a.ColorLegacy)(t).encode(n):"Range"===n.type?(0,a.RangeLegacy)(t).encode(n):"Date"===n.type?(0,a.DateLegacy)(t).encode(n):"Number"===n.type?(0,a.NumberLegacy)(t).encode(n):"Timestamp"===n.type?(0,a.TimestampLegacy)(t).encode(n):"Select"===n.type?(0,a.SelectLegacy)(t).encode(n):void 0;case u.GeoPointContentType:return(0,u.GeoPointLegacy)(t).encode(n);case d.RichTextContentType:return(0,d.RichTextLegacy)(t).encode(n);case o.EmbedContentType:return(0,o.EmbedLegacy)(t).encode(n);case i.BooleanContentType:return(0,i.BooleanLegacy)(t).encode(n);case s.ImageContentType:return(0,s.ImageLegacy)(t).encode(n);case l.IntegrationFieldContentType:return(0,l.IntegrationFieldLegacy)(t).encode(n);case c.LinkContentType:return(0,c.LinkContentLegacy)(t).encode(n);case f.SeparatorContentType:return(0,f.SeparatorLegacy)(t).encode(n);default:return}}});return G8.NestableLegacy=m,G8}(),t),(0,n.__exportStar)(Zn(),t),(0,n.__exportStar)(Za(),t)}(Gm)),Gm}var Zs,Zl,Zc,Zd={};function Zf(){if(Zc)return Zd;Zc=1,Object.defineProperty(Zd,"__esModule",{value:!0}),Zd.repeatableContentWithDefaultNestableContentValues=Zd.withDefaultNestableContentValues=void 0;let t=Zu();return Zd.withDefaultNestableContentValues=function(n,r){return Object.entries(n).reduce((n,[i,o])=>{if(void 0===r[i]){let a=(0,t.NestableContentDefaultValue)(o);return void 0!==a?{...n,[i]:a}:n}return n},r)},Zd.repeatableContentWithDefaultNestableContentValues=function(n,r){let i=Object.entries(n);return r.map(n=>i.reduce((r,[i,o])=>{if(!n.value.find(([t])=>t===i)){let a=(0,t.NestableContentDefaultValue)(o);return{...r,value:[...r.value,...a?[[i,a]]:[]]}}return r},n))},Zd}function Zp(){return Zh||(Zh=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.traverseGroupItemsContent=t.traverseGroupContent=t.groupContentWithDefaultValues=t.GroupContent=t.isGroupContent=t.GroupContentType=t.GroupLegacy=t.GroupItemLegacy=t.GroupItemContent=t.GroupItemContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga(),o=Zu(),a=Zf();t.GroupItemContentType="GroupItemContent",t.GroupItemContent=r.strict({__TYPE__:r.literal(t.GroupItemContentType),value:r.array(r.tuple([r.string,o.NestableContent]))});let u=r.record(r.string,r.unknown),s=n=>new r.Type("GroupItemLegacy",n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.GroupItemContentType,r=>(0,UQ.pipe)(u.decode(r),UG.either.map(r=>({value:Object.entries(r).reduce((t,[r,i])=>{let a=(0,Gl.getFieldCtx)(r,n),u=(0,o.NestableLegacy)(a).decode(i);return!u||(0,UZ.isLeft)(u)?t:[...t,[r,u.right]]},[]),__TYPE__:t.GroupItemContentType}))),t=>t.value.reduce((t,[r,i])=>{let a=(0,Gl.getFieldCtx)(r,n),u=(0,o.NestableLegacy)(a).encode(i);return u?{content:{...t.content,[r]:u.content},types:{...t.types,...u.types}}:t},{content:{},types:{}}));t.GroupItemLegacy=s;let l=n=>{let i=r.array(r.union([r.null,(0,t.GroupItemLegacy)(n)])),o=r.array((0,t.GroupItemLegacy)(n));return new r.Type("GroupLegacy",t.isGroupContent,n=>(0,UQ.pipe)(i.decode(n),UG.either.map(n=>({value:n.map(n=>null===n?{__TYPE__:t.GroupItemContentType,value:[]}:n),__TYPE__:t.GroupContentType}))),t=>{let r=o.encode(t.value);return{content:r.map(t=>t.content),types:r.reduce((t,n)=>({...t,...n.types}),{[n.keyOfType]:"Group"})}})};t.GroupLegacy=l,t.GroupContentType="GroupContentType";let c=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.GroupContentType;function d({path:t,model:n,content:r}){return i=>r.map((r,a)=>{let u=t.concat([{key:a.toString(),type:"GroupItem"}]),s=r.value.reduce((t,[r,a])=>{let s=null==n?void 0:n[r],l=i({path:u.concat([{key:r,type:"Widget"}]),key:r,apiId:r,model:s,content:a});return l&&(0,o.isNestableContent)(l)?t.concat([[r,l]]):t},[]);return{__TYPE__:r.__TYPE__,value:s}})}t.isGroupContent=c,t.GroupContent=r.strict({__TYPE__:r.literal(t.GroupContentType),value:r.array(t.GroupItemContent)}),t.groupContentWithDefaultValues=function(t,n){var r;let i=null===(r=t.config)||void 0===r?void 0:r.fields;return i?{...n,value:(0,a.repeatableContentWithDefaultNestableContentValues)(i,n.value)}:n},t.traverseGroupContent=function({path:t,key:n,apiId:r,model:i,content:o}){return a=>{var u;let s=d({path:t,model:null===(u=null==i?void 0:i.config)||void 0===u?void 0:u.fields,content:o.value})(a);return a({path:t,key:n,apiId:r,model:i,content:{__TYPE__:o.__TYPE__,value:s}})}},t.traverseGroupItemsContent=d}(Gs)),Gs}var Zh,Zm,Zg={},Zy={},Zv={},Zb={};function Zx(){if(Zm)return Zb;Zm=1,Object.defineProperty(Zb,"__esModule",{value:!0}),Zb.RepeatableWidgets=Zb.RepeatableWidgetsLegacy=void 0;let t=(0,n1.__importStar)(V4),n=Zp(),r=Zu(),i=r=>t.array((0,n.GroupItemLegacy)(r));Zb.RepeatableWidgetsLegacy=i;let o=t.tuple([t.string,r.NestableContent]),a=t.strict({__TYPE__:t.literal(n.GroupItemContentType),value:t.array(o)});return Zb.RepeatableWidgets=t.array(a),Zb}function Z_(){return ZS||(ZS=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.migrateCompositeSlice=t.traverseCompositeSliceContent=t.compositeSliceContentWithDefaultValues=t.CompositeSliceContent=t.CompositeSliceLegacy=t.isCompositeSliceContent=t.CompositeSliceContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga(),o=Zp(),a=Zu(),u=Zf(),s=Zx();t.CompositeSliceContentType="CompositeSliceContent";let l=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.CompositeSliceContentType;t.isCompositeSliceContent=l;let c=r.exact(r.partial({repeat:r.array(r.unknown),"non-repeat":r.UnknownRecord})),d=n=>new r.Type("CompositeSliceLegacy",t.isCompositeSliceContent,r=>(0,UQ.pipe)(c.decode(r),UG.either.map(r=>{let i=(()=>{let t=(0,Gl.getFieldCtx)("repeat",n),i=(0,s.RepeatableWidgetsLegacy)(t).decode(r.repeat);if(!(!i||(0,UZ.isLeft)(i)))return i.right})()||[];return{nonRepeat:Object.entries(r["non-repeat"]||{}).reduce((t,[r,i])=>{let o=(0,Gl.getFieldCtx)(r,n,["non-repeat"]);if(!o)return t;let u=(0,a.NestableLegacy)(o).decode(i);return!u||(0,UZ.isLeft)(u)?t:{...t,[r]:u.right}},{}),repeat:i,__TYPE__:t.CompositeSliceContentType}})),t=>{let r=Object.entries(t.nonRepeat).reduce((t,[r,i])=>{let o=(0,Gl.getFieldCtx)(r,n,["non-repeat"]),u=(0,a.NestableLegacy)(o).encode(i);return u?{content:{...t.content,[r]:u.content},types:{...t.types,...u.types}}:t},{content:{},types:{}}),i=(()=>{let r=(0,Gl.getFieldCtx)("repeat",n);return(0,s.RepeatableWidgetsLegacy)(r).encode(t.repeat)})()||[];return{content:{"non-repeat":r.content,repeat:i.map(t=>t.content)},types:{[n.keyOfType]:"Slice",...r.types,...i.reduce((t,n)=>({...t,...n.types}),{})}}});t.CompositeSliceLegacy=d,t.CompositeSliceContent=r.strict({__TYPE__:r.literal(t.CompositeSliceContentType),nonRepeat:r.record(r.string,a.NestableContent),repeat:s.RepeatableWidgets}),t.compositeSliceContentWithDefaultValues=function(t,n){var r,i;let o=(0,u.withDefaultNestableContentValues)(null!==(r=t["non-repeat"])&&void 0!==r?r:{},n.nonRepeat),a=(0,u.repeatableContentWithDefaultNestableContentValues)(null!==(i=t.repeat)&&void 0!==i?i:{},n.repeat);return{...n,nonRepeat:o,repeat:a}},t.traverseCompositeSliceContent=function({path:t,sliceKey:n,sliceName:r,model:i,content:u}){return(s,l)=>{let c=Object.entries(u.widget.nonRepeat).reduce((o,[u,l])=>{var c,d,f;let p=(null==i?void 0:i.type)==="SharedSlice"?null===(d=null===(c=null==i?void 0:i.fields)||void 0===c?void 0:c.primary)||void 0===d?void 0:d[u]:null===(f=null==i?void 0:i["non-repeat"])||void 0===f?void 0:f[u],h=s({path:t.concat([{key:"non-repeat",type:"primary"},{key:u,type:"Widget"}]),key:u,apiId:r,model:p,content:l});return h?(0,a.isNestableContent)(h)?{...o,[u]:h}:(console.warn(`Warn: Non nestable content with key [${u}] detected in a composite slice [${r}] with key [${n}]`),o):o},{}),d=(0,o.traverseGroupItemsContent)({path:t.concat([{key:"repeat",type:"items"}]),model:(null==i?void 0:i.type)==="SharedSlice"?null==i?void 0:i.fields.items:null==i?void 0:i.repeat,content:u.widget.repeat})(s);return l({key:n,apiId:r,path:t,model:i,content:{...u,widget:{__TYPE__:"CompositeSliceContent",repeat:d,nonRepeat:c}}})}},t.migrateCompositeSlice=function(t,n){let[,r]=n.key.split("$");return{key:`${t.sliceName}$${r}`,name:t.sliceName,maybeLabel:n.maybeLabel,widget:{__TYPE__:"SharedSliceContent",variation:t.variationId,primary:Object.entries(n.widget.nonRepeat).reduce((r,[i,o])=>{var a;return!(null===(a=t.fields.primary)||void 0===a)&&a[i]?{...r,[i]:o}:(console.warn(`The widget ${i} in the non-repeat zone of the composite slice [${t.sliceName}] with key [${n.key}] doesn't exist in the model.`),r)},{}),items:n.widget.repeat.map(r=>({__TYPE__:"GroupItemContent",value:r.value.reduce((r,[i,o])=>{var a;return!(null===(a=t.fields.items)||void 0===a)&&a[i]?r.concat([[i,o]]):(console.warn(`The widget ${i} in the repeat zone of the composite slice [${t.sliceName}] with key [${n.key}] doesn't exist in the model.`),r)},[])}),[])}}}}(Zv)),Zv}var ZS,ZT,Zw={};function ZO(){return ZT||(ZT=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.traverseSharedSliceContent=t.sharedSliceContentWithDefaultValues=t.SharedSliceContent=t.SharedSliceLegacy=t.isSharedSliceContent=t.SharedSliceContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga(),o=Zp(),a=Zu(),u=Zf(),s=Zx();t.SharedSliceContentType="SharedSliceContent";let l=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.SharedSliceContentType;t.isSharedSliceContent=l;let c=r.exact(r.type({variation:r.string,items:(0,q$.withFallback)(r.array(r.unknown),[]),primary:(0,q$.withFallback)(r.UnknownRecord,{})})),d=n=>new r.Type("SharedSliceLegacy",t.isSharedSliceContent,r=>(0,UQ.pipe)(c.decode(r),UG.either.map(r=>{let i=(()=>{let t=(0,Gl.getFieldCtx)("items",n,["variations",r.variation]),i=(0,s.RepeatableWidgetsLegacy)(t).decode(r.items);if(!(!i||(0,UZ.isLeft)(i)))return i.right})()||[],o=Object.entries(r.primary).reduce((t,[i,o])=>{let u=(0,Gl.getFieldCtx)(i,n,["variations",r.variation,"primary"]),s=(0,a.NestableLegacy)(u).decode(o);return!s||(0,UZ.isLeft)(s)?t:{...t,[i]:s.right}},{});return{variation:r.variation,primary:o,items:i,__TYPE__:t.SharedSliceContentType}})),t=>{let r=Object.entries(t.primary).reduce((r,[i,o])=>{let u=(0,Gl.getFieldCtx)(i,n,["variations",t.variation,"primary"]),s=(0,a.NestableLegacy)(u).encode(o);return s?{content:{...r.content,[i]:s.content},types:{...r.types,...s.types}}:r},{content:{},types:{}}),i=(()=>{let r=(0,Gl.getFieldCtx)("items",n,["variations",t.variation]);return(0,s.RepeatableWidgetsLegacy)(r).encode(t.items)})()||[];return{content:{primary:r.content,items:i.map(t=>t.content),variation:t.variation},types:{[n.keyOfType]:"SharedSlice",...r.types,...i.reduce((t,n)=>({...t,...n.types}),{})}}});t.SharedSliceLegacy=d,t.SharedSliceContent=r.strict({__TYPE__:r.literal(t.SharedSliceContentType),variation:r.string,primary:r.record(r.string,a.NestableContent),items:s.RepeatableWidgets}),t.sharedSliceContentWithDefaultValues=function(t,n){var r,i;let o=t.variations.find(t=>t.id===n.variation),a=null!==(r=null==o?void 0:o.primary)&&void 0!==r?r:{},s=null!==(i=null==o?void 0:o.items)&&void 0!==i?i:{},l=(0,u.withDefaultNestableContentValues)(a,n.primary),c=(0,u.repeatableContentWithDefaultNestableContentValues)(s,n.items);return{...n,primary:l,items:c}},t.traverseSharedSliceContent=function({path:t,sliceKey:n,sliceName:r,model:i,content:u}){return(s,l)=>{let c=Object.entries(u.widget.primary).reduce((o,[u,l])=>{var c,d;let f=null===(d=null===(c=null==i?void 0:i.fields)||void 0===c?void 0:c.primary)||void 0===d?void 0:d[u],p=s({path:t.concat([{key:"primary",type:"primary"},{key:u,type:"Widget"}]),key:u,apiId:r,model:f,content:l});return p?(0,a.isNestableContent)(p)?{...o,[u]:p}:(console.warn(`Warn: Non nestable content with key [${u}] detected in a shared slice [${r}] with key [${n}]`),o):o},{}),d=(0,o.traverseGroupItemsContent)({path:t.concat([{key:"items",type:"items"}]),model:null==i?void 0:i.fields.items,content:u.widget.items})(s);return l({key:n,apiId:r,path:t,model:i,content:{...u,widget:{__TYPE__:"SharedSliceContent",variation:u.widget.variation,primary:c,items:d}}})}}}(Zw)),Zw}var Zk,ZC={};function ZI(){if(Zk)return ZC;Zk=1,Object.defineProperty(ZC,"__esModule",{value:!0}),ZC.migrateSimpleSlice=ZC.traverseSimpleSliceContent=ZC.SimpleSliceLegacy=ZC.isSimpleSliceContent=ZC.SimpleSliceContent=void 0;let t=(0,n1.__importStar)(V4),n=Zp(),r=Zu();ZC.SimpleSliceContent=t.union([r.NestableContent,n.GroupContent]);let i=t=>(0,r.isNestableContent)(t)||(0,n.isGroupContent)(t);ZC.isSimpleSliceContent=i;let o=t=>({decode:"Group"===t.fieldType?(0,n.GroupLegacy)(t).decode.bind(null):(0,r.NestableLegacy)(t).decode.bind(null),encode:i=>"GroupContentType"===i.__TYPE__?(0,n.GroupLegacy)(t).encode(i):(0,r.NestableLegacy)(t).encode(i)});return ZC.SimpleSliceLegacy=o,ZC.traverseSimpleSliceContent=function({path:t,sliceKey:r,sliceName:i,model:o,content:a}){return(u,s)=>{var l;if((0,n.isGroupContent)(a.widget)){let c=(0,n.traverseGroupContent)({path:t,key:a.key,apiId:a.name,model:(null==o?void 0:o.type)==="Group"?o:(null==o?void 0:o.type)==="SharedSlice"?{type:"Group",config:{fields:o.fields.items||{}}}:void 0,content:a.widget})(u);return c&&s({key:a.key,apiId:a.name,path:t,model:o,content:{...a,widget:c}})}let d=u({key:a.key,apiId:a.name,path:t,model:(null==o?void 0:o.type)==="SharedSlice"?null===(l=o.fields.primary)||void 0===l?void 0:l[a.name]:(null==o?void 0:o.type)!=="Group"?o:void 0,content:a.widget});return d&&s({key:r,apiId:i,path:t,model:o,content:{...a,widget:d}})}},ZC.migrateSimpleSlice=function(t,n){var r;let[,i]=n.key.split("$"),o=`${t.sliceName}$${i}`;return"GroupContentType"===n.widget.__TYPE__?{key:o,name:t.sliceName,maybeLabel:n.maybeLabel,widget:{__TYPE__:"SharedSliceContent",variation:t.variationId,primary:{},items:n.widget.value.map(n=>({__TYPE__:"GroupItemContent",value:n.value.reduce((n,[r,i])=>{var o;return!(null===(o=t.fields.items)||void 0===o)&&o[r]?n.concat([[r,i]]):n},[])}),[])}}:{key:o,name:t.sliceName,maybeLabel:n.maybeLabel,widget:{__TYPE__:"SharedSliceContent",variation:t.variationId,primary:!(null===(r=t.fields.primary)||void 0===r)&&r[n.name]?{[n.name]:n.widget}:{},items:[]}}},ZC}function ZM(){return ZR||(ZR=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.SliceContent=t.SliceLegacy=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Z_(),o=ZO(),a=ZI(),u=t=>({decode:n=>(()=>{switch(t.fieldType){case"Slice":return(0,i.CompositeSliceLegacy)(t);case"SharedSlice":return(0,o.SharedSliceLegacy)(t);default:return(0,a.SimpleSliceLegacy)(t)}})().decode(n),encode(n){switch(n.__TYPE__){case"SharedSliceContent":return(0,o.SharedSliceLegacy)(t).encode(n);case"CompositeSliceContent":return(0,i.CompositeSliceLegacy)(t).encode(n);default:return(0,a.SimpleSliceLegacy)(t).encode(n)}}});t.SliceLegacy=u,t.SliceContent=r.union([i.CompositeSliceContent,o.SharedSliceContent,a.SimpleSliceContent]),(0,n.__exportStar)(Z_(),t),(0,n.__exportStar)(ZO(),t),(0,n.__exportStar)(ZI(),t)}(Zy)),Zy}var ZR,ZE,Zj={};function ZA(){if(ZE)return Zj;ZE=1,Object.defineProperty(Zj,"__esModule",{value:!0}),Zj.migrateSliceItem=Zj.SlicesItemLegacy=Zj.sliceItemContentWithDefaultValues=Zj.isSimpleSliceItemContent=Zj.isCompositeSliceItemContent=Zj.isSharedSliceItemContent=Zj.SliceItemContent=void 0;let t=n1,n=(0,t.__importStar)(V4),r=Zp(),i=Zu(),o=Zf(),a=ZM(),u=Z_(),s=ZO(),l=ZI();function c(t){return(0,u.isCompositeSliceContent)(t.widget)}function d(t){return(0,r.isGroupContent)(t.widget)||(0,i.isNestableContent)(t.widget)}Zj.SliceItemContent=n.type({key:n.string,name:n.string,maybeLabel:n.union([n.string,n.undefined]),widget:a.SliceContent}),Zj.isSharedSliceItemContent=function(t){return(0,s.isSharedSliceContent)(t.widget)},Zj.isCompositeSliceItemContent=c,Zj.isSimpleSliceItemContent=d,Zj.sliceItemContentWithDefaultValues=function(t,n){var i;if("SharedSlice"===t.type&&(0,s.isSharedSliceContent)(n))return(0,a.sharedSliceContentWithDefaultValues)(t,n);if("Slice"===t.type&&(0,u.isCompositeSliceContent)(n))return(0,a.compositeSliceContentWithDefaultValues)(t,n);if("Group"===t.type&&(0,r.isGroupContent)(n)&&!(null===(i=t.config)||void 0===i)&&i.fields){let l=(0,o.repeatableContentWithDefaultNestableContentValues)(t.config.fields,n.value);return{...n,value:l}}return n};let f=n.exact(n.intersection([n.type({key:n.string,value:n.unknown}),n.partial({label:(0,$n.nullable)(n.string)})])),p=t=>new n.Type("SlicesItemLegacy",t=>((0,s.isSharedSliceContent)(t.widget),(0,u.isCompositeSliceContent)(t.widget),(0,l.isSimpleSliceContent)(t.widget)),(r,i)=>(0,UQ.pipe)(f.decode(r),UG.either.chain(o=>{var u;let s=o.key.indexOf("$"),l=o.key.substring(0,s>0?s:void 0),c=(0,Gl.getFieldCtx)(l,t),d=(0,a.SliceLegacy)(c).decode(o.value);return!d||(0,UZ.isLeft)(d)?n.failure(r,i):n.success({key:o.key,name:l,maybeLabel:null!==(u=o.label)&&void 0!==u?u:void 0,widget:d.right})})),n=>{let r=(0,Gl.getFieldCtx)(n.name,t),i=(0,a.SliceLegacy)(r).encode(n.widget);return{content:{key:n.key,label:n.maybeLabel,value:(null==i?void 0:i.content)||{}},types:(null==i?void 0:i.types)||{}}});Zj.SlicesItemLegacy=p;let h=({model:t,content:n})=>c(n)&&(null==t?void 0:t.type)==="SharedSlice"?(0,u.migrateCompositeSlice)(t,n):d(n)&&(null==t?void 0:t.type)==="SharedSlice"?(0,l.migrateSimpleSlice)(t,n):n;return Zj.migrateSliceItem=h,Zj}var ZN,ZP={};function ZL(){return ZF||(ZF=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(ZM(),t),(0,n.__exportStar)(ZA(),t),(0,n.__exportStar)((ZN||(ZN=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.traverseSlices=t.slicesContentWithDefaultValues=t.SlicesContent=t.SlicesLegacy=t.isSlicesContent=t.SlicesContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga(),o=Z_(),a=ZO(),u=ZI(),s=ZA();t.SlicesContentType="SliceContentType";let l=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.SlicesContentType;t.isSlicesContent=l;let c=n=>{let i=r.array((0,s.SlicesItemLegacy)(n));return new r.Type("SlicesLegacy",t.isSlicesContent,n=>(0,UQ.pipe)(i.decode(n),UG.either.map(n=>({__TYPE__:t.SlicesContentType,value:n}))),t=>{let r=i.encode(t.value);return{content:r.map(t=>t.content),types:r.reduce((t,n)=>({...t,...n.types}),{[n.keyOfType]:"Slices"})}})};t.SlicesLegacy=c,t.SlicesContent=r.type({__TYPE__:r.literal(t.SlicesContentType),value:r.array(s.SliceItemContent)}),t.slicesContentWithDefaultValues=function(t,n){var r;let i=null===(r=null==t?void 0:t.config)||void 0===r?void 0:r.choices;if(void 0===i)return n;let o=n.value.map(t=>{let n=i[t.name];if(n){let r=(0,s.sliceItemContentWithDefaultValues)(n,t.widget);return{...t,widget:r}}return t});return{...n,value:o}},t.traverseSlices=function({path:t,key:n,model:r,content:i}){return({transformWidget:l=({content:t})=>t,transformSlice:c=({content:t})=>t})=>{let d=i.value.reduce((n,i)=>{let d=r&&function(t,n,r){var i,o;let a=null===(o=null===(i=null==n?void 0:n.config)||void 0===i?void 0:i.choices)||void 0===o?void 0:o[r.name];return(()=>{if((0,s.isSharedSliceItemContent)(r)&&a&&(0,qJ.isStaticSharedSlice)(a)){let t=a.variations.find(t=>t.id===r.widget.variation);return t?{type:"SharedSlice",sliceName:a.id,variationId:t.id,fields:{primary:t.primary||{},items:t.items||{}}}:void 0}})()||(()=>{var i;let o=V5.ContentPath.append(V5.ContentPath.serialize(t),r.name),a=Object.values((null===(i=null==n?void 0:n.config)||void 0===i?void 0:i.choices)||{}).find(t=>{var n;return!!(0,qJ.isStaticSharedSlice)(t)&&!!(!(null===(n=t.legacyPaths)||void 0===n)&&n[o])});if(!a)return;let u=null==a?void 0:a.variations.find(t=>{var n;return t.id===(null===(n=a.legacyPaths)||void 0===n?void 0:n[o])});if(u)return{type:"SharedSlice",sliceName:a.id,variationId:u.id,fields:{primary:u.primary||{},items:u.items||{}}}})()||(()=>{if(a){if((0,qJ.isCompositeSlice)(a))return{type:"Slice","non-repeat":a["non-repeat"]||{},repeat:a.repeat||{}};if((0,qJ.isLegacySlice)(a))return a}})()}(t,r,i),f=(0,s.isSharedSliceItemContent)(i)?(0,a.traverseSharedSliceContent)({path:t.concat({key:i.key,type:"SharedSlice"}),sliceKey:i.key,sliceName:i.name,model:(null==d?void 0:d.type)==="SharedSlice"?d:void 0,content:i})(l,c):(0,s.isCompositeSliceItemContent)(i)?(0,o.traverseCompositeSliceContent)({path:t.concat({key:i.key,type:"Slice"}),sliceKey:i.key,sliceName:i.name,model:(null==d?void 0:d.type)==="Slice"||(null==d?void 0:d.type)==="SharedSlice"?d:void 0,content:i})(l,c):(0,s.isSimpleSliceItemContent)(i)?(0,u.traverseSimpleSliceContent)({path:t.concat({key:i.key,type:"LegacySlice"}),sliceKey:i.key,sliceName:i.name,model:d&&(null==d?void 0:d.type)!=="Slice"?d:void 0,content:i})(l,c):void 0;return f?n.concat(f):n},[]);return l({path:t,key:n,apiId:n,model:r,content:{__TYPE__:i.__TYPE__,value:d}})}}}(ZP)),ZP),t)}(Zg)),Zg}var ZF,ZD,ZW={};function ZU(){return ZD||(ZD=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.UIDContent=t.UIDLegacy=t.isUIDContent=t.UIDContentType=void 0;let n=n1,r=(0,n.__importStar)(V4),i=Ga();t.UIDContentType="UIDContent";let o=n=>(0,i.hasContentType)(n)&&n.__TYPE__===t.UIDContentType;t.isUIDContent=o;let a=n=>new r.Type("UIDLegacy",t.isUIDContent,n=>(0,UQ.pipe)(r.string.decode(n),UG.either.map(n=>t.UIDContent.encode({value:n,__TYPE__:t.UIDContentType}))),t=>({content:t.value,types:{[n.keyOfType]:"UID"}}));t.UIDLegacy=a,t.UIDContent=r.type({__TYPE__:r.literal(t.UIDContentType),value:r.string})}(ZW)),ZW}var Zz,ZB={};function ZV(){return i||(i=1,function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(Gu(),t),(0,n.__exportStar)(Zp(),t),(0,n.__exportStar)(Zu(),t),(0,n.__exportStar)(ZL(),t),(0,n.__exportStar)(ZU(),t),(0,n.__exportStar)(function(){if(Zz)return ZB;Zz=1,Object.defineProperty(ZB,"__esModule",{value:!0}),ZB.WidgetLegacy=ZB.isWidgetContent=ZB.WidgetContent=void 0;let t=(0,n1.__importStar)(V4),n=Zp(),r=Zu(),i=ZL(),o=ZU();ZB.WidgetContent=t.union([n.GroupContent,r.NestableContent,o.UIDContent,i.SlicesContent]);let a=t=>(0,n.isGroupContent)(t)||(0,r.isNestableContent)(t)||(0,o.isUIDContent)(t)||(0,i.isSlicesContent)(t);ZB.isWidgetContent=a;let u=t=>({decode(a){if(!t.fieldType)return;let u=(()=>{switch(t.fieldType){case"UID":return(0,o.UIDLegacy)(t);case"Group":return(0,n.GroupLegacy)(t);case"Choice":case"Slices":return(0,i.SlicesLegacy)(t);default:return(0,r.NestableLegacy)(t)}})();if(u)return u.decode(a)},encode(a){switch(a.__TYPE__){case o.UIDContentType:return(0,o.UIDLegacy)(t).encode(a);case n.GroupContentType:return(0,n.GroupLegacy)(t).encode(a);case i.SlicesContentType:return(0,i.SlicesLegacy)(t).encode(a);default:return(0,r.NestableLegacy)(t).encode(a)}}});return ZB.WidgetLegacy=u,ZB}(),t)}(Gr)),Gr}Object.defineProperty(n2,"__esModule",{value:!0}),n2.migrateDocument=n2.collectWidgets=n2.traverseDocument=n2.fillDocumentWithDefaultValues=n2.DocumentLegacy=n2.Document=void 0;let Z$=n1,Zq=(0,Z$.__importStar)(V4),ZK=ZV();n2.Document=Zq.record(V6.WidgetKey,ZK.WidgetContent);let ZH=Zq.record(V6.WidgetKey,Zq.unknown),ZG=t=>new Zq.Type("Document",t=>!!t&&"object"==typeof t,n=>(0,UQ.pipe)(ZH.decode(n),UG.either.map(n=>Object.entries(n).reduce((n,[r,i])=>{let o=(0,Gl.defaultCtx)(r,t),a=(0,ZK.WidgetLegacy)(o).decode(i);return!a||(0,UZ.isLeft)(a)?n:{...n,[r]:a.right}},{}))),n=>Object.entries(n).reduce((n,[r,i])=>{let o=(0,Gl.defaultCtx)(r,t),a=(0,ZK.WidgetLegacy)(o).encode(i);return a?{content:{...n.content,[r]:a.content},types:{...n.types,...a.types}}:n},{content:{},types:{}}));function ZZ(t){let n=Object.entries(t),{types:r,widgets:i}=n.reduce((t,[n,r])=>{if(n.endsWith("_TYPE")){let i=Gl.FieldOrSliceType.decode(r);if((0,UZ.isRight)(i))return{...t,types:t.types.set(n.substring(0,n.length-5),i.right)}}return n.endsWith("_POSITION")||n.endsWith("_TYPE")?t:{...t,widgets:{...t.widgets,[n]:r}}},{types:new Map,widgets:{}}),o=t.slugs_INTERNAL||[],a=t.uid;return{widgets:i,types:r,uid:a,slugs:o}}function ZY(t){return{customTypeId:null==t?void 0:t.id,fields:Object.fromEntries((0,qJ.flattenSections)(t))}}function ZJ({document:t,customType:n}){let r=n&&qJ.StaticCustomType.is(n)?ZY(n):n;return({transformWidget:n=({content:t})=>t,transformSlice:i=({content:t})=>t})=>{let o=r&&Object.entries(r.fields).reduce((t,[n,r])=>({...t,[n]:r}),{});return Object.entries(t).reduce((t,[a,u])=>{let s=o&&o[a],l=V5.ContentPath.make([{key:null==r?void 0:r.customTypeId,type:"CustomType"},{key:a,type:"Widget"}]),c=(()=>{switch(u.__TYPE__){case"SliceContentType":return(0,ZK.traverseSlices)({path:l,key:a,model:(null==s?void 0:s.type)==="Slices"||(null==s?void 0:s.type)==="Choice"?s:void 0,content:u})({transformWidget:n,transformSlice:i});case"GroupContentType":return(0,ZK.traverseGroupContent)({path:l,key:a,apiId:a,model:(null==s?void 0:s.type)==="Group"?s:void 0,content:u})(n);default:return n({path:l,key:a,apiId:a,model:(null==s?void 0:s.type)!=="Group"&&(null==s?void 0:s.type)!=="Slices"&&(null==s?void 0:s.type)!=="Choice"?s:void 0,content:u})}})();return{...t,...c?{[a]:c}:{}}},{})}}function ZQ(t,n){let r=qJ.StaticCustomType.is(n)?ZY(n):n;return Object.values((0,qJ.collectSharedSlices)(r)).some(t=>Boolean(t.legacyPaths))?ZJ({document:t,customType:n})({transformSlice:ZK.migrateSliceItem}):t}n2.DocumentLegacy={_codec:ZG,extractMetadata:ZZ,parse:function(t,n){let r=(0,UQ.pipe)(Zq.record(V6.WidgetKey,Zq.unknown).decode(t),UG.either.chain(t=>{let{types:n,widgets:r}=ZZ(t);return ZG(n).decode(r)}));return(0,UZ.isLeft)(r)?void 0:ZQ(r.right,n)},encode:function(t){let n=ZG().encode(t);return{...n.content,...n.types}}},n2.fillDocumentWithDefaultValues=function(t,n){let{fields:r}=t&&qJ.StaticCustomType.is(t)?ZY(t):t;return Object.entries(r).reduce((t,[r,i])=>{let o=n[r],a=(()=>{switch(i.type){case"Group":return(0,ZK.isGroupContent)(o)?(0,ZK.groupContentWithDefaultValues)(i,o):o;case"Choice":case"Slices":return(0,ZK.isSlicesContent)(o)?(0,ZK.slicesContentWithDefaultValues)(i,o):o;default:return void 0===o&&qJ.NestableWidget.is(i)?(0,ZK.NestableContentDefaultValue)(i):o}})();return a?{...t,[r]:a}:t},n)},n2.traverseDocument=ZJ,n2.collectWidgets=function(t,n){let r={};return ZJ({document:t})({transformWidget({content:t,path:i}){let o=V5.ContentPath.serialize(i);return n(t,i)&&(r[o]=t),t}}),r},n2.migrateDocument=ZQ,function(t){Object.defineProperty(t,"__esModule",{value:!0});let n=n1;(0,n.__exportStar)(n2,t),(0,n.__exportStar)(ZV(),t),(0,n.__exportStar)(Gl,t)}(n0);let ZX=(0,o.createContext)({update(){}});function Z0(t){var n;return(null==(n=t.config)?void 0:n.label)??("Boolean"===t.type||"Separator"===t.type?void 0:t.fieldset)??t.type}function Z1(t,n){var r,i,o;return"Boolean"===t.type?(n?null==(r=t.config)?void 0:r.placeholder_true:null==(i=t.config)?void 0:i.placeholder_false)||"...":(null==(o=t.config)?void 0:o.placeholder)||"..."}function Z2(t){var n;let{content:r,field:i,id:o,readOnly:a,onContentChange:s}=t,l=(null==r?void 0:r.value)??(null==(n=i.config)?void 0:n.default_value)??!1;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"toggleOff"}),M.jsx(u.Qy,{htmlFor:o,children:Z0(i)}),M.jsxs(u.JO,{children:[M.jsx(u.xu,{padding:4,alignItems:"center",children:M.jsx(u.xv,{children:Z1(i,l)})}),M.jsx(u.rs,{id:o,sx:{alignSelf:"center",marginLeft:"auto",marginRight:12},checked:l,onCheckedChange(t){var n;a||s((n=t,{__TYPE__:"BooleanContent",value:n}))}})]})]})}function Z3(t){let{id:n,field:r,content:i,onContentChange:o}=t;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"colorLens"}),M.jsx(u.Qy,{id:n,children:Z0(r)}),M.jsx(u.JO,{children:M.jsx(u.xu,{padding:{left:4},alignItems:"center",children:M.jsx(u.TC,{onValueChange(t){var n;return o((n=t,void 0===n?void 0:{__TYPE__:"FieldContent",type:"Color",value:n}))},value:null==i?void 0:i.value,"aria-labelledby":n,placeholder:Z1(r)})})})]})}function Z4(t){let{id:n,readOnly:r,field:i,content:o,onContentChange:a}=t,s=null!=o&&o.value?(0,l._O)(o.value):void 0;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"dateRange"}),M.jsx(u.Qy,{id:n,children:Z0(i)}),M.jsx(u.JO,{children:M.jsx(u.xu,{padding:{left:4,right:12},width:"100%",flexDirection:"column",justifyContent:"center",children:M.jsx(u.Wr,{mode:"date","aria-labelledby":n,disabled:r,value:s,onValueChange:t=>a(function(t){if(t)return{__TYPE__:"FieldContent",type:"Date",value:function(t){let n=`${t.getFullYear()}`.padStart(4,"0"),r=`${t.getMonth()+1}`.padStart(2,"0"),i=`${t.getDate()}`.padStart(2,"0");return`${n}-${r}-${i}`}(t)}}(t))})})})]})}let Z5=(0,o.forwardRef)(function(t,n){return M.jsx(u.oi,{...t,padding:Z6,ref:n,sx:{...t.sx,alignSelf:"stretch"}})}),Z6={input:{inline:4},adornment:{inline:12}};function Z9(t){this.content=t}Z9.prototype={constructor:Z9,find:function(t){for(var n=0;n<this.content.length;n+=2)if(this.content[n]===t)return n;return -1},get:function(t){var n=this.find(t);return -1==n?void 0:this.content[n+1]},update:function(t,n,r){var i=r&&r!=t?this.remove(r):this,o=i.find(t),a=i.content.slice();return -1==o?a.push(r||t,n):(a[o+1]=n,r&&(a[o]=r)),new Z9(a)},remove:function(t){var n=this.find(t);if(-1==n)return this;var r=this.content.slice();return r.splice(n,2),new Z9(r)},addToStart:function(t,n){return new Z9([t,n].concat(this.remove(t).content))},addToEnd:function(t,n){var r=this.remove(t).content.slice();return r.push(t,n),new Z9(r)},addBefore:function(t,n,r){var i=this.remove(n),o=i.content.slice(),a=i.find(t);return o.splice(-1==a?o.length:a,0,n,r),new Z9(o)},forEach:function(t){for(var n=0;n<this.content.length;n+=2)t(this.content[n],this.content[n+1])},prepend:function(t){return(t=Z9.from(t)).size?new Z9(t.content.concat(this.subtract(t).content)):this},append:function(t){return(t=Z9.from(t)).size?new Z9(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var n=this;t=Z9.from(t);for(var r=0;r<t.content.length;r+=2)n=n.remove(t.content[r]);return n},toObject:function(){var t={};return this.forEach(function(n,r){t[n]=r}),t},get size(){return this.content.length>>1}},Z9.from=function(t){if(t instanceof Z9)return t;var n=[];if(t)for(var r in t)n.push(r,t[r]);return new Z9(n)};class Z8{constructor(t,n){if(this.content=t,this.size=n||0,null==n)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,i=0,o){for(let a=0,u=0;u<n;a++){let s=this.content[a],l=u+s.nodeSize;if(l>t&&!1!==r(s,i+u,o||null,a)&&s.content.size){let c=u+1;s.nodesBetween(Math.max(0,t-c),Math.min(s.content.size,n-c),r,i+c)}u=l}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,i){let o="",a=!0;return this.nodesBetween(t,n,(u,s)=>{u.isText?(o+=u.text.slice(Math.max(t,s)-s,n-s),a=!r):u.isLeaf?(i?o+="function"==typeof i?i(u):i:u.type.spec.leafText&&(o+=u.type.spec.leafText(u)),a=!r):!a&&u.isBlock&&(o+=r,a=!0)},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new Z8(i,this.size+t.size)}cut(t,n=this.size){if(0==t&&n==this.size)return this;let r=[],i=0;if(n>t)for(let o=0,a=0;a<n;o++){let u=this.content[o],s=a+u.nodeSize;s>t&&((a<t||s>n)&&(u=u.isText?u.cut(Math.max(0,t-a),Math.min(u.text.length,n-a)):u.cut(Math.max(0,t-a-1),Math.min(u.content.size,n-a-1))),r.push(u),i+=u.nodeSize),a=s}return new Z8(r,i)}cutByIndex(t,n){return t==n?Z8.empty:0==t&&n==this.content.length?this:new Z8(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new Z8(i,o)}addToStart(t){return new Z8([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Z8(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];t(i,r,n),r+=i.nodeSize}}findDiffStart(t,n=0){return function t(n,r,i){for(let o=0;;o++){if(o==n.childCount||o==r.childCount)return n.childCount==r.childCount?null:i;let a=n.child(o),u=r.child(o);if(a==u){i+=a.nodeSize;continue}if(!a.sameMarkup(u))return i;if(a.isText&&a.text!=u.text){for(let s=0;a.text[s]==u.text[s];s++)i++;return i}if(a.content.size||u.content.size){let l=t(a.content,u.content,i+1);if(null!=l)return l}i+=a.nodeSize}}(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return function t(n,r,i,o){for(let a=n.childCount,u=r.childCount;;){if(0==a||0==u)return a==u?null:{a:i,b:o};let s=n.child(--a),l=r.child(--u),c=s.nodeSize;if(s==l){i-=c,o-=c;continue}if(!s.sameMarkup(l))return{a:i,b:o};if(s.isText&&s.text!=l.text){let d=0,f=Math.min(s.text.length,l.text.length);for(;d<f&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,i--,o--;return{a:i,b:o}}if(s.content.size||l.content.size){let p=t(s.content,l.content,i-1,o-1);if(p)return p}i-=c,o-=c}}(this,t,n,r)}findIndex(t,n=-1){if(0==t)return Ye(0,t);if(t==this.size)return Ye(this.content.length,t);if(t>this.size||t<0)throw RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=i+this.child(r).nodeSize;if(o>=t)return o==t||n>0?Ye(r+1,o):Ye(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return Z8.empty;if(!Array.isArray(n))throw RangeError("Invalid input for Fragment.fromJSON");return new Z8(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Z8.empty;let n,r=0;for(let i=0;i<t.length;i++){let o=t[i];r+=o.nodeSize,i&&o.isText&&t[i-1].sameMarkup(o)?(n||(n=t.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new Z8(n||t,r)}static from(t){if(!t)return Z8.empty;if(t instanceof Z8)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Z8([t],t.nodeSize);throw RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Z8.empty=new Z8([],0);let Z7={index:0,offset:0};function Ye(t,n){return Z7.index=t,Z7.offset=n,Z7}function Yt(t,n){if(t===n)return!0;if(!(t&&"object"==typeof t)||!(n&&"object"==typeof n))return!1;let r=Array.isArray(t);if(Array.isArray(n)!=r)return!1;if(r){if(t.length!=n.length)return!1;for(let i=0;i<t.length;i++)if(!Yt(t[i],n[i]))return!1}else{for(let o in t)if(!(o in n)||!Yt(t[o],n[o]))return!1;for(let a in n)if(!(a in t))return!1}return!0}let Yn=class t{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let i=0;i<t.length;i++){let o=t[i];if(this.eq(o))return t;if(this.type.excludes(o.type))n||(n=t.slice(0,i));else{if(o.type.excludes(this.type))return t;!r&&o.type.rank>this.type.rank&&(n||(n=t.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Yt(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw RangeError(`There is no mark type ${n.type} in this schema`);return r.create(n.attrs)}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(n){if(!n||Array.isArray(n)&&0==n.length)return t.none;if(n instanceof t)return[n];let r=n.slice();return r.sort((t,n)=>t.type.rank-n.type.rank),r}};Yn.none=[];class Yr extends Error{}class Yi{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=function t(n,r,i,o){let{index:a,offset:u}=n.findIndex(r),s=n.maybeChild(a);if(u==r||s.isText)return o&&!o.canReplace(a,a,i)?null:n.cut(0,r).append(i).append(n.cut(r));let l=t(s.content,r-u-1,i);return l&&n.replaceChild(a,s.copy(l))}(this.content,t+this.openStart,n);return r&&new Yi(r,this.openStart,this.openEnd)}removeBetween(t,n){return new Yi(function t(n,r,i){let{index:o,offset:a}=n.findIndex(r),u=n.maybeChild(o),{index:s,offset:l}=n.findIndex(i);if(a==r||u.isText){if(l!=i&&!n.child(s).isText)throw RangeError("Removing non-flat range");return n.cut(0,r).append(n.cut(i))}if(o!=s)throw RangeError("Removing non-flat range");return n.replaceChild(o,u.copy(t(u.content,r-a-1,i-a-1)))}(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return Yi.empty;let r=n.openStart||0,i=n.openEnd||0;if("number"!=typeof r||"number"!=typeof i)throw RangeError("Invalid input for Slice.fromJSON");return new Yi(Z8.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let a=t.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new Yi(t,r,i)}}function Yo(t,n){if(!n.type.compatibleContent(t.type))throw new Yr("Cannot join "+n.type.name+" onto "+t.type.name)}function Ya(t,n,r){let i=t.node(r);return Yo(i,n.node(r)),i}function Yu(t,n){let r=n.length-1;r>=0&&t.isText&&t.sameMarkup(n[r])?n[r]=t.withText(n[r].text+t.text):n.push(t)}function Ys(t,n,r,i){let o=(n||t).node(r),a=0,u=n?n.index(r):o.childCount;t&&(a=t.index(r),t.depth>r?a++:t.textOffset&&(Yu(t.nodeAfter,i),a++));for(let s=a;s<u;s++)Yu(o.child(s),i);n&&n.depth==r&&n.textOffset&&Yu(n.nodeBefore,i)}function Yl(t,n){return t.type.checkContent(n),t.copy(n)}function Yc(t,n,r){let i=[];return Ys(null,t,r,i),t.depth>r&&Yu(Yl(Ya(t,n,r+1),Yc(t,n,r+1)),i),Ys(n,null,r,i),new Z8(i)}Yi.empty=new Yi(Z8.empty,0,0);class Yd{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(n);return r?t.child(n).cut(r):i}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):0==t?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[3*n],i=0==n?0:this.path[3*n-1]+1;for(let o=0;o<t;o++)i+=r.child(o).nodeSize;return i}marks(){let t=this.parent,n=this.index();if(0==t.content.size)return Yn.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),i=t.maybeChild(n);if(!r){let o=r;r=i,i=o}let a=r.marks;for(var u=0;u<a.length;u++)!1!==a[u].type.spec.inclusive||i&&a[u].isInSet(i.marks)||(a=a[u--].removeFromSet(a));return a}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=t.parent.maybeChild(t.index());for(var o=0;o<r.length;o++)!1!==r[o].type.spec.inclusive||i&&r[o].isInSet(i.marks)||(r=r[o--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new Ym(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let a=t;;){let{index:u,offset:s}=a.content.findIndex(o),l=o-s;if(r.push(a,u,i+s),!l||(a=a.child(u)).isText)break;o=l-1,i+=s+1}return new Yd(n,r,o)}static resolveCached(t,n){for(let r=0;r<Yf.length;r++){let i=Yf[r];if(i.pos==n&&i.doc==t)return i}let o=Yf[Yp]=Yd.resolve(t,n);return Yp=(Yp+1)%Yh,o}}let Yf=[],Yp=0,Yh=12;class Ym{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}let Yg=Object.create(null),Yy=class t{constructor(t,n,r,i=Yn.none){this.type=t,this.attrs=n,this.marks=i,this.content=r||Z8.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,i=0){this.content.nodesBetween(t,n,r,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,i){return this.content.textBetween(t,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&Yt(this.attrs,n||t.defaultAttrs||Yg)&&Yn.sameSet(this.marks,r||Yn.none)}copy(n=null){return n==this.content?this:new t(this.type,this.attrs,n,this.marks)}mark(n){return n==this.marks?this:new t(this.type,this.attrs,this.content,n)}cut(t,n=this.content.size){return 0==t&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return Yi.empty;let i=this.resolve(t),o=this.resolve(n),a=r?0:i.sharedDepth(n),u=i.start(a),s=i.node(a).content.cut(i.pos-u,o.pos-u);return new Yi(s,i.depth-a,o.depth-a)}replace(t,n,r){return function(t,n,r){if(r.openStart>t.depth)throw new Yr("Inserted content deeper than insertion position");if(t.depth-r.openStart!=n.depth-r.openEnd)throw new Yr("Inconsistent open depths");return function t(n,r,i,o){let a=n.index(o),u=n.node(o);if(a==r.index(o)&&o<n.depth-i.openStart){let s=t(n,r,i,o+1);return u.copy(u.content.replaceChild(a,s))}if(!i.content.size)return Yl(u,Yc(n,r,o));if(i.openStart||i.openEnd||n.depth!=o||r.depth!=o){let{start:l,end:c}=function(t,n){let r=n.depth-t.openStart,i=n.node(r).copy(t.content);for(let o=r-1;o>=0;o--)i=n.node(o).copy(Z8.from(i));return{start:i.resolveNoCache(t.openStart+r),end:i.resolveNoCache(i.content.size-t.openEnd-r)}}(i,n);return Yl(u,function t(n,r,i,o,a){let u=n.depth>a&&Ya(n,r,a+1),s=o.depth>a&&Ya(i,o,a+1),l=[];return Ys(null,n,a,l),u&&s&&r.index(a)==i.index(a)?(Yo(u,s),Yu(Yl(u,t(n,r,i,o,a+1)),l)):(u&&Yu(Yl(u,Yc(n,r,a+1)),l),Ys(r,i,a,l),s&&Yu(Yl(s,Yc(i,o,a+1)),l)),Ys(o,null,a,l),new Z8(l)}(n,l,c,r,o))}{let d=n.parent,f=d.content;return Yl(d,f.cut(0,n.parentOffset).append(i.content).append(f.cut(r.parentOffset)))}}(t,n,r,0)}(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(t);if(!(n=n.maybeChild(r)))return null;if(i==t||n.isText)return n;t-=i+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(0==t)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(t){return Yd.resolveCached(this,t)}resolveNoCache(t){return Yd.resolve(this,t)}rangeHasMark(t,n,r){let i=!1;return n>t&&this.nodesBetween(t,n,t=>(r.isInSet(t.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),Yb(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=Z8.empty,i=0,o=r.childCount){let a=this.contentMatchAt(t).matchFragment(r,i,o),u=a&&a.matchFragment(this.content,n);if(!u||!u.validEnd)return!1;for(let s=i;s<o;s++)if(!this.type.allowsMarks(r.child(s).marks))return!1;return!0}canReplaceWith(t,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(t).matchType(r),a=o&&o.matchFragment(this.content,n);return!!a&&a.validEnd}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content);let t=Yn.none;for(let n=0;n<this.marks.length;n++)t=this.marks[n].addToSet(t);if(!Yn.sameSet(t,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(t=>t.toJSON())),t}static fromJSON(t,n){if(!n)throw RangeError("Invalid input for Node.fromJSON");let r=null;if(n.marks){if(!Array.isArray(n.marks))throw RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if("text"==n.type){if("string"!=typeof n.text)throw RangeError("Invalid text node in JSON");return t.text(n.text,r)}let i=Z8.fromJSON(t,n.content);return t.nodeType(n.type).create(n.attrs,i,r)}};Yy.prototype.text=void 0;class Yv extends Yy{constructor(t,n,r,i){if(super(t,n,null,i),!r)throw RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Yb(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Yv(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Yv(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return 0==t&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function Yb(t,n){for(let r=t.length-1;r>=0;r--)n=t[r].type.name+"("+n+")";return n}class Yx{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){var r;let i=new Y_(t,n);if(null==i.next)return Yx.empty;let o=YS(i);i.next&&i.err("Unexpected trailing text");let a,u=(r=function(t){let n=[[]];return o(a(t,0),r()),n;function r(){return n.push([])-1}function i(t,r,i){let o={term:i,to:r};return n[t].push(o),o}function o(t,n){t.forEach(t=>t.to=n)}function a(t,n){if("choice"==t.type)return t.exprs.reduce((t,r)=>t.concat(a(r,n)),[]);if("seq"==t.type)for(let u=0;;u++){let s=a(t.exprs[u],n);if(u==t.exprs.length-1)return s;o(s,n=r())}else if("star"==t.type){let l=r();return i(n,l),o(a(t.expr,l),l),[i(l)]}else if("plus"==t.type){let c=r();return o(a(t.expr,n),c),o(a(t.expr,c),c),[i(c)]}else{if("opt"==t.type)return[i(n)].concat(a(t.expr,n));if("range"==t.type){let d=n;for(let f=0;f<t.min;f++){let p=r();o(a(t.expr,d),p),d=p}if(-1==t.max)o(a(t.expr,d),d);else for(let h=t.min;h<t.max;h++){let m=r();i(d,m),o(a(t.expr,d),m),d=m}return[i(d)]}if("name"==t.type)return[i(n,void 0,t.value)];throw Error("Unknown expr type")}}}(o),a=Object.create(null),function t(n){let i=[];n.forEach(t=>{r[t].forEach(({term:t,to:n})=>{if(!t)return;let o;for(let a=0;a<i.length;a++)i[a][0]==t&&(o=i[a][1]);YM(r,n).forEach(n=>{o||i.push([t,o=[]]),-1==o.indexOf(n)&&o.push(n)})})});let o=a[n.join(",")]=new Yx(n.indexOf(r.length-1)>-1);for(let u=0;u<i.length;u++){let s=i[u][1].sort(YI);o.next.push({type:i[u][0],next:a[s.join(",")]||t(s)})}return o}(YM(r,0)));return function(t,n){for(let r=0,i=[t];r<i.length;r++){let o=i[r],a=!o.validEnd,u=[];for(let s=0;s<o.next.length;s++){let{type:l,next:c}=o.next[s];u.push(l.name),a&&!(l.isText||l.hasRequiredAttrs())&&(a=!1),-1==i.indexOf(c)&&i.push(c)}a&&n.err("Only non-generatable nodes ("+u.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(u,i),u}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(t.child(o).type);return i}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let i=[this];return function o(a,u){let s=a.matchFragment(t,r);if(s&&(!n||s.validEnd))return Z8.from(u.map(t=>t.createAndFill()));for(let l=0;l<a.next.length;l++){let{type:c,next:d}=a.next[l];if(!(c.isText||c.hasRequiredAttrs())&&-1==i.indexOf(d)){i.push(d);let f=o(d,u.concat(c));if(f)return f}}return null}(this,[])}findWrapping(t){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==t)return this.wrapCache[n+1];let r=this.computeWrapping(t);return this.wrapCache.push(t,r),r}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(t)){let a=[];for(let u=i;u.type;u=u.via)a.push(u.type);return a.reverse()}for(let s=0;s<o.next.length;s++){let{type:l,next:c}=o.next[s];l.isLeaf||l.hasRequiredAttrs()||l.name in n||i.type&&!c.validEnd||(r.push({match:l.contentMatch,type:l,via:i}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function n(r){t.push(r);for(let i=0;i<r.next.length;i++)-1==t.indexOf(r.next[i].next)&&n(r.next[i].next)}(this),t.map((n,r)=>{let i=r+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)i+=(o?", ":"")+n.next[o].type.name+"->"+t.indexOf(n.next[o].next);return i}).join(`
|
|
6
6
|
`)}}Yx.empty=new Yx(!0);class Y_{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw SyntaxError(t+" (in content expression '"+this.string+"')")}}function YS(t){let n=[];do n.push(YT(t));while(t.eat("|"));return 1==n.length?n[0]:{type:"choice",exprs:n}}function YT(t){let n=[];do n.push(Yw(t));while(t.next&&")"!=t.next&&"|"!=t.next);return 1==n.length?n[0]:{type:"seq",exprs:n}}function Yw(t){let n=YC(t);for(;;)if(t.eat("+"))n={type:"plus",expr:n};else if(t.eat("*"))n={type:"star",expr:n};else if(t.eat("?"))n={type:"opt",expr:n};else if(t.eat("{"))n=Yk(t,n);else break;return n}function YO(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let n=Number(t.next);return t.pos++,n}function Yk(t,n){let r=YO(t),i=r;return t.eat(",")&&(i="}"!=t.next?YO(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:r,max:i,expr:n}}function YC(t){if(t.eat("(")){let n=YS(t);return t.eat(")")||t.err("Missing closing paren"),n}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let r=(function(t,n){let r=t.nodeTypes,i=r[n];if(i)return[i];let o=[];for(let a in r){let u=r[a];u.groups.indexOf(n)>-1&&o.push(u)}return 0==o.length&&t.err("No node type or group '"+n+"' found"),o})(t,t.next).map(n=>(null==t.inline?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,1==r.length?r[0]:{type:"choice",exprs:r}}}function YI(t,n){return n-t}function YM(t,n){let r=[];return function n(i){let o=t[i];if(1==o.length&&!o[0].term)return n(o[0].to);r.push(i);for(let a=0;a<o.length;a++){let{term:u,to:s}=o[a];u||-1!=r.indexOf(s)||n(s)}}(n),r.sort(YI)}function YR(t){let n=Object.create(null);for(let r in t){let i=t[r];if(!i.hasDefault)return null;n[r]=i.default}return n}function YE(t,n){let r=Object.create(null);for(let i in t){let o=n&&n[i];if(void 0===o){let a=t[i];if(a.hasDefault)o=a.default;else throw RangeError("No value supplied for attribute "+i)}r[i]=o}return r}function Yj(t){let n=Object.create(null);if(t)for(let r in t)n[r]=new YN(t[r]);return n}let YA=class t{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Yj(r.attrs),this.defaultAttrs=YR(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==t),this.isText="text"==t}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Yx.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:YE(this.attrs,t)}create(t=null,n,r){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new Yy(this,this.computeAttrs(t),Z8.from(n),Yn.setFrom(r))}createChecked(t=null,n,r){return n=Z8.from(n),this.checkContent(n),new Yy(this,this.computeAttrs(t),n,Yn.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),(n=Z8.from(n)).size){let i=this.contentMatch.fillBefore(n);if(!i)return null;n=i.append(n)}let o=this.contentMatch.matchFragment(n),a=o&&o.fillBefore(Z8.empty,!0);return a?new Yy(this,t,n.append(a),Yn.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}allowsMarkType(t){return null==this.markSet||this.markSet.indexOf(t)>-1}allowsMarks(t){if(null==this.markSet)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(null==this.markSet)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:Yn.none:t}static compile(n,r){let i=Object.create(null);n.forEach((n,o)=>i[n]=new t(n,r,o));let o=r.spec.topNode||"doc";if(!i[o])throw RangeError("Schema is missing its top node type ('"+o+"')");if(!i.text)throw RangeError("Every schema needs a 'text' type");for(let a in i.text.attrs)throw RangeError("The text node type should not have attributes");return i}};class YN{constructor(t){this.hasDefault=Object.prototype.hasOwnProperty.call(t,"default"),this.default=t.default}get isRequired(){return!this.hasDefault}}class YP{constructor(t,n,r,i){this.name=t,this.rank=n,this.schema=r,this.spec=i,this.attrs=Yj(i.attrs),this.excluded=null;let o=YR(this.attrs);this.instance=o?new Yn(this,o):null}create(t=null){return!t&&this.instance?this.instance:new Yn(this,YE(this.attrs,t))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,o)=>r[t]=new YP(t,i++,n,o)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}excludes(t){return this.excluded.indexOf(t)>-1}}class YL{constructor(t){this.cached=Object.create(null);let n=this.spec={};for(let r in t)n[r]=t[r];n.nodes=Z9.from(t.nodes),n.marks=Z9.from(t.marks||{}),this.nodes=YA.compile(this.spec.nodes,this),this.marks=YP.compile(this.spec.marks,this);let i=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw RangeError(o+" can not be both a node and a mark");let a=this.nodes[o],u=a.spec.content||"",s=a.spec.marks;a.contentMatch=i[u]||(i[u]=Yx.parse(u,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.markSet="_"==s?null:s?YF(this,s.split(" ")):""!=s&&a.inlineContent?null:[]}for(let l in this.marks){let c=this.marks[l],d=c.spec.excludes;c.excluded=null==d?[c]:""==d?[]:YF(this,d.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,i){if("string"==typeof t)t=this.nodeType(t);else if(t instanceof YA){if(t.schema!=this)throw RangeError("Node type from different schema used ("+t.name+")")}else throw RangeError("Invalid node type: "+t);return t.createChecked(n,r,i)}text(t,n){let r=this.nodes.text;return new Yv(r,r.defaultAttrs,t,Yn.setFrom(n))}mark(t,n){return"string"==typeof t&&(t=this.marks[t]),t.create(n)}nodeFromJSON(t){return Yy.fromJSON(this,t)}markFromJSON(t){return Yn.fromJSON(this,t)}nodeType(t){let n=this.nodes[t];if(!n)throw RangeError("Unknown node type: "+t);return n}}function YF(t,n){let r=[];for(let i=0;i<n.length;i++){let o=n[i],a=t.marks[o],u=a;if(a)r.push(a);else for(let s in t.marks){let l=t.marks[s];("_"==o||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&r.push(u=l)}if(!u)throw SyntaxError("Unknown mark type: '"+n[i]+"'")}return r}class YD{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[],n.forEach(t=>{t.tag?this.tags.push(t):t.style&&this.styles.push(t)}),this.normalizeLists=!this.tags.some(n=>{if(!/^(ul|ol)\b/.test(n.tag)||!n.node)return!1;let r=t.nodes[n.node];return r.contentMatch.matchType(r)})}parse(t,n={}){let r=new Y$(this,n,!1);return r.addAll(t,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new Y$(this,n,!0);return r.addAll(t,n.from,n.to),Yi.maxOpen(r.finish())}matchTag(t,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(Yq(t,o.tag)&&(void 0===o.namespace||t.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let a=o.getAttrs(t);if(!1===a)continue;o.attrs=a||void 0}return o}}}matchStyle(t,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let a=this.styles[o],u=a.style;if(!(0!=u.indexOf(t)||a.context&&!r.matchesContext(a.context)||u.length>t.length&&(61!=u.charCodeAt(t.length)||u.slice(t.length+1)!=n))){if(a.getAttrs){let s=a.getAttrs(n);if(!1===s)continue;a.attrs=s||void 0}return a}}}static schemaRules(t){let n=[];function r(t){let r=null==t.priority?50:t.priority,i=0;for(;i<n.length;i++){let o=n[i];if((null==o.priority?50:o.priority)<r)break}n.splice(i,0,t)}for(let i in t.marks){let o=t.marks[i].spec.parseDOM;o&&o.forEach(t=>{r(t=YK(t)),t.mark||t.ignore||t.clearMark||(t.mark=i)})}for(let a in t.nodes){let u=t.nodes[a].spec.parseDOM;u&&u.forEach(t=>{r(t=YK(t)),t.node||t.ignore||t.mark||(t.node=a)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new YD(t,YD.schemaRules(t)))}}let YW={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},YU={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Yz={ol:!0,ul:!0};function YB(t,n,r){return null!=n?(n?1:0)|("full"===n?2:0):t&&"pre"==t.whitespace?3:-5&r}class YV{constructor(t,n,r,i,o,a,u){this.type=t,this.attrs=n,this.marks=r,this.pendingMarks=i,this.solid=o,this.options=u,this.content=[],this.activeMarks=Yn.none,this.stashMarks=[],this.match=a||(4&u?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Z8.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(t.type))?(this.match=r,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let n=this.content[this.content.length-1],r;n&&n.isText&&(r=/[ \t\r\n\u000c]+$/.exec(n.text))&&(n.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-r[0].length)))}let i=Z8.from(this.content);return!t&&this.match&&(i=i.append(this.match.fillBefore(Z8.empty,!0))),this.type?this.type.create(this.attrs,i,this.marks):i}popFromStashMark(t){for(let n=this.stashMarks.length-1;n>=0;n--)if(t.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(t){for(let n=0,r=this.pendingMarks;n<r.length;n++){let i=r[n];(this.type?this.type.allowsMarkType(i.type):YH(i.type,t))&&!i.isInSet(this.activeMarks)&&(this.activeMarks=i.addToSet(this.activeMarks),this.pendingMarks=i.removeFromSet(this.pendingMarks))}}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!YW.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class Y${constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0;let i=n.topNode,o,a=YB(null,n.preserveWhitespace,0)|(r?4:0);o=i?new YV(i.type,i.attrs,Yn.none,Yn.none,!0,n.topMatch||i.type.contentMatch,a):r?new YV(null,null,Yn.none,Yn.none,!0,null,a):new YV(t.schema.topNodeType,null,Yn.none,Yn.none,!0,null,a),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t){if(3==t.nodeType)this.addTextNode(t);else if(1==t.nodeType){let n=t.getAttribute("style");if(n){let r=this.readStyles(function(t){let n=/\s*([\w-]+)\s*:\s*([^;]+)/g,r,i=[];for(;r=n.exec(t);)i.push(r[1],r[2].trim());return i}(n));if(!r)return;let[i,o]=r,a=this.top;for(let u=0;u<o.length;u++)this.removePendingMark(o[u],a);for(let s=0;s<i.length;s++)this.addPendingMark(i[s]);this.addElement(t);for(let l=0;l<i.length;l++)this.removePendingMark(i[l],a);for(let c=0;c<o.length;c++)this.addPendingMark(o[c])}else this.addElement(t)}}addTextNode(t){let n=t.nodeValue,r=this.top;if(2&r.options||r.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(1&r.options)n=2&r.options?n.replace(/\r\n?/g,`
|
|
7
7
|
`):n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let i=r.content[r.content.length-1],o=t.previousSibling;(!i||o&&"BR"==o.nodeName||i.isText&&/[ \t\r\n\u000c]$/.test(i.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n)),this.findInText(t)}else this.findInside(t)}addElement(t,n){let r=t.nodeName.toLowerCase(),i;Yz.hasOwnProperty(r)&&this.parser.normalizeLists&&function(t){for(let n=t.firstChild,r=null;n;n=n.nextSibling){let i=1==n.nodeType?n.nodeName.toLowerCase():null;i&&Yz.hasOwnProperty(i)&&r?(r.appendChild(n),n=r):"li"==i?r=n:i&&(r=null)}}(t);let o=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(i=this.parser.matchTag(t,this,n));if(o?o.ignore:YU.hasOwnProperty(r))this.findInside(t),this.ignoreFallback(t);else if(!o||o.skip||o.closeParent){o&&o.closeParent?this.open=Math.max(0,this.open-1):o&&o.skip.nodeType&&(t=o.skip);let a,u=this.top,s=this.needsBlock;if(YW.hasOwnProperty(r))u.content.length&&u.content[0].isInline&&this.open&&(this.open--,u=this.top),a=!0,u.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t);return}this.addAll(t),a&&this.sync(u),this.needsBlock=s}else this.addElementByRule(t,o,!1===o.consuming?i:void 0)}leafFallback(t){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
|
|
8
8
|
`))}ignoreFallback(t){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"))}readStyles(t){let n=Yn.none,r=Yn.none;e:for(let i=0;i<t.length;i+=2)for(let o;;){let a=this.parser.matchStyle(t[i],t[i+1],this,o);if(!a)continue e;if(a.ignore)return null;if(a.clearMark?this.top.pendingMarks.forEach(t=>{a.clearMark(t)&&(r=t.addToSet(r))}):n=this.parser.schema.marks[a.mark].create(a.attrs).addToSet(n),!1===a.consuming)o=a;else break}return[n,r]}addElementByRule(t,n,r){let i,o,a;n.node?(o=this.parser.schema.nodes[n.node]).isLeaf?this.insertNode(o.create(n.attrs))||this.leafFallback(t):i=this.enter(o,n.attrs||null,n.preserveWhitespace):(a=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(a));let u=this.top;if(o&&o.isLeaf)this.findInside(t);else if(r)this.addElement(t,r);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(t=>this.insertNode(t));else{let s=t;"string"==typeof n.contentElement?s=t.querySelector(n.contentElement):"function"==typeof n.contentElement?s=n.contentElement(t):n.contentElement&&(s=n.contentElement),this.findAround(t,s,!0),this.addAll(s)}i&&this.sync(u)&&this.open--,a&&this.removePendingMark(a,u)}addAll(t,n,r){let i=n||0;for(let o=n?t.childNodes[n]:t.firstChild,a=null==r?null:t.childNodes[r];o!=a;o=o.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(o);this.findAtPoint(t,i)}findPlace(t){let n,r;for(let i=this.open;i>=0;i--){let o=this.nodes[i],a=o.findWrapping(t);if(a&&(!n||n.length>a.length)&&(n=a,r=o,!a.length)||o.solid)break}if(!n)return!1;this.sync(r);for(let u=0;u<n.length;u++)this.enterInner(n[u],null,!1);return!0}insertNode(t){if(t.isInline&&this.needsBlock&&!this.top.type){let n=this.textblockFromContext();n&&this.enterInner(n)}if(this.findPlace(t)){this.closeExtra();let r=this.top;r.applyPending(t.type),r.match&&(r.match=r.match.matchType(t.type));let i=r.activeMarks;for(let o=0;o<t.marks.length;o++)(!r.type||r.type.allowsMarkType(t.marks[o].type))&&(i=t.marks[o].addToSet(i));return r.content.push(t.mark(i)),!0}return!1}enter(t,n,r){let i=this.findPlace(t.create(n));return i&&this.enterInner(t,n,!0,r),i}enterInner(t,n=null,r=!1,i){this.closeExtra();let o=this.top;o.applyPending(t),o.match=o.match&&o.match.matchType(t);let a=YB(t,i,o.options);4&o.options&&0==o.content.length&&(a|=4),this.nodes.push(new YV(t,n,o.activeMarks,o.pendingMarks,r,null,a)),this.open++}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(t){for(let n=this.open;n>=0;n--)if(this.nodes[n]==t)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)null==this.find[n].pos&&1==t.nodeType&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let i=0;i<this.find.length;i++)null==this.find[i].pos&&1==t.nodeType&&t.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),a=(t,u)=>{for(;t>=0;t--){let s=n[t];if(""==s){if(t==n.length-1||0==t)continue;for(;u>=o;u--)if(a(t-1,u))return!0;return!1}{let l=u>0||0==u&&i?this.nodes[u].type:r&&u>=o?r.node(u-o).type:null;if(!l||l.name!=s&&-1==l.groups.indexOf(s))return!1;u--}}return!0};return a(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let i in this.parser.schema.nodes){let o=this.parser.schema.nodes[i];if(o.isTextblock&&o.defaultAttrs)return o}}addPendingMark(t){let n=function(t,n){for(let r=0;r<n.length;r++)if(t.eq(n[r]))return n[r]}(t,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=t.addToSet(this.top.pendingMarks)}removePendingMark(t,n){for(let r=this.open;r>=0;r--){let i=this.nodes[r];if(i.pendingMarks.lastIndexOf(t)>-1)i.pendingMarks=t.removeFromSet(i.pendingMarks);else{i.activeMarks=t.removeFromSet(i.activeMarks);let o=i.popFromStashMark(t);o&&i.type&&i.type.allowsMarkType(o.type)&&(i.activeMarks=o.addToSet(i.activeMarks))}if(i==n)break}}}function Yq(t,n){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,n)}function YK(t){let n={};for(let r in t)n[r]=t[r];return n}function YH(t,n){let r=n.schema.nodes;for(let i in r){let o=r[i];if(!o.allowsMarkType(t))continue;let a=[],u=t=>{a.push(t);for(let r=0;r<t.edgeCount;r++){let{type:i,next:o}=t.edge(r);if(i==n||0>a.indexOf(o)&&u(o))return!0}};if(u(o.contentMatch))return!0}}class YG{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=YY(n).createDocumentFragment());let i=r,o=[];return t.forEach(t=>{if(o.length||t.marks.length){let r=0,a=0;for(;r<o.length&&a<t.marks.length;){let u=t.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(o[r][0])||!1===u.type.spec.spanning)break;r++,a++}for(;r<o.length;)i=o.pop()[1];for(;a<t.marks.length;){let s=t.marks[a++],l=this.serializeMark(s,t.isInline,n);l&&(o.push([s,i]),i.appendChild(l.dom),i=l.contentDOM||l.dom)}}i.appendChild(this.serializeNodeInner(t,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:i}=YG.renderSpec(YY(n),this.nodes[t.type.name](t));if(i){if(t.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,i)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let i=t.marks.length-1;i>=0;i--){let o=this.serializeMark(t.marks[i],t.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(t,n,r={}){let i=this.marks[t.type.name];return i&&YG.renderSpec(YY(r),i(t,n))}static renderSpec(t,n,r=null){if("string"==typeof n)return{dom:t.createTextNode(n)};if(null!=n.nodeType)return{dom:n};if(n.dom&&null!=n.dom.nodeType)return n;let i=n[0],o=i.indexOf(" ");o>0&&(r=i.slice(0,o),i=i.slice(o+1));let a,u=r?t.createElementNS(r,i):t.createElement(i),s=n[1],l=1;if(s&&"object"==typeof s&&null==s.nodeType&&!Array.isArray(s)){for(let c in l=2,s)if(null!=s[c]){let d=c.indexOf(" ");d>0?u.setAttributeNS(c.slice(0,d),c.slice(d+1),s[c]):u.setAttribute(c,s[c])}}for(let f=l;f<n.length;f++){let p=n[f];if(0===p){if(f<n.length-1||f>l)throw RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}{let{dom:h,contentDOM:m}=YG.renderSpec(t,p,r);if(u.appendChild(h),m){if(a)throw RangeError("Multiple content holes");a=m}}}return{dom:u,contentDOM:a}}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new YG(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=YZ(t.nodes);return n.text||(n.text=t=>t.text),n}static marksFromSchema(t){return YZ(t.marks)}}function YZ(t){let n={};for(let r in t){let i=t[r].spec.toDOM;i&&(n[r]=i)}return n}function YY(t){return t.document||window.document}function YJ(t,n){return t+65536*n}function YQ(t){return 65535&t}class YX{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class Y0{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Y0.empty)return Y0.empty}recover(t){var n;let r=0,i=YQ(t);if(!this.inverted)for(let o=0;o<i;o++)r+=this.ranges[3*o+2]-this.ranges[3*o+1];return this.ranges[3*i]+r+(t-(65535&t))/65536}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let i=0,o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let s=this.ranges[u]-(this.inverted?i:0);if(s>t)break;let l=this.ranges[u+o],c=this.ranges[u+a],d=s+l;if(t<=d){let f=l?t==s?-1:t==d?1:n:n,p=s+i+(f<0?0:c);if(r)return p;let h=t==(n<0?s:d)?null:YJ(u/3,t-s),m=t==s?2:t==d?1:4;return(n<0?t!=s:t!=d)&&(m|=8),new YX(p,m,h)}i+=c-l}return r?t+i:new YX(t+i,0,null)}touches(t,n){let r=0,i=YQ(n),o=this.inverted?2:1,a=this.inverted?1:2;for(let u=0;u<this.ranges.length;u+=3){let s=this.ranges[u]-(this.inverted?r:0);if(s>t)break;let l=this.ranges[u+o];if(t<=s+l&&u==3*i)return!0;r+=this.ranges[u+a]-l}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let a=this.ranges[i],u=a-(this.inverted?o:0),s=a+(this.inverted?0:o),l=this.ranges[i+n],c=this.ranges[i+r];t(u,u+l,s,s+c),o+=c-l}}invert(){return new Y0(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return 0==t?Y0.empty:new Y0(t<0?[0,-t,0]:[0,0,t])}}Y0.empty=new Y0([]);class Y1{constructor(t=[],n,r=0,i=t.length){this.maps=t,this.mirror=n,this.from=r,this.to=i}slice(t=0,n=this.maps.length){return new Y1(this.maps,this.mirror,t,n)}copy(){return new Y1(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,n){this.to=this.maps.push(t),null!=n&&this.setMirror(this.maps.length-1,n)}appendMapping(t){for(let n=0,r=this.maps.length;n<t.maps.length;n++){let i=t.getMirror(n);this.appendMap(t.maps[n],null!=i&&i<n?r+i:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this.maps.length+t.maps.length;n>=0;n--){let i=t.getMirror(n);this.appendMap(t.maps[n].invert(),null!=i&&i>n?r-i-1:void 0)}}invert(){let t=new Y1;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let i=0;for(let o=this.from;o<this.to;o++){let a=this.maps[o].mapResult(t,n);if(null!=a.recover){let u=this.getMirror(o);if(null!=u&&u>o&&u<this.to){o=u,t=this.maps[u].recover(a.recover);continue}}i|=a.delInfo,t=a.pos}return r?t:new YX(t,i,null)}}let Y2=Object.create(null);class Y3{getMap(){return Y0.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw RangeError("Invalid input for Step.fromJSON");let r=Y2[n.stepType];if(!r)throw RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in Y2)throw RangeError("Duplicate use of step JSON ID "+t);return Y2[t]=n,n.prototype.jsonID=t,n}}class Y4{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Y4(t,null)}static fail(t){return new Y4(null,t)}static fromReplace(t,n,r,i){try{return Y4.ok(t.replace(n,r,i))}catch(o){if(o instanceof Yr)return Y4.fail(o.message);throw o}}}function Y5(t,n,r){let i=[];for(let o=0;o<t.childCount;o++){let a=t.child(o);a.content.size&&(a=a.copy(Y5(a.content,n,a))),a.isInline&&(a=n(a,r,o)),i.push(a)}return Z8.fromArray(i)}class Y6 extends Y3{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new Yi(Y5(n.content,(t,n)=>t.isAtom&&n.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t,i),n.openStart,n.openEnd);return Y4.fromReplace(t,this.from,this.to,o)}invert(){return new Y9(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Y6(n.pos,r.pos,this.mark)}merge(t){return t instanceof Y6&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Y6(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new Y6(n.from,n.to,t.markFromJSON(n.mark))}}Y3.jsonID("addMark",Y6);class Y9 extends Y3{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new Yi(Y5(n.content,t=>t.mark(this.mark.removeFromSet(t.marks)),t),n.openStart,n.openEnd);return Y4.fromReplace(t,this.from,this.to,r)}invert(){return new Y6(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Y9(n.pos,r.pos,this.mark)}merge(t){return t instanceof Y9&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Y9(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Y9(n.from,n.to,t.markFromJSON(n.mark))}}Y3.jsonID("removeMark",Y9);class Y8 extends Y3{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Y4.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Y4.fromReplace(t,this.pos,this.pos+1,new Yi(Z8.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Y8(this.pos,n.marks[i]);return new Y8(this.pos,this.mark)}}return new Y7(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Y8(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if("number"!=typeof n.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Y8(n.pos,t.markFromJSON(n.mark))}}Y3.jsonID("addNodeMark",Y8);class Y7 extends Y3{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Y4.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Y4.fromReplace(t,this.pos,this.pos+1,new Yi(Z8.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return n&&this.mark.isInSet(n.marks)?new Y8(this.pos,this.mark):this}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Y7(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if("number"!=typeof n.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Y7(n.pos,t.markFromJSON(n.mark))}}Y3.jsonID("removeNodeMark",Y7);class Je extends Y3{constructor(t,n,r,i=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=i}apply(t){return this.structure&&Jn(t,this.from,this.to)?Y4.fail("Structure replace would overwrite content"):Y4.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Y0([this.from,this.to-this.from,this.slice.size])}invert(t){return new Je(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Je(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(t){if(!(t instanceof Je)||t.structure||this.structure)return null;if(this.from+this.slice.size!=t.from||this.slice.openEnd||t.slice.openStart){if(t.to!=this.from||this.slice.openStart||t.slice.openEnd)return null;{let n=this.slice.size+t.slice.size==0?Yi.empty:new Yi(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Je(t.from,this.to,n,this.structure)}}{let r=this.slice.size+t.slice.size==0?Yi.empty:new Yi(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Je(this.from,this.to+(t.to-t.from),r,this.structure)}}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if("number"!=typeof n.from||"number"!=typeof n.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new Je(n.from,n.to,Yi.fromJSON(t,n.slice),!!n.structure)}}Y3.jsonID("replace",Je);class Jt extends Y3{constructor(t,n,r,i,o,a,u=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=a,this.structure=u}apply(t){if(this.structure&&(Jn(t,this.from,this.gapFrom)||Jn(t,this.gapTo,this.to)))return Y4.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Y4.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Y4.fromReplace(t,this.from,this.to,r):Y4.fail("Content does not fit in gap")}getMap(){return new Y0([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new Jt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=t.map(this.gapFrom,-1),o=t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new Jt(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if("number"!=typeof n.from||"number"!=typeof n.to||"number"!=typeof n.gapFrom||"number"!=typeof n.gapTo||"number"!=typeof n.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Jt(n.from,n.to,n.gapFrom,n.gapTo,Yi.fromJSON(t,n.slice),n.insert,!!n.structure)}}function Jn(t,n,r){let i=t.resolve(n),o=r-n,a=i.depth;for(;o>0&&a>0&&i.indexAfter(a)==i.node(a).childCount;)a--,o--;if(o>0){let u=i.node(a).maybeChild(i.indexAfter(a));for(;o>0;){if(!u||u.isLeaf)return!0;u=u.firstChild,o--}}return!1}function Jr(t,n,r){return(0==n||t.canReplace(n,t.childCount))&&(r==t.childCount||t.canReplace(0,r))}function Ji(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let i=t.$from.node(r),o=t.$from.index(r),a=t.$to.indexAfter(r);if(r<t.depth&&i.canReplace(o,a,n))return r;if(0==r||i.type.spec.isolating||!Jr(i,o,a))break}return null}function Jo(t,n,r=null,i=t){let o=function(t,n){let{parent:r,startIndex:i,endIndex:o}=t,a=r.contentMatchAt(i).findWrapping(n);if(!a)return null;let u=a.length?a[0]:n;return r.canReplaceWith(i,o,u)?a:null}(t,n),a=o&&function(t,n){let{parent:r,startIndex:i,endIndex:o}=t,a=r.child(i),u=n.contentMatch.findWrapping(a.type);if(!u)return null;let s=(u.length?u[u.length-1]:n).contentMatch;for(let l=i;s&&l<o;l++)s=s.matchType(r.child(l).type);return s&&s.validEnd?u:null}(i,n);return a?o.map(Ja).concat({type:n,attrs:r}).concat(a.map(Ja)):null}function Ja(t){return{type:t,attrs:null}}function Ju(t,n,r=1,i){let o=t.resolve(n),a=o.depth-r,u=i&&i[i.length-1]||o.parent;if(a<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!u.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let s=o.depth-1,l=r-2;s>a;s--,l--){let c=o.node(s),d=o.index(s);if(c.type.spec.isolating)return!1;let f=c.content.cutByIndex(d,c.childCount),p=i&&i[l+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let h=i&&i[l]||c;if(!c.canReplace(d+1,c.childCount)||!h.type.validContent(f))return!1}let m=o.indexAfter(a),g=i&&i[0];return o.node(a).canReplaceWith(m,m,g?g.type:o.node(a+1).type)}function Js(t,n){let r=t.resolve(n),i=r.index();return Jl(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(i,i+1)}function Jl(t,n){return!!(t&&n&&!t.isLeaf&&t.canAppend(n))}function Jc(t,n,r=-1){let i=t.resolve(n);for(let o=i.depth;;o--){let a,u,s=i.index(o);if(o==i.depth?(a=i.nodeBefore,u=i.nodeAfter):r>0?(a=i.node(o+1),s++,u=i.node(o).maybeChild(s)):(a=i.node(o).maybeChild(s-1),u=i.node(o+1)),a&&!a.isTextblock&&Jl(a,u)&&i.node(o).canReplace(s,s+1))return n;if(0==o)break;n=r<0?i.before(o):i.after(o)}}function Jd(t,n,r=n,i=Yi.empty){if(n==r&&!i.size)return null;let o=t.resolve(n),a=t.resolve(r);return Jf(o,a,i)?new Je(n,r,i):new Jp(o,a,i).fit()}function Jf(t,n,r){return!r.openStart&&!r.openEnd&&t.start()==n.start()&&t.parent.canReplace(t.index(),n.index(),r.content)}Y3.jsonID("replaceAround",Jt);class Jp{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Z8.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let a=t.depth;a>0;a--)this.placed=Z8.from(t.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let n=this.mustMoveInline(),r=this.placed.size-this.depth-this.$from.depth,i=this.$from,o=this.close(n<0?this.$to:i.doc.resolve(n));if(!o)return null;let a=this.placed,u=i.depth,s=o.depth;for(;u&&s&&1==a.childCount;)a=a.firstChild.content,u--,s--;let l=new Yi(a,u,s);return n>-1?new Jt(i.pos,n,this.$to.pos,this.$to.end(),l,r):l.size||i.pos!=this.$to.pos?new Je(i.pos,o.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){t=r;break}n=o.content}for(let a=1;a<=2;a++)for(let u=1==a?t:this.unplaced.openStart;u>=0;u--){let s,l=null,c=(u?(l=Jg(this.unplaced.content,u-1).firstChild).content:this.unplaced.content).firstChild;for(let d=this.depth;d>=0;d--){let{type:f,match:p}=this.frontier[d],h,m=null;if(1==a&&(c?p.matchType(c.type)||(m=p.fillBefore(Z8.from(c),!1)):l&&f.compatibleContent(l.type)))return{sliceDepth:u,frontierDepth:d,parent:l,inject:m};if(2==a&&c&&(h=p.findWrapping(c.type)))return{sliceDepth:u,frontierDepth:d,parent:l,wrap:h};if(l&&p.matchType(l.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=Jg(t,n);return!!i.childCount&&!i.firstChild.isLeaf&&(this.unplaced=new Yi(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=Jg(t,n);if(i.childCount<=1&&n>0){let o=t.size-n<=n+i.size;this.unplaced=new Yi(Jh(t,n-1,1),n-1,o?n-1:r)}else this.unplaced=new Yi(Jh(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let a=0;a<o.length;a++)this.openFrontierNode(o[a]);let u=this.unplaced,s=r?r.content:u.content,l=u.openStart-t,c=0,d=[],{match:f,type:p}=this.frontier[n];if(i){for(let h=0;h<i.childCount;h++)d.push(i.child(h));f=f.matchFragment(i)}let m=s.size+t-(u.content.size-u.openEnd);for(;c<s.childCount;){let g=s.child(c),y=f.matchType(g.type);if(!y)break;(++c>1||0==l||g.content.size)&&(f=y,d.push(Jy(g.mark(p.allowedMarks(g.marks)),1==c?l:0,c==s.childCount?m:-1)))}let v=c==s.childCount;v||(m=-1),this.placed=Jm(this.placed,n,Z8.from(d)),this.frontier[n].match=f,v&&m<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,x=s;b<m;b++){let _=x.lastChild;this.frontier.push({type:_.type,match:_.contentMatchAt(_.childCount)}),x=_.content}this.unplaced=v?0==t?Yi.empty:new Yi(Jh(u.content,t-1,1),t-1,m<0?u.openEnd:t-1):new Yi(Jh(u.content,t,c),u.openStart,u.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!Jv(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return -1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),a=Jv(t,n,i,r,o);if(a){for(let u=n-1;u>=0;u--){let{match:s,type:l}=this.frontier[u],c=Jv(t,u,l,s,!0);if(!c||c.childCount)continue e}return{depth:n,fit:a,move:o?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Jm(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let i=t.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=Jm(this.placed,this.depth,Z8.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(Z8.empty,!0);t.childCount&&(this.placed=Jm(this.placed,this.frontier.length,t))}}function Jh(t,n,r){return 0==n?t.cutByIndex(r,t.childCount):t.replaceChild(0,t.firstChild.copy(Jh(t.firstChild.content,n-1,r)))}function Jm(t,n,r){return 0==n?t.append(r):t.replaceChild(t.childCount-1,t.lastChild.copy(Jm(t.lastChild.content,n-1,r)))}function Jg(t,n){for(let r=0;r<n;r++)t=t.firstChild.content;return t}function Jy(t,n,r){if(n<=0)return t;let i=t.content;return n>1&&(i=i.replaceChild(0,Jy(i.firstChild,n-1,1==i.childCount?r-1:0))),n>0&&(i=t.type.contentMatch.fillBefore(i).append(i),r<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(Z8.empty,!0)))),t.copy(i)}function Jv(t,n,r,i,o){let a=t.node(n),u=o?t.indexAfter(n):t.index(n);if(u==a.childCount&&!r.compatibleContent(a.type))return null;let s=i.fillBefore(a.content,!0,u);return s&&!function(t,n,r){for(let i=r;i<n.childCount;i++)if(!t.allowsMarks(n.child(i).marks))return!0;return!1}(r,a.content,u)?s:null}function Jb(t){return t.spec.defining||t.spec.definingForContent}function Jx(t,n,r,i,o){if(n<r){let a=t.firstChild;t=t.replaceChild(0,a.copy(Jx(a.content,n+1,r,i,a)))}if(n>i){let u=o.contentMatchAt(0),s=u.fillBefore(t).append(t);t=s.append(u.matchFragment(s).fillBefore(Z8.empty,!0))}return t}function J_(t,n){let r=[],i=Math.min(t.depth,n.depth);for(let o=i;o>=0;o--){let a=t.start(o);if(a<t.pos-(t.depth-o)||n.end(o)>n.pos+(n.depth-o)||t.node(o).type.spec.isolating||n.node(o).type.spec.isolating)break;(a==n.start(o)||o==t.depth&&o==n.depth&&t.parent.inlineContent&&n.parent.inlineContent&&o&&n.start(o-1)==a-1)&&r.push(o)}return r}class JS extends Y3{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return Y4.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return Y4.fromReplace(t,this.pos,this.pos+1,new Yi(Z8.from(o),0,n.isLeaf?0:1))}getMap(){return Y0.empty}invert(t){return new JS(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new JS(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if("number"!=typeof n.pos||"string"!=typeof n.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new JS(n.pos,n.attr,n.value)}}Y3.jsonID("attr",JS);let JT=class extends Error{};(JT=function t(n){let r=Error.call(this,n);return r.__proto__=t.prototype,r}).prototype=Object.create(Error.prototype),JT.prototype.constructor=JT,JT.prototype.name="TransformError";class Jw{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Y1}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new JT(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=Yi.empty){let i=Jd(this.doc,t,n,r);return i&&this.step(i),this}replaceWith(t,n,r){return this.replace(t,n,new Yi(Z8.from(r),0,0))}delete(t,n){return this.replace(t,n,Yi.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return function(t,n,r,i){if(!i.size)return t.deleteRange(n,r);let o=t.doc.resolve(n),a=t.doc.resolve(r);if(Jf(o,a,i))return t.step(new Je(n,r,i));let u=J_(o,t.doc.resolve(r));0==u[u.length-1]&&u.pop();let s=-(o.depth+1);u.unshift(s);for(let l=o.depth,c=o.pos-1;l>0;l--,c--){let d=o.node(l).type.spec;if(d.defining||d.definingAsContext||d.isolating)break;u.indexOf(l)>-1?s=l:o.before(l)==c&&u.splice(1,0,-l)}let f=u.indexOf(s),p=[],h=i.openStart;for(let m=i.content,g=0;;g++){let y=m.firstChild;if(p.push(y),g==i.openStart)break;m=y.content}for(let v=h-1;v>=0;v--){let b=p[v].type,x=Jb(b);if(x&&o.node(f).type!=b)h=v;else if(x||!b.isTextblock)break}for(let _=i.openStart;_>=0;_--){let S=(_+h+1)%(i.openStart+1),T=p[S];if(T)for(let w=0;w<u.length;w++){let O=u[(w+f)%u.length],k=!0;O<0&&(k=!1,O=-O);let C=o.node(O-1),I=o.index(O-1);if(C.canReplaceWith(I,I,T.type,T.marks))return t.replace(o.before(O),k?a.after(O):r,new Yi(Jx(i.content,0,i.openStart,S),S,i.openEnd))}}let M=t.steps.length;for(let R=u.length-1;R>=0&&(t.replace(n,r,i),!(t.steps.length>M));R--){let E=u[R];E<0||(n=o.before(E),r=a.after(E))}}(this,t,n,r),this}replaceRangeWith(t,n,r){return function(t,n,r,i){if(!i.isInline&&n==r&&t.doc.resolve(n).parent.content.size){let o=function(t,n,r){let i=t.resolve(n);if(i.parent.canReplaceWith(i.index(),i.index(),r))return n;if(0==i.parentOffset)for(let o=i.depth-1;o>=0;o--){let a=i.index(o);if(i.node(o).canReplaceWith(a,a,r))return i.before(o+1);if(a>0)return null}if(i.parentOffset==i.parent.content.size)for(let u=i.depth-1;u>=0;u--){let s=i.indexAfter(u);if(i.node(u).canReplaceWith(s,s,r))return i.after(u+1);if(s<i.node(u).childCount)break}return null}(t.doc,n,i.type);null!=o&&(n=r=o)}t.replaceRange(n,r,new Yi(Z8.from(i),0,0))}(this,t,n,r),this}deleteRange(t,n){return function(t,n,r){let i=t.doc.resolve(n),o=t.doc.resolve(r),a=J_(i,o);for(let u=0;u<a.length;u++){let s=a[u],l=u==a.length-1;if(l&&0==s||i.node(s).type.contentMatch.validEnd)return t.delete(i.start(s),o.end(s));if(s>0&&(l||i.node(s-1).canReplace(i.index(s-1),o.indexAfter(s-1))))return t.delete(i.before(s),o.after(s))}for(let c=1;c<=i.depth&&c<=o.depth;c++)if(n-i.start(c)==i.depth-c&&r>i.end(c)&&o.end(c)-r!=o.depth-c)return t.delete(i.before(c),r);t.delete(n,r)}(this,t,n),this}lift(t,n){return function(t,n,r){let{$from:i,$to:o,depth:a}=n,u=i.before(a+1),s=o.after(a+1),l=u,c=s,d=Z8.empty,f=0;for(let p=a,h=!1;p>r;p--)h||i.index(p)>0?(h=!0,d=Z8.from(i.node(p).copy(d)),f++):l--;let m=Z8.empty,g=0;for(let y=a,v=!1;y>r;y--)v||o.after(y+1)<o.end(y)?(v=!0,m=Z8.from(o.node(y).copy(m)),g++):c++;t.step(new Jt(l,c,u,s,new Yi(d.append(m),f,g),d.size-f,!0))}(this,t,n),this}join(t,n=1){return function(t,n,r){let i=new Je(n-r,n+r,Yi.empty,!0);t.step(i)}(this,t,n),this}wrap(t,n){return function(t,n,r){let i=Z8.empty;for(let o=r.length-1;o>=0;o--){if(i.size){let a=r[o].type.contentMatch.matchFragment(i);if(!a||!a.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=Z8.from(r[o].type.create(r[o].attrs,i))}let u=n.start,s=n.end;t.step(new Jt(u,s,u,s,new Yi(i,0,0),r.length,!0))}(this,t,n),this}setBlockType(t,n=t,r,i=null){return function(t,n,r,i,o){if(!i.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let a=t.steps.length;t.doc.nodesBetween(n,r,(n,r)=>{var u,s,l;let c,d;if(n.isTextblock&&!n.hasMarkup(i,o)&&(u=t.doc,s=t.mapping.slice(a).map(r),l=i,c=u.resolve(s),d=c.index(),c.parent.canReplaceWith(d,d+1,l))){t.clearIncompatible(t.mapping.slice(a).map(r,1),i);let f=t.mapping.slice(a),p=f.map(r,1),h=f.map(r+n.nodeSize,1);return t.step(new Jt(p,h,p+1,h-1,new Yi(Z8.from(i.create(o,null,n.marks)),0,0),1,!0)),!1}})}(this,t,n,r,i),this}setNodeMarkup(t,n,r=null,i){return function(t,n,r,i,o){let a=t.doc.nodeAt(n);if(!a)throw RangeError("No node at given position");r||(r=a.type);let u=r.create(i,null,o||a.marks);if(a.isLeaf)return t.replaceWith(n,n+a.nodeSize,u);if(!r.validContent(a.content))throw RangeError("Invalid content for node type "+r.name);t.step(new Jt(n,n+a.nodeSize,n+1,n+a.nodeSize-1,new Yi(Z8.from(u),0,0),1,!0))}(this,t,n,r,i),this}setNodeAttribute(t,n,r){return this.step(new JS(t,n,r)),this}addNodeMark(t,n){return this.step(new Y8(t,n)),this}removeNodeMark(t,n){if(!(n instanceof Yn)){let r=this.doc.nodeAt(t);if(!r)throw RangeError("No node at position "+t);if(!(n=n.isInSet(r.marks)))return this}return this.step(new Y7(t,n)),this}split(t,n=1,r){return function(t,n,r=1,i){let o=t.doc.resolve(n),a=Z8.empty,u=Z8.empty;for(let s=o.depth,l=o.depth-r,c=r-1;s>l;s--,c--){a=Z8.from(o.node(s).copy(a));let d=i&&i[c];u=Z8.from(d?d.type.create(d.attrs,u):o.node(s).copy(u))}t.step(new Je(n,n,new Yi(a.append(u),r,r),!0))}(this,t,n,r),this}addMark(t,n,r){var i,o,a,u;let s,l,c,d;return i=this,s=[],l=[],i.doc.nodesBetween(t,n,(i,o,a)=>{if(!i.isInline)return;let u=i.marks;if(!r.isInSet(u)&&a.type.allowsMarkType(r.type)){let f=Math.max(o,t),p=Math.min(o+i.nodeSize,n),h=r.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(h)||(c&&c.to==f&&c.mark.eq(u[m])?c.to=p:s.push(c=new Y9(f,p,u[m])));d&&d.to==f?d.to=p:l.push(d=new Y6(f,p,r))}}),s.forEach(t=>i.step(t)),l.forEach(t=>i.step(t)),this}removeMark(t,n,r){var i,o,a,u;let s,l;return i=this,s=[],l=0,i.doc.nodesBetween(t,n,(i,o)=>{if(!i.isInline)return;l++;let a=null;if(r instanceof YP){let u=i.marks,c;for(;c=r.isInSet(u);)(a||(a=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let d=Math.min(o+i.nodeSize,n);for(let f=0;f<a.length;f++){let p=a[f],h;for(let m=0;m<s.length;m++){let g=s[m];g.step==l-1&&p.eq(s[m].style)&&(h=g)}h?(h.to=d,h.step=l):s.push({style:p,from:Math.max(o,t),to:d,step:l})}}}),s.forEach(t=>i.step(new Y9(t.from,t.to,t.style))),this}clearIncompatible(t,n,r){return function(t,n,r,i=r.contentMatch){let o=t.doc.nodeAt(n),a=[],u=n+1;for(let s=0;s<o.childCount;s++){let l=o.child(s),c=u+l.nodeSize,d=i.matchType(l.type);if(d){i=d;for(let f=0;f<l.marks.length;f++)r.allowsMarkType(l.marks[f].type)||t.step(new Y9(u,c,l.marks[f]))}else a.push(new Je(u,c,Yi.empty));u=c}if(!i.validEnd){let p=i.fillBefore(Z8.empty,!0);t.replace(u,u,new Yi(p,0,0))}for(let h=a.length-1;h>=0;h--)t.step(a[h])}(this,t,n,r),this}}let JO=Object.create(null);class Jk{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new JC(t.min(n),t.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=Yi.empty){let r=n.content.lastChild,i=null;for(let o=0;o<n.openEnd;o++)i=r,r=r.lastChild;let a=t.steps.length,u=this.ranges;for(let s=0;s<u.length;s++){let{$from:l,$to:c}=u[s],d=t.mapping.slice(a);t.replaceRange(d.map(l.pos),d.map(c.pos),s?Yi.empty:n),0==s&&JF(t,a,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:a,$to:u}=i[o],s=t.mapping.slice(r),l=s.map(a.pos),c=s.map(u.pos);o?t.deleteRange(l,c):(t.replaceRangeWith(l,c,n),JF(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let i=t.parent.inlineContent?new JR(t):JL(t.node(0),t.parent,t.pos,t.index(),n,r);if(i)return i;for(let o=t.depth-1;o>=0;o--){let a=n<0?JL(t.node(0),t.node(o),t.before(o+1),t.index(o),n,r):JL(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,n,r);if(a)return a}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new JN(t.node(0))}static atStart(t){return JL(t,t,0,0,1)||new JN(t)}static atEnd(t){return JL(t,t,t.content.size,t.childCount,-1)||new JN(t)}static fromJSON(t,n){if(!n||!n.type)throw RangeError("Invalid input for Selection.fromJSON");let r=JO[n.type];if(!r)throw RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in JO)throw RangeError("Duplicate use of selection JSON ID "+t);return JO[t]=n,n.prototype.jsonID=t,n}getBookmark(){return JR.between(this.$anchor,this.$head).getBookmark()}}Jk.prototype.visible=!0;class JC{constructor(t,n){this.$from=t,this.$to=n}}let JI=!1;function JM(t){JI||t.parent.inlineContent||(JI=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class JR extends Jk{constructor(t,n=t){JM(t),JM(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Jk.near(r);let i=t.resolve(n.map(this.anchor));return new JR(i.parent.inlineContent?i:r,r)}replace(t,n=Yi.empty){if(super.replace(t,n),n==Yi.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof JR&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new JE(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if("number"!=typeof n.anchor||"number"!=typeof n.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new JR(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let i=t.resolve(n);return new this(i,r==n?i:t.resolve(r))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=Jk.findFrom(n,r,!0)||Jk.findFrom(n,-r,!0);if(!o)return Jk.near(n,r);n=o.$head}return t.parent.inlineContent||(0==i?t=n:(t=(Jk.findFrom(t,-r,!0)||Jk.findFrom(t,r,!0)).$anchor).pos<n.pos!=i<0&&(t=n)),new JR(t,n)}}Jk.jsonID("text",JR);class JE{constructor(t,n){this.anchor=t,this.head=n}map(t){return new JE(t.map(this.anchor),t.map(this.head))}resolve(t){return JR.between(t.resolve(this.anchor),t.resolve(this.head))}}class Jj extends Jk{constructor(t){let n=t.nodeAfter;super(t,t.node(0).resolve(t.pos+n.nodeSize)),this.node=n}map(t,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=t.resolve(i);return r?Jk.near(o):new Jj(o)}content(){return new Yi(Z8.from(this.node),0,0)}eq(t){return t instanceof Jj&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new JA(this.anchor)}static fromJSON(t,n){if("number"!=typeof n.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new Jj(t.resolve(n.anchor))}static create(t,n){return new Jj(t.resolve(n))}static isSelectable(t){return!t.isText&&!1!==t.type.spec.selectable}}Jj.prototype.visible=!1,Jk.jsonID("node",Jj);class JA{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new JE(r,r):new JA(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&Jj.isSelectable(r)?new Jj(n):Jk.near(n)}}class JN extends Jk{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=Yi.empty){if(n==Yi.empty){t.delete(0,t.doc.content.size);let r=Jk.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new JN(t)}map(t){return new JN(t)}eq(t){return t instanceof JN}getBookmark(){return JP}}Jk.jsonID("all",JN);let JP={map(){return this},resolve:t=>new JN(t)};function JL(t,n,r,i,o,a=!1){if(n.inlineContent)return JR.create(t,r);for(let u=i-(o>0?0:1);o>0?u<n.childCount:u>=0;u+=o){let s=n.child(u);if(s.isAtom){if(!a&&Jj.isSelectable(s))return Jj.create(t,r-(o<0?s.nodeSize:0))}else{let l=JL(t,s,r+o,o<0?s.childCount:0,o,a);if(l)return l}r+=s.nodeSize*o}return null}function JF(t,n,r){let i=t.steps.length-1;if(i<n)return;let o=t.steps[i];if(!(o instanceof Je||o instanceof Jt))return;let a;t.mapping.maps[i].forEach((t,n,r,i)=>{null==a&&(a=i)}),t.setSelection(Jk.near(t.doc.resolve(a),r))}class JD extends Jw{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=2,this}ensureMarks(t){return Yn.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(t,n){super.addStep(t,n),this.updated=-3&this.updated,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Yn.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let i=this.doc.type.schema;if(null==n)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(null==r&&(r=n),r=r??n,!t)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let a=this.doc.resolve(n);o=r==n?a.marks():a.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(t,o)),this.selection.empty||this.setSelection(Jk.near(this.selection.$to)),this}}setMeta(t,n){return this.meta["string"==typeof t?t:t.key]=n,this}getMeta(t){return this.meta["string"==typeof t?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function JW(t,n){return n&&t?t.bind(n):t}class JU{constructor(t,n,r){this.name=t,this.init=JW(n.init,r),this.apply=JW(n.apply,r)}}let Jz=[new JU("doc",{init:t=>t.doc||t.schema.topNodeType.createAndFill(),apply:t=>t.doc}),new JU("selection",{init:(t,n)=>t.selection||Jk.atStart(n.doc),apply:t=>t.selection}),new JU("storedMarks",{init:t=>t.storedMarks||null,apply:(t,n,r,i)=>i.selection.$cursor?t.storedMarks:null}),new JU("scrollToSelection",{init:()=>0,apply:(t,n)=>t.scrolledIntoView?n+1:n})];class JB{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Jz.slice(),n&&n.forEach(t=>{if(this.pluginsByKey[t.key])throw RangeError("Adding different instances of a keyed plugin ("+t.key+")");this.plugins.push(t),this.pluginsByKey[t.key]=t,t.spec.state&&this.fields.push(new JU(t.key,t.spec.state,t))})}}class JV{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),i=null;for(;;){let o=!1;for(let a=0;a<this.config.plugins.length;a++){let u=this.config.plugins[a];if(u.spec.appendTransaction){let s=i?i[a].n:0,l=i?i[a].state:this,c=s<n.length&&u.spec.appendTransaction.call(u,s?n.slice(s):n,l,r);if(c&&r.filterTransaction(c,a)){if(c.setMeta("appendedTransaction",t),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<a?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),o=!0}i&&(i[a]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let n=new JV(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(t,this[o.name],this,n)}return n}get tr(){return new JD(this)}static create(t){let n=new JB(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new JV(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(t,r);return r}reconfigure(t){let n=new JB(this.schema,t.plugins),r=n.fields,i=new JV(n);for(let o=0;o<r.length;o++){let a=r[o].name;i[a]=this.hasOwnProperty(a)?this[a]:r[o].init(t,i)}return i}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(t=>t.toJSON())),t&&"object"==typeof t)for(let r in t){if("doc"==r||"selection"==r)throw RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(t,n,r){if(!n)throw RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw RangeError("Required config field 'schema' missing");let i=new JB(t.schema,t.plugins),o=new JV(i);return i.fields.forEach(i=>{if("doc"==i.name)o.doc=Yy.fromJSON(t.schema,n.doc);else if("selection"==i.name)o.selection=Jk.fromJSON(o.doc,n.selection);else if("storedMarks"==i.name)n.storedMarks&&(o.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let a in r){let u=r[a],s=u.spec.state;if(u.key==i.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){o[i.name]=s.fromJSON.call(u,t,n[a],o);return}}o[i.name]=i.init(t,o)}}),o}}class J${constructor(t){this.spec=t,this.props={},t.props&&function t(n,r,i){for(let o in n){let a=n[o];a instanceof Function?a=a.bind(r):"handleDOMEvents"==o&&(a=t(a,r,{})),i[o]=a}return i}(t.props,this,this.props),this.key=t.key?t.key.key:JK("plugin")}getState(t){return t[this.key]}}let Jq=Object.create(null);function JK(t){return t in Jq?t+"$"+ ++Jq[t]:(Jq[t]=0,t+"$")}class JH{constructor(t="key"){this.key=JK(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}let JG=function(t){for(var n=0;;n++)if(!(t=t.previousSibling))return n},JZ=function(t){let n=t.assignedSlot||t.parentNode;return n&&11==n.nodeType?n.host:n},JY=null,JJ=function(t,n,r){let i=JY||(JY=document.createRange());return i.setEnd(t,r??t.nodeValue.length),i.setStart(t,n||0),i},JQ=function(t,n,r,i){return r&&(J0(t,n,r,i,-1)||J0(t,n,r,i,1))},JX=/^(img|br|input|textarea|hr)$/i;function J0(t,n,r,i,o){for(;;){if(t==r&&n==i)return!0;if(n==(o<0?0:J1(t))){let a=t.parentNode;if(!a||1!=a.nodeType||J2(t)||JX.test(t.nodeName)||"false"==t.contentEditable)return!1;n=JG(t)+(o<0?0:1),t=a}else{if(1!=t.nodeType||"false"==(t=t.childNodes[n+(o<0?-1:0)]).contentEditable)return!1;n=o<0?J1(t):0}}}function J1(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function J2(t){let n;for(let r=t;r&&!(n=r.pmViewDesc);r=r.parentNode);return n&&n.node&&n.node.isBlock&&(n.dom==t||n.contentDOM==t)}let J3=function(t){return t.focusNode&&JQ(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function J4(t,n){let r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=t,r.key=r.code=n,r}function J5(t,n,r){if(t.caretPositionFromPoint)try{let i=t.caretPositionFromPoint(n,r);if(i)return{node:i.offsetNode,offset:i.offset}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(n,r);if(o)return{node:o.startContainer,offset:o.startOffset}}}let J6="u">typeof navigator?navigator:null,J9="u">typeof document?document:null,J8=J6&&J6.userAgent||"",J7=/Edge\/(\d+)/.exec(J8),Qe=/MSIE \d/.exec(J8),Qt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(J8),Qn=!!(Qe||Qt||J7),Qr=Qe?document.documentMode:Qt?+Qt[1]:J7?+J7[1]:0,Qi=!Qn&&/gecko\/(\d+)/i.test(J8);Qi&&(/Firefox\/(\d+)/.exec(J8)||[0,0])[1];let Qo=!Qn&&/Chrome\/(\d+)/.exec(J8),Qa=!!Qo,Qu=Qo?+Qo[1]:0,Qs=!Qn&&!!J6&&/Apple Computer/.test(J6.vendor),Ql=Qs&&(/Mobile\/\w+/.test(J8)||!!J6&&J6.maxTouchPoints>2),Qc=Ql||!!J6&&/Mac/.test(J6.platform),Qd=!!J6&&/Win/.test(J6.platform),Qf=/Android \d/.test(J8),Qp=!!J9&&"webkitFontSmoothing"in J9.documentElement.style,Qh=Qp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Qm(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Qg(t,n){return"number"==typeof t?t:t[n]}function Qy(t){let n=t.getBoundingClientRect(),r=n.width/t.offsetWidth||1,i=n.height/t.offsetHeight||1;return{left:n.left,right:n.left+t.clientWidth*r,top:n.top,bottom:n.top+t.clientHeight*i}}function Qv(t,n,r){let i=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,a=t.dom.ownerDocument;for(let u=r||t.dom;u;u=JZ(u)){if(1!=u.nodeType)continue;let s=u,l=s==a.body,c=l?Qm(a):Qy(s),d=0,f=0;if(n.top<c.top+Qg(i,"top")?f=-(c.top-n.top+Qg(o,"top")):n.bottom>c.bottom-Qg(i,"bottom")&&(f=n.bottom-c.bottom+Qg(o,"bottom")),n.left<c.left+Qg(i,"left")?d=-(c.left-n.left+Qg(o,"left")):n.right>c.right-Qg(i,"right")&&(d=n.right-c.right+Qg(o,"right")),d||f){if(l)a.defaultView.scrollBy(d,f);else{let p=s.scrollLeft,h=s.scrollTop;f&&(s.scrollTop+=f),d&&(s.scrollLeft+=d);let m=s.scrollLeft-p,g=s.scrollTop-h;n={left:n.left-m,top:n.top-g,right:n.right-m,bottom:n.bottom-g}}}if(l)break}}function Qb(t){let n=[],r=t.ownerDocument;for(let i=t;i&&(n.push({dom:i,top:i.scrollTop,left:i.scrollLeft}),t!=r);i=JZ(i));return n}function Qx(t,n){for(let r=0;r<t.length;r++){let{dom:i,top:o,left:a}=t[r];i.scrollTop!=o+n&&(i.scrollTop=o+n),i.scrollLeft!=a&&(i.scrollLeft=a)}}let Q_=null;function QS(t,n){return t.left>=n.left-1&&t.left<=n.right+1&&t.top>=n.top-1&&t.top<=n.bottom+1}function QT(t){return t.top<t.bottom||t.left<t.right}function Qw(t,n){let r=t.getClientRects();if(r.length){let i=r[n<0?0:r.length-1];if(QT(i))return i}return Array.prototype.find.call(r,QT)||t.getBoundingClientRect()}let QO=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Qk(t,n,r){let{node:i,offset:o,atom:a}=t.docView.domFromPos(n,r<0?-1:1),u=Qp||Qi;if(3==i.nodeType){if(u&&(QO.test(i.nodeValue)||(r<0?!o:o==i.nodeValue.length))){let s=Qw(JJ(i,o,o),r);if(Qi&&o&&/\s/.test(i.nodeValue[o-1])&&o<i.nodeValue.length){let l=Qw(JJ(i,o-1,o-1),-1);if(l.top==s.top){let c=Qw(JJ(i,o,o+1),-1);if(c.top!=s.top)return QC(c,c.left<l.left)}}return s}{let d=o,f=o,p=r<0?1:-1;return r<0&&!o?(f++,p=-1):r>=0&&o==i.nodeValue.length?(d--,p=1):r<0?d--:f++,QC(Qw(JJ(i,d,f),p),p<0)}}if(!t.state.doc.resolve(n-(a||0)).parent.inlineContent){if(null==a&&o&&(r<0||o==J1(i))){let h=i.childNodes[o-1];if(1==h.nodeType)return QI(h.getBoundingClientRect(),!1)}if(null==a&&o<J1(i)){let m=i.childNodes[o];if(1==m.nodeType)return QI(m.getBoundingClientRect(),!0)}return QI(i.getBoundingClientRect(),r>=0)}if(null==a&&o&&(r<0||o==J1(i))){let g=i.childNodes[o-1],y=3==g.nodeType?JJ(g,J1(g)-(u?0:1)):1!=g.nodeType||"BR"==g.nodeName&&g.nextSibling?null:g;if(y)return QC(Qw(y,1),!1)}if(null==a&&o<J1(i)){let v=i.childNodes[o];for(;v.pmViewDesc&&v.pmViewDesc.ignoreForCoords;)v=v.nextSibling;let b=v?3==v.nodeType?JJ(v,0,u?0:1):1==v.nodeType?v:null:null;if(b)return QC(Qw(b,-1),!0)}return QC(Qw(3==i.nodeType?JJ(i):i,-r),r>=0)}function QC(t,n){if(0==t.width)return t;let r=n?t.left:t.right;return{top:t.top,bottom:t.bottom,left:r,right:r}}function QI(t,n){if(0==t.height)return t;let r=n?t.top:t.bottom;return{top:r,bottom:r,left:t.left,right:t.right}}function QM(t,n,r){let i=t.state,o=t.root.activeElement;i!=n&&t.updateState(n),o!=t.dom&&t.focus();try{return r()}finally{i!=n&&t.updateState(i),o!=t.dom&&o&&o.focus()}}let QR=/[\u0590-\u08ac]/,QE=null,Qj=null,QA=!1;class QN{constructor(t,n,r,i){this.parent=t,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=0,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==t)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,n,r){if(this.contentDOM&&this.contentDOM.contains(1==t.nodeType?t:t.parentNode)){if(r<0){let i,o;if(t==this.contentDOM)i=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}{let a,u;if(t==this.contentDOM)a=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;a=t.nextSibling}for(;a&&!((u=a.pmViewDesc)&&u.parent==this);)a=a.nextSibling;return a?this.posBeforeChild(u):this.posAtEnd}}let s;if(t==this.dom&&this.contentDOM)s=n>JG(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==n)for(let l=t;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.previousSibling)break}if(null==s&&n==t.childNodes.length)for(let c=t;;c=c.parentNode){if(c==this.dom){s=!0;break}if(c.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,i=t;i;i=i.parentNode){let o=this.getDesc(i),a;if(o&&(!n||o.node)){if(!r||!(a=o.nodeDOM)||(1==a.nodeType?a.contains(1==t.nodeType?t:t.parentNode):a==t))return o;r=!1}}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let i=t;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(t,n,r)}return -1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==t&&o!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(t<o)return i.descAt(t-r-i.border);r=o}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let a=this.children[r],u=o+a.size;if(u>t||a instanceof Qz){i=t-o;break}o=u}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof QP&&s.side>=0;r--);if(n<=0){let l,c=!0;for(;!(!(l=r?this.children[r-1]:null)||l.dom.parentNode==this.contentDOM);r--,c=!1);return l&&n&&c&&!l.border&&!l.domAtom?l.domFromPos(l.size,n):{node:this.contentDOM,offset:l?JG(l.dom)+1:0}}{let d,f=!0;for(;!(!(d=r<this.children.length?this.children[r]:null)||d.dom.parentNode==this.contentDOM);r++,f=!1);return d&&f&&!d.border&&!d.domAtom?d.domFromPos(0,n):{node:this.contentDOM,offset:d?JG(d.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(0==this.children.length)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let a=r,u=0;;u++){let s=this.children[u],l=a+s.size;if(-1==i&&t<=l){let c=a+s.border;if(t>=c&&n<=l-s.border&&s.node&&s.contentDOM&&this.contentDOM.contains(s.contentDOM))return s.parseRange(t,n,c);t=a;for(let d=u;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=JG(f.dom)+1;break}t-=f.size}-1==i&&(i=0)}if(i>-1&&(l>n||u==this.children.length-1)){n=l;for(let p=u+1;p<this.children.length;p++){let h=this.children[p];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(-1)){o=JG(h.dom);break}n+=h.size}-1==o&&(o=this.contentDOM.childNodes.length);break}a=l}return{node:this.contentDOM,from:t,to:n,fromOffset:i,toOffset:o}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return 0==n.size||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(1!=n.nodeType||r==n.childNodes.length)throw RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,i=!1){let o=Math.min(t,n),a=Math.max(t,n);for(let u=0,s=0;u<this.children.length;u++){let l=this.children[u],c=s+l.size;if(o>s&&a<c)return l.setSelection(t-s-l.border,n-s-l.border,r,i);s=c}let d=this.domFromPos(t,t?-1:1),f=n==t?d:this.domFromPos(n,n?-1:1),p=r.getSelection(),h=!1;if((Qi||Qs)&&t==n){let{node:m,offset:g}=d;if(3==m.nodeType){if((h=!!(g&&m.nodeValue[g-1]==`
|
|
@@ -89,9 +89,9 @@ img.ProseMirror-separator {
|
|
|
89
89
|
opacity: 0
|
|
90
90
|
}`,enz=class extends ee0{constructor(t={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=function(t,n){let r=document.querySelector("style[data-tiptap-style]");if(null!==r)return r;let i=document.createElement("style");return n&&i.setAttribute("nonce",n),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}(enU,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,n=!0){this.setOptions({editable:t}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,n){let r=ee9(n)?n(t,[...this.state.plugins]):[...this.state.plugins,t],i=this.state.reconfigure({plugins:r});this.view.updateState(i)}unregisterPlugin(t){if(this.isDestroyed)return;let n="string"==typeof t?`${t}$`:t.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(t=>!t.key.startsWith(n))});this.view.updateState(r)}createExtensionManager(){let t=[...this.options.enableCoreExtensions?Object.values(enW):[],...this.options.extensions].filter(t=>["extension","node","mark"].includes(null==t?void 0:t.type));this.extensionManager=new etd(t,this)}createCommandManager(){this.commandManager=new eeX({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let t=eni(this.options.content,this.schema,this.options.parseOptions),n=etD(t,this.options.autofocus);this.view=new eem(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:JV.create({doc:t,selection:n||void 0})});let r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews();let i=this.view.dom;i.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;let n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(t=>{var n;return null===(n=this.capturedTransaction)||void 0===n?void 0:n.step(t)});return}let n=this.state.apply(t),r=!this.state.selection.eq(n.selection);this.view.updateState(n),this.emit("transaction",{editor:this,transaction:t}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});let i=t.getMeta("focus"),o=t.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:t}),o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),!t.docChanged||t.getMeta("preventUpdate")||this.emit("update",{editor:this,transaction:t})}getAttributes(t){return function(t,n){let r=et4("string"==typeof n?n:n.name,t.schema);return"node"===r?function(t,n){let r=ee4(n,t.schema),{from:i,to:o}=t.selection,a=[];t.doc.nodesBetween(i,o,t=>{a.push(t)});let u=a.reverse().find(t=>t.type.name===r.name);return u?{...u.attrs}:{}}(t,n):"mark"===r?enu(t,n):{}}(this.state,t)}isActive(t,n){return function(t,n,r={}){if(!n)return etX(t,null,r)||enc(t,null,r);let i=et4(n,t.schema);return"node"===i?etX(t,n,r):"mark"===i&&enc(t,n,r)}(this.state,"string"==typeof t?t:null,"string"==typeof t?n:t)}getJSON(){return this.state.doc.toJSON()}getHTML(){return function(t,n){let r=YG.fromSchema(n).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(r),i.innerHTML}(this.state.doc.content,this.schema)}getText(t){let{blockSeparator:n=`
|
|
91
91
|
|
|
92
|
-
`,textSerializers:r={}}=t||{};return function(t,n){let r={from:0,to:t.content.size};return etm(t,r,n)}(this.state.doc,{blockSeparator:n,textSerializers:{...etg(this.schema),...r}})}get isEmpty(){return function(t){var n;let r=null===(n=t.type.createAndFill())||void 0===n?void 0:n.toJSON(),i=t.toJSON();return JSON.stringify(r)===JSON.stringify(i)}(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var t;return!(!(null===(t=this.view)||void 0===t)&&t.docView)}};function enB(t){return new eta({find:t.find,handler({state:n,range:r,match:i}){let o=ee8(t.getAttributes,void 0,i);if(!1===o||null===o)return null;let{tr:a}=n,u=i[i.length-1],s=i[0],l=r.to;if(u){let c=s.search(/\S/),d=r.from+s.indexOf(u),f=d+u.length;if(ens(r.from,r.to,n.doc).filter(n=>n.mark.type.excluded.find(r=>r===t.type&&r!==n.mark.type)).filter(t=>t.to>d).length)return null;f<r.to&&a.delete(f,r.to),d>r.from&&a.delete(r.from+c,d),l=r.from+c+u.length,a.addMark(r.from+c,l,t.type.create(o||{})),a.removeStoredMark(t.type)}}})}function enV(t){return new eta({find:t.find,handler({state:n,range:r,match:i}){let o=n.doc.resolve(r.from),a=ee8(t.getAttributes,void 0,i)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;n.tr.delete(r.from,r.to).setBlockType(r.from,r.from,t.type,a)}})}function en$(t){return new eta({find:t.find,handler({state:n,range:r,match:i,chain:o}){let a=ee8(t.getAttributes,void 0,i)||{},u=n.tr.delete(r.from,r.to),s=u.doc.resolve(r.from).blockRange(),l=s&&Jo(s,t.type,a);if(!l)return null;if(u.wrap(s,l),t.keepMarks&&t.editor){let{selection:c,storedMarks:d}=n,{splittableMarks:f}=t.editor.extensionManager,p=d||c.$to.parentOffset&&c.$from.marks();if(p){let h=p.filter(t=>f.includes(t.type.name));u.ensureMarks(h)}}if(t.keepAttributes){let m="bulletList"===t.type.name||"orderedList"===t.type.name?"listItem":"taskList";o().updateAttributes(m,a).run()}let g=u.doc.resolve(r.from-1).nodeBefore;g&&g.type===t.type&&Js(u.doc,r.from-1)&&(!t.joinPredicate||t.joinPredicate(i,g))&&u.join(r.from-1)}})}let enq=class t{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ee8(ee1(this,"addOptions",{name:this.name}))),this.storage=ee8(ee1(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(n={}){return new t(n)}configure(t={}){let n=this.extend();return n.options=etp(this.options,t),n.storage=ee8(ee1(n,"addStorage",{name:n.name,options:n.options})),n}extend(n={}){let r=new t(n);return r.parent=this,this.child=r,r.name=n.name?n.name:r.parent.name,n.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${r.name}".`),r.options=ee8(ee1(r,"addOptions",{name:r.name})),r.storage=ee8(ee1(r,"addStorage",{name:r.name,options:r.options})),r}static handleExit({editor:t,mark:n}){let{tr:r}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){let o=i.marks();if(!o.find(t=>(null==t?void 0:t.type.name)===n.name))return!1;let a=o.find(t=>(null==t?void 0:t.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}};class enK{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ee8(ee1(this,"addOptions",{name:this.name}))),this.storage=ee8(ee1(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new enK(t)}configure(t={}){let n=this.extend();return n.options=etp(this.options,t),n.storage=ee8(ee1(n,"addStorage",{name:n.name,options:n.options})),n}extend(t={}){let n=new enK(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ee8(ee1(n,"addOptions",{name:n.name})),n.storage=ee8(ee1(n,"addStorage",{name:n.name,options:n.options})),n}}class enH{constructor(t,n,r){this.isDragging=!1,this.component=t,this.editor=n.editor,this.options={stopEvent:null,ignoreMutation:null,...r},this.extension=n.extension,this.node=n.node,this.decorations=n.decorations,this.getPos=n.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var n,r,i,o,a,u,s;let{view:l}=this.editor,c=t.target,d=3===c.nodeType?null===(n=c.parentElement)||void 0===n?void 0:n.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||!(null===(r=this.contentDOM)||void 0===r)&&r.contains(c)||!d)return;let f=0,p=0;if(this.dom!==d){let h=this.dom.getBoundingClientRect(),m=d.getBoundingClientRect(),g=null!==(i=t.offsetX)&&void 0!==i?i:null===(o=t.nativeEvent)||void 0===o?void 0:o.offsetX,y=null!==(a=t.offsetY)&&void 0!==a?a:null===(u=t.nativeEvent)||void 0===u?void 0:u.offsetY;f=m.x-h.x+g,p=m.y-h.y+y}null===(s=t.dataTransfer)||void 0===s||s.setDragImage(this.dom,f,p);let v=Jj.create(l.state.doc,this.getPos()),b=l.state.tr.setSelection(v);l.dispatch(b)}stopEvent(t){var n;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:t});let r=t.target;if(!(this.dom.contains(r)&&!(!(null===(n=this.contentDOM)||void 0===n)&&n.contains(r))))return!1;let i=t.type.startsWith("drag"),o="drop"===t.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!o&&!i)return!0;let{isEditable:a}=this.editor,{isDragging:u}=this,s=!!this.node.type.spec.draggable,l=Jj.isSelectable(this.node),c="copy"===t.type,d="paste"===t.type,f="cut"===t.type,p="mousedown"===t.type;if(!s&&l&&i&&t.preventDefault(),s&&i&&!u)return t.preventDefault(),!1;if(s&&a&&!u&&p){let h=r.closest("[data-drag-handle]");h&&(this.dom===h||this.dom.contains(h))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(u||o||c||d||f||p&&l)}ignoreMutation(t){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:t}):!!this.node.isLeaf||!!this.node.isAtom||!("selection"===t.type||this.dom.contains(t.target)&&"childList"===t.type&&etW()&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(t=>t.isContentEditable))&&(this.contentDOM===t.target&&"attributes"===t.type||!this.contentDOM.contains(t.target)))}updateAttributes(t){this.editor.commands.command(({tr:n})=>{let r=this.getPos();return n.setNodeMarkup(r,void 0,{...this.node.attrs,...t}),!0})}deleteNode(){let t=this.getPos(),n=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:n})}}function enG(t){return new etl({find:t.find,handler({state:n,range:r,match:i}){let o=ee8(t.getAttributes,void 0,i);if(!1===o||null===o)return null;let{tr:a}=n,u=i[i.length-1],s=i[0],l=r.to;if(u){let c=s.search(/\S/),d=r.from+s.indexOf(u),f=d+u.length;if(ens(r.from,r.to,n.doc).filter(n=>n.mark.type.excluded.find(r=>r===t.type&&r!==n.mark.type)).filter(t=>t.to>d).length)return null;f<r.to&&a.delete(f,r.to),d>r.from&&a.delete(r.from+c,d),l=r.from+c+u.length,a.addMark(r.from+c,l,t.type.create(o||{})),a.removeStoredMark(t.type)}}})}var enZ="bottom",enY="right",enJ="left",enQ="auto",enX=["top",enZ,enY,enJ],en0="start",en1="viewport",en2="popper",en3=enX.reduce(function(t,n){return t.concat([n+"-"+en0,n+"-end"])},[]),en4=[].concat(enX,[enQ]).reduce(function(t,n){return t.concat([n,n+"-"+en0,n+"-end"])},[]),en5=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function en6(t){return t?(t.nodeName||"").toLowerCase():null}function en9(t){if(null==t)return window;if("[object Window]"!==t.toString()){var n=t.ownerDocument;return n&&n.defaultView||window}return t}function en8(t){var n=en9(t).Element;return t instanceof n||t instanceof Element}function en7(t){var n=en9(t).HTMLElement;return t instanceof n||t instanceof HTMLElement}function ere(t){if(typeof ShadowRoot>"u")return!1;var n=en9(t).ShadowRoot;return t instanceof n||t instanceof ShadowRoot}let ert={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var n=t.state;Object.keys(n.elements).forEach(function(t){var r=n.styles[t]||{},i=n.attributes[t]||{},o=n.elements[t];en7(o)&&en6(o)&&(Object.assign(o.style,r),Object.keys(i).forEach(function(t){var n=i[t];!1===n?o.removeAttribute(t):o.setAttribute(t,!0===n?"":n)}))})},effect:function(t){var n=t.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow),function(){Object.keys(n.elements).forEach(function(t){var i=n.elements[t],o=n.attributes[t]||{},a=Object.keys(n.styles.hasOwnProperty(t)?n.styles[t]:r[t]).reduce(function(t,n){return t[n]="",t},{});en7(i)&&en6(i)&&(Object.assign(i.style,a),Object.keys(o).forEach(function(t){i.removeAttribute(t)}))})}},requires:["computeStyles"]};function ern(t){return t.split("-")[0]}var err=Math.max,eri=Math.min,ero=Math.round;function era(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function eru(){return!/^((?!chrome|android).)*safari/i.test(era())}function ers(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);var i=t.getBoundingClientRect(),o=1,a=1;n&&en7(t)&&(o=t.offsetWidth>0&&ero(i.width)/t.offsetWidth||1,a=t.offsetHeight>0&&ero(i.height)/t.offsetHeight||1);var u=(en8(t)?en9(t):window).visualViewport,s=!eru()&&r,l=(i.left+(s&&u?u.offsetLeft:0))/o,c=(i.top+(s&&u?u.offsetTop:0))/a,d=i.width/o,f=i.height/a;return{width:d,height:f,top:c,right:l+d,bottom:c+f,left:l,x:l,y:c}}function erl(t){var n=ers(t),r=t.offsetWidth,i=t.offsetHeight;return 1>=Math.abs(n.width-r)&&(r=n.width),1>=Math.abs(n.height-i)&&(i=n.height),{x:t.offsetLeft,y:t.offsetTop,width:r,height:i}}function erc(t,n){var r=n.getRootNode&&n.getRootNode();if(t.contains(n))return!0;if(r&&ere(r)){var i=n;do{if(i&&t.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function erd(t){return en9(t).getComputedStyle(t)}function erf(t){return["table","td","th"].indexOf(en6(t))>=0}function erp(t){return((en8(t)?t.ownerDocument:t.document)||window.document).documentElement}function erh(t){return"html"===en6(t)?t:t.assignedSlot||t.parentNode||(ere(t)?t.host:null)||erp(t)}function erm(t){return en7(t)&&"fixed"!==erd(t).position?t.offsetParent:null}function erg(t){for(var n=en9(t),r=erm(t);r&&erf(r)&&"static"===erd(r).position;)r=erm(r);return r&&("html"===en6(r)||"body"===en6(r)&&"static"===erd(r).position)?n:r||function(t){var n=/firefox/i.test(era());if(/Trident/i.test(era())&&en7(t)&&"fixed"===erd(t).position)return null;var r=erh(t);for(ere(r)&&(r=r.host);en7(r)&&0>["html","body"].indexOf(en6(r));){var i=erd(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||n&&"filter"===i.willChange||n&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(t)||n}function ery(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function erv(t,n,r){return err(t,eri(n,r))}function erb(){return{top:0,right:0,bottom:0,left:0}}function erx(t){return Object.assign({},erb(),t)}function er_(t,n){return n.reduce(function(n,r){return n[r]=t,n},{})}function erS(t){return t.split("-")[1]}var erT={top:"auto",right:"auto",bottom:"auto",left:"auto"};function erw(t){var n,r,i=t.popper,o=t.popperRect,a=t.placement,u=t.variation,s=t.offsets,l=t.position,c=t.gpuAcceleration,d=t.adaptive,f=t.roundOffsets,p=t.isFixed,h=s.x,m=void 0===h?0:h,g=s.y,y=void 0===g?0:g,v="function"==typeof f?f({x:m,y:y}):{x:m,y:y};m=v.x,y=v.y;var b=s.hasOwnProperty("x"),x=s.hasOwnProperty("y"),_=enJ,S="top",T=window;if(d){var w=erg(i),O="clientHeight",k="clientWidth";w===en9(i)&&(w=erp(i),"static"!==erd(w).position&&"absolute"===l&&(O="scrollHeight",k="scrollWidth")),("top"===a||(a===enJ||a===enY)&&"end"===u)&&(S=enZ,y-=(p&&w===T&&T.visualViewport?T.visualViewport.height:w[O])-o.height,y*=c?1:-1),(a===enJ||("top"===a||a===enZ)&&"end"===u)&&(_=enY,m-=(p&&w===T&&T.visualViewport?T.visualViewport.width:w[k])-o.width,m*=c?1:-1)}var C,I,M,R,E,j=Object.assign({position:l},d&&erT),A=!0===f?(C={x:m,y:y},I=en9(i),M=C.x,R=C.y,{x:ero(M*(E=I.devicePixelRatio||1))/E||0,y:ero(R*E)/E||0}):{x:m,y:y};return(m=A.x,y=A.y,c)?Object.assign({},j,((n={})[S]=x?"0":"",n[_]=b?"0":"",n.transform=1>=(T.devicePixelRatio||1)?"translate("+m+"px, "+y+"px)":"translate3d("+m+"px, "+y+"px, 0)",n)):Object.assign({},j,((r={})[S]=x?y+"px":"",r[_]=b?m+"px":"",r.transform="",r))}var erO={passive:!0},erk={left:"right",right:"left",bottom:"top",top:"bottom"};function erC(t){return t.replace(/left|right|bottom|top/g,function(t){return erk[t]})}var erI={start:"end",end:"start"};function erM(t){return t.replace(/start|end/g,function(t){return erI[t]})}function erR(t){var n,r=en9(t);return{scrollLeft:r.pageXOffset,scrollTop:r.pageYOffset}}function erE(t){return ers(erp(t)).left+erR(t).scrollLeft}function erj(t){var n=erd(t),r=n.overflow,i=n.overflowX,o=n.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function erA(t,n){void 0===n&&(n=[]);var r,i=function t(n){return["html","body","#document"].indexOf(en6(n))>=0?n.ownerDocument.body:en7(n)&&erj(n)?n:t(erh(n))}(t),o=i===(null==(r=t.ownerDocument)?void 0:r.body),a=en9(i),u=o?[a].concat(a.visualViewport||[],erj(i)?i:[]):i,s=n.concat(u);return o?s:s.concat(erA(erh(u)))}function erN(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function erP(t,n,r){var i,o,a,u,s,l,c,d,f,p,h,m;return n===en1?erN(function(t,n){var r=en9(t),i=erp(t),o=r.visualViewport,a=i.clientWidth,u=i.clientHeight,s=0,l=0;if(o){a=o.width,u=o.height;var c=eru();(c||!c&&"fixed"===n)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:a,height:u,x:s+erE(t),y:l}}(t,r)):en8(n)?((a=ers(n,!1,"fixed"===r)).top=a.top+n.clientTop,a.left=a.left+n.clientLeft,a.bottom=a.top+n.clientHeight,a.right=a.left+n.clientWidth,a.width=n.clientWidth,a.height=n.clientHeight,a.x=a.left,a.y=a.top,a):erN((u=erp(t),l=erp(u),c=erR(u),d=null==(s=u.ownerDocument)?void 0:s.body,f=err(l.scrollWidth,l.clientWidth,d?d.scrollWidth:0,d?d.clientWidth:0),p=err(l.scrollHeight,l.clientHeight,d?d.scrollHeight:0,d?d.clientHeight:0),h=-c.scrollLeft+erE(u),m=-c.scrollTop,"rtl"===erd(d||l).direction&&(h+=err(l.clientWidth,d?d.clientWidth:0)-f),{width:f,height:p,x:h,y:m}))}function erL(t){var n,r=t.reference,i=t.element,o=t.placement,a=o?ern(o):null,u=o?erS(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(a){case"top":n={x:s,y:r.y-i.height};break;case enZ:n={x:s,y:r.y+r.height};break;case enY:n={x:r.x+r.width,y:l};break;case enJ:n={x:r.x-i.width,y:l};break;default:n={x:r.x,y:r.y}}var c=a?ery(a):null;if(null!=c){var d="y"===c?"height":"width";switch(u){case en0:n[c]=n[c]-(r[d]/2-i[d]/2);break;case"end":n[c]=n[c]+(r[d]/2-i[d]/2)}}return n}function erF(t,n){void 0===n&&(n={});var r,i,o,a,u,s,l,c,d,f,p=n,h=p.placement,m=void 0===h?t.placement:h,g=p.strategy,y=void 0===g?t.strategy:g,v=p.boundary,b=p.rootBoundary,x=p.elementContext,_=void 0===x?en2:x,S=p.altBoundary,T=p.padding,w=void 0===T?0:T,O=erx("number"!=typeof w?w:er_(w,enX)),k=t.rects.popper,C=t.elements[void 0!==S&&S?_===en2?"reference":en2:_],I=(r=en8(C)?C:C.contextElement||erp(t.elements.popper),d=(c=[].concat("clippingParents"===(i=void 0===v?"clippingParents":v)?(s=erA(erh(r)),l=["absolute","fixed"].indexOf(erd(r).position)>=0&&en7(r)?erg(r):r,en8(l)?s.filter(function(t){return en8(t)&&erc(t,l)&&"body"!==en6(t)}):[]):[].concat(i),[void 0===b?en1:b]))[0],(f=c.reduce(function(t,n){var i=erP(r,n,y);return t.top=err(i.top,t.top),t.right=eri(i.right,t.right),t.bottom=eri(i.bottom,t.bottom),t.left=err(i.left,t.left),t},erP(r,d,y))).width=f.right-f.left,f.height=f.bottom-f.top,f.x=f.left,f.y=f.top,f),M=ers(t.elements.reference),R=erL({reference:M,element:k,strategy:"absolute",placement:m}),E=erN(Object.assign({},k,R)),j=_===en2?E:M,A={top:I.top-j.top+O.top,bottom:j.bottom-I.bottom+O.bottom,left:I.left-j.left+O.left,right:j.right-I.right+O.right},N=t.modifiersData.offset;if(_===en2&&N){var P=N[m];Object.keys(A).forEach(function(t){var n=[enY,enZ].indexOf(t)>=0?1:-1,r=["top",enZ].indexOf(t)>=0?"y":"x";A[t]+=P[r]*n})}return A}function erD(t,n,r){return void 0===r&&(r={x:0,y:0}),{top:t.top-n.height-r.y,right:t.right-n.width+r.x,bottom:t.bottom-n.height+r.y,left:t.left-n.width-r.x}}function erW(t){return["top",enY,enZ,enJ].some(function(n){return t[n]>=0})}var erU={placement:"bottom",modifiers:[],strategy:"absolute"};function erz(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return!n.some(function(t){return!(t&&"function"==typeof t.getBoundingClientRect)})}var erB,erV,er$,erq,erK,erH,erG=(erB={defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var n=t.state,r=t.instance,i=t.options,o=i.scroll,a=void 0===o||o,u=i.resize,s=void 0===u||u,l=en9(n.elements.popper),c=[].concat(n.scrollParents.reference,n.scrollParents.popper);return a&&c.forEach(function(t){t.addEventListener("scroll",r.update,erO)}),s&&l.addEventListener("resize",r.update,erO),function(){a&&c.forEach(function(t){t.removeEventListener("scroll",r.update,erO)}),s&&l.removeEventListener("resize",r.update,erO)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var n=t.state,r=t.name;n.modifiersData[r]=erL({reference:n.rects.reference,element:n.rects.popper,strategy:"absolute",placement:n.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var n=t.state,r=t.options,i=r.gpuAcceleration,o=r.adaptive,a=r.roundOffsets,u=void 0===a||a,s={placement:ern(n.placement),variation:erS(n.placement),popper:n.elements.popper,popperRect:n.rects.popper,gpuAcceleration:void 0===i||i,isFixed:"fixed"===n.options.strategy};null!=n.modifiersData.popperOffsets&&(n.styles.popper=Object.assign({},n.styles.popper,erw(Object.assign({},s,{offsets:n.modifiersData.popperOffsets,position:n.options.strategy,adaptive:void 0===o||o,roundOffsets:u})))),null!=n.modifiersData.arrow&&(n.styles.arrow=Object.assign({},n.styles.arrow,erw(Object.assign({},s,{offsets:n.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-placement":n.placement})},data:{}},ert,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var n=t.state,r=t.options,i=t.name,o=r.offset,a=void 0===o?[0,0]:o,u=en4.reduce(function(t,r){var i,o,u,s,l,c,d,f;return t[r]=(o=n.rects,l=[enJ,"top"].indexOf(s=ern(r))>=0?-1:1,d=(c="function"==typeof a?a(Object.assign({},o,{placement:r})):a)[0],f=c[1],d=d||0,f=(f||0)*l,[enJ,enY].indexOf(s)>=0?{x:f,y:d}:{x:d,y:f}),t},{}),s=u[n.placement],l=s.x,c=s.y;null!=n.modifiersData.popperOffsets&&(n.modifiersData.popperOffsets.x+=l,n.modifiersData.popperOffsets.y+=c),n.modifiersData[i]=u}},{name:"flip",enabled:!0,phase:"main",fn:function(t){var n=t.state,r=t.options,i=t.name;if(!n.modifiersData[i]._skip){for(var o=r.mainAxis,a=void 0===o||o,u=r.altAxis,s=void 0===u||u,l=r.fallbackPlacements,c=r.padding,d=r.boundary,f=r.rootBoundary,p=r.altBoundary,h=r.flipVariations,m=void 0===h||h,g=r.allowedAutoPlacements,y=n.options.placement,v=ern(y),b=l||(v!==y&&m?function(t){if(ern(t)===enQ)return[];var n=erC(t);return[erM(t),n,erM(n)]}(y):[erC(y)]),x=[y].concat(b).reduce(function(t,r){var i,o,a,u,s,l,p,h,y,v,b,x,_,S;return t.concat(ern(r)===enQ?(o={placement:r,boundary:d,rootBoundary:f,padding:c,flipVariations:m,allowedAutoPlacements:g},u=(a=o).placement,s=a.boundary,l=a.rootBoundary,p=a.padding,h=a.flipVariations,v=void 0===(y=a.allowedAutoPlacements)?en4:y,0===(_=(x=(b=erS(u))?h?en3:en3.filter(function(t){return erS(t)===b}):enX).filter(function(t){return v.indexOf(t)>=0})).length&&(_=x),Object.keys(S=_.reduce(function(t,r){return t[r]=erF(n,{placement:r,boundary:s,rootBoundary:l,padding:p})[ern(r)],t},{})).sort(function(t,n){return S[t]-S[n]})):r)},[]),_=n.rects.reference,S=n.rects.popper,T=new Map,w=!0,O=x[0],k=0;k<x.length;k++){var C=x[k],I=ern(C),M=erS(C)===en0,R=["top",enZ].indexOf(I)>=0,E=R?"width":"height",j=erF(n,{placement:C,boundary:d,rootBoundary:f,altBoundary:p,padding:c}),A=R?M?enY:enJ:M?enZ:"top";_[E]>S[E]&&(A=erC(A));var N=erC(A),P=[];if(a&&P.push(j[I]<=0),s&&P.push(j[A]<=0,j[N]<=0),P.every(function(t){return t})){O=C,w=!1;break}T.set(C,P)}if(w)for(var L=m?3:1,F=function(t){var n=x.find(function(n){var r=T.get(n);if(r)return r.slice(0,t).every(function(t){return t})});if(n)return O=n,"break"},D=L;D>0&&"break"!==F(D);D--);n.placement!==O&&(n.modifiersData[i]._skip=!0,n.placement=O,n.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var n,r=t.state,i=t.options,o=t.name,a=i.mainAxis,u=i.altAxis,s=i.boundary,l=i.rootBoundary,c=i.altBoundary,d=i.padding,f=i.tether,p=void 0===f||f,h=i.tetherOffset,m=void 0===h?0:h,g=erF(r,{boundary:s,rootBoundary:l,padding:d,altBoundary:c}),y=ern(r.placement),v=erS(r.placement),b=!v,x=ery(y),_="x"===x?"y":"x",S=r.modifiersData.popperOffsets,T=r.rects.reference,w=r.rects.popper,O="function"==typeof m?m(Object.assign({},r.rects,{placement:r.placement})):m,k="number"==typeof O?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),C=r.modifiersData.offset?r.modifiersData.offset[r.placement]:null,I={x:0,y:0};if(S){if(void 0===a||a){var M,R="y"===x?"top":enJ,E="y"===x?enZ:enY,j="y"===x?"height":"width",A=S[x],N=A+g[R],P=A-g[E],L=p?-w[j]/2:0,F=v===en0?T[j]:w[j],D=v===en0?-w[j]:-T[j],W=r.elements.arrow,U=p&&W?erl(W):{width:0,height:0},z=r.modifiersData["arrow#persistent"]?r.modifiersData["arrow#persistent"].padding:erb(),B=z[R],V=z[E],$=erv(0,T[j],U[j]),q=b?T[j]/2-L-$-B-k.mainAxis:F-$-B-k.mainAxis,K=b?-T[j]/2+L+$+V+k.mainAxis:D+$+V+k.mainAxis,H=r.elements.arrow&&erg(r.elements.arrow),G=H?"y"===x?H.clientTop||0:H.clientLeft||0:0,Z=null!=(M=null==C?void 0:C[x])?M:0,Y=erv(p?eri(N,A+q-Z-G):N,A,p?err(P,A+K-Z):P);S[x]=Y,I[x]=Y-A}if(void 0!==u&&u){var J,Q,X,ee,et,en=S[_],er="y"===_?"height":"width",ei=en+g["x"===x?"top":enJ],eo=en-g["x"===x?enZ:enY],ea=-1!==["top",enJ].indexOf(y),eu=null!=(et=null==C?void 0:C[_])?et:0,es=ea?ei:en-T[er]-w[er]-eu+k.altAxis,el=ea?en+T[er]+w[er]-eu-k.altAxis:eo,ec=p&&ea?(ee=erv(es,en,el))>el?el:ee:erv(p?es:ei,en,p?el:eo);S[_]=ec,I[_]=ec-en}r.modifiersData[o]=I}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var n,r=t.state,i=t.name,o=t.options,a=r.elements.arrow,u=r.modifiersData.popperOffsets,s=ern(r.placement),l=ery(s),c=[enJ,enY].indexOf(s)>=0?"height":"width";if(!(!a||!u)){var d,f,p=erx("number"!=typeof(d="function"==typeof(d=o.padding)?d(Object.assign({},r.rects,{placement:r.placement})):d)?d:er_(d,enX)),h=erl(a),m=r.rects.reference[c]+r.rects.reference[l]-u[l]-r.rects.popper[c],g=u[l]-r.rects.reference[l],y=erg(a),v=y?"y"===l?y.clientHeight||0:y.clientWidth||0:0,b=p["y"===l?"top":enJ],x=v-h[c]-p["y"===l?enZ:enY],_=v/2-h[c]/2+(m/2-g/2),S=erv(b,_,x);r.modifiersData[i]=((n={})[l]=S,n.centerOffset=S-_,n)}},effect:function(t){var n=t.state,r=t.options.element,i=void 0===r?"[data-popper-arrow]":r;null==i||("string"!=typeof i||(i=n.elements.popper.querySelector(i)))&&erc(n.elements.popper,i)&&(n.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var n=t.state,r=t.name,i=n.rects.reference,o=n.rects.popper,a=n.modifiersData.preventOverflow,u=erF(n,{elementContext:"reference"}),s=erF(n,{altBoundary:!0}),l=erD(u,i),c=erD(s,o,a),d=erW(l),f=erW(c);n.modifiersData[r]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:f},n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}}]},erq=void 0===(er$=(erV=erB).defaultModifiers)?[]:er$,erH=void 0===(erK=erV.defaultOptions)?erU:erK,function(t,n,r){void 0===r&&(r=erH);var i,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},erU,erH),modifiersData:{},elements:{reference:t,popper:n},attributes:{},styles:{}},u=[],s=!1,l={state:a,setOptions:function(r){var i,o,s,d,f,p,h,m,g="function"==typeof r?r(a.options):r;c(),a.options=Object.assign({},erH,a.options,g),a.scrollParents={reference:en8(t)?erA(t):t.contextElement?erA(t.contextElement):[],popper:erA(n)};var y=(s=Object.keys(o=(i=[].concat(erq,a.options.modifiers)).reduce(function(t,n){var r=t[n.name];return t[n.name]=r?Object.assign({},r,n,{options:Object.assign({},r.options,n.options),data:Object.assign({},r.data,n.data)}):n,t},{})).map(function(t){return o[t]}),f=new Map,p=new Set,h=[],s.forEach(function(t){f.set(t.name,t)}),s.forEach(function(t){p.has(t.name)||function t(n){p.add(n.name),[].concat(n.requires||[],n.requiresIfExists||[]).forEach(function(n){if(!p.has(n)){var r=f.get(n);r&&t(r)}}),h.push(n)}(t)}),en5.reduce(function(t,n){return t.concat(h.filter(function(t){return t.phase===n}))},[]));return a.orderedModifiers=y.filter(function(t){return t.enabled}),a.orderedModifiers.forEach(function(t){var n=t.name,r=t.options,i=t.effect;if("function"==typeof i){var o=i({state:a,name:n,instance:l,options:void 0===r?{}:r}),s=function(){};u.push(o||s)}}),l.update()},forceUpdate:function(){if(!s){var t,n,r,i,o,u,c,d,f,p,h,m,g,y,v,b=a.elements,x=b.reference,_=b.popper;if(erz(x,_)){a.rects={reference:(t=x,n=erg(_),r="fixed"===a.options.strategy,d=en7(n),f=en7(n)&&(u=ero((o=(i=n).getBoundingClientRect()).width)/i.offsetWidth||1,c=ero(o.height)/i.offsetHeight||1,1!==u||1!==c),p=erp(n),h=ers(t,f,r),m={scrollLeft:0,scrollTop:0},g={x:0,y:0},(d||!d&&!r)&&(("body"!==en6(n)||erj(p))&&(m=(y=n)!==en9(y)&&en7(y)?{scrollLeft:(v=y).scrollLeft,scrollTop:v.scrollTop}:erR(y)),en7(n)?(g=ers(n,!0),g.x+=n.clientLeft,g.y+=n.clientTop):p&&(g.x=erE(p))),{x:h.left+m.scrollLeft-g.x,y:h.top+m.scrollTop-g.y,width:h.width,height:h.height}),popper:erl(_)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach(function(t){return a.modifiersData[t.name]=Object.assign({},t.data)});for(var S=0;S<a.orderedModifiers.length;S++){if(!0===a.reset){a.reset=!1,S=-1;continue}var T=a.orderedModifiers[S],w=T.fn,O=T.options,k=void 0===O?{}:O,C=T.name;"function"==typeof w&&(a=w({state:a,options:k,name:C,instance:l})||a)}}}},update:function(){return o||(o=new Promise(function(t){Promise.resolve().then(function(){o=void 0,t(new Promise(function(t){l.forceUpdate(),t(a)}))})})),o},destroy:function(){c(),s=!0}};if(!erz(t,n))return l;function c(){u.forEach(function(t){return t()}),u=[]}return l.setOptions(r).then(function(t){!s&&r.onFirstUpdate&&r.onFirstUpdate(t)}),l}),erZ="tippy-content",erY="tippy-arrow",erJ="tippy-svg-arrow",erQ={passive:!0,capture:!0},erX=function(){return document.body};function er0(t,n,r){return Array.isArray(t)?t[n]??(Array.isArray(r)?r[n]:r):t}function er1(t,n){var r=({}).toString.call(t);return 0===r.indexOf("[object")&&r.indexOf(n+"]")>-1}function er2(t,n){return"function"==typeof t?t.apply(void 0,n):t}function er3(t,n){var r;return 0===n?t:function(i){clearTimeout(r),r=setTimeout(function(){t(i)},n)}}function er4(t){return[].concat(t)}function er5(t,n){-1===t.indexOf(n)&&t.push(n)}function er6(t){return[].slice.call(t)}function er9(t){return Object.keys(t).reduce(function(n,r){return void 0!==t[r]&&(n[r]=t[r]),n},{})}function er8(){return document.createElement("div")}function er7(t){return["Element","Fragment"].some(function(n){return er1(t,n)})}function eie(t,n){t.forEach(function(t){t&&(t.style.transitionDuration=n+"ms")})}function eit(t,n){t.forEach(function(t){t&&t.setAttribute("data-state",n)})}function ein(t,n,r){var i=n+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(n){t[i](n,r)})}function eir(t,n){for(var r,i=n;i;){if(t.contains(i))return!0;i=null==i.getRootNode||null==(r=i.getRootNode())?void 0:r.host}return!1}var eii={isTouch:!1},eio=0;function eia(){eii.isTouch||(eii.isTouch=!0,window.performance&&document.addEventListener("mousemove",eiu))}function eiu(){var t=performance.now();t-eio<20&&(eii.isTouch=!1,document.removeEventListener("mousemove",eiu)),eio=t}function eis(){var t,n=document.activeElement;if(n&&n._tippy&&n._tippy.reference===n){var r=n._tippy;n.blur&&!r.state.isVisible&&n.blur()}}var eil=!!("u">typeof window&&"u">typeof document)&&!!window.msCrypto,eic=Object.assign({appendTo:erX,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),eid=Object.keys(eic),eif=function(t){Object.keys(t).forEach(function(n){eic[n]=t[n]})};function eip(t){var n=(t.plugins||[]).reduce(function(n,r){var i,o=r.name,a=r.defaultValue;return o&&(n[o]=void 0!==t[o]?t[o]:null!=(i=eic[o])?i:a),n},{});return Object.assign({},t,n)}function eih(t,n){var r,i,o=Object.assign({},n,{content:er2(n.content,[t])},n.ignoreAttributes?{}:((i=n.plugins)?Object.keys(eip(Object.assign({},eic,{plugins:i}))):eid).reduce(function(n,r){var i=(t.getAttribute("data-tippy-"+r)||"").trim();if(!i)return n;if("content"===r)n[r]=i;else try{n[r]=JSON.parse(i)}catch{n[r]=i}return n},{}));return o.aria=Object.assign({},eic.aria,o.aria),o.aria={expanded:"auto"===o.aria.expanded?n.interactive:o.aria.expanded,content:"auto"===o.aria.content?n.interactive?null:"describedby":o.aria.content},o}var eim=function(){return"innerHTML"};function eig(t,n){t[eim()]=n}function eiy(t){var n=er8();return!0===t?n.className=erY:(n.className=erJ,er7(t)?n.appendChild(t):eig(n,t)),n}function eiv(t,n){er7(n.content)?(eig(t,""),t.appendChild(n.content)):"function"!=typeof n.content&&(n.allowHTML?eig(t,n.content):t.textContent=n.content)}function eib(t){var n=t.firstElementChild,r=er6(n.children);return{box:n,content:r.find(function(t){return t.classList.contains(erZ)}),arrow:r.find(function(t){return t.classList.contains(erY)||t.classList.contains(erJ)}),backdrop:r.find(function(t){return t.classList.contains("tippy-backdrop")})}}function eix(t){var n=er8(),r=er8();r.className="tippy-box",r.setAttribute("data-state","hidden"),r.setAttribute("tabindex","-1");var i=er8();function o(r,i){var o=eib(n),a=o.box,u=o.content,s=o.arrow;i.theme?a.setAttribute("data-theme",i.theme):a.removeAttribute("data-theme"),"string"==typeof i.animation?a.setAttribute("data-animation",i.animation):a.removeAttribute("data-animation"),i.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth="number"==typeof i.maxWidth?i.maxWidth+"px":i.maxWidth,i.role?a.setAttribute("role",i.role):a.removeAttribute("role"),(r.content!==i.content||r.allowHTML!==i.allowHTML)&&eiv(u,t.props),i.arrow?s?r.arrow!==i.arrow&&(a.removeChild(s),a.appendChild(eiy(i.arrow))):a.appendChild(eiy(i.arrow)):s&&a.removeChild(s)}return i.className=erZ,i.setAttribute("data-state","hidden"),eiv(i,t.props),n.appendChild(r),r.appendChild(i),o(t.props,t.props),{popper:n,onUpdate:o}}eix.$$tippy=!0;var ei_=1,eiS=[],eiT=[];function eiw(t,n){void 0===n&&(n={});var r,i,o=eic.plugins.concat(n.plugins||[]);document.addEventListener("touchstart",eia,erQ),window.addEventListener("blur",eis);var a,u=Object.assign({},n,{plugins:o}),s=(er7(t)?[t]:er1(t,"NodeList")?er6(t):Array.isArray(t)?t:er6(document.querySelectorAll(t))).reduce(function(t,n){var r=n&&function(t,n){var r,i,o,a,u,s,l,c,d=eih(t,Object.assign({},eic,eip(er9(n)))),f=!1,p=!1,h=!1,m=!1,g=[],y=er3(G,d.interactiveDebounce),v=ei_++,b=(r=d.plugins).filter(function(t,n){return r.indexOf(t)===n}),x={id:v,reference:t,popper:er8(),popperInstance:null,props:d,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:b,clearDelayTimeouts:function(){clearTimeout(i),clearTimeout(o),cancelAnimationFrame(a)},setProps:function(n){if(!x.state.isDestroyed){N("onBeforeUpdate",[x,n]),K();var r=x.props,i=eih(t,Object.assign({},r,er9(n),{ignoreAttributes:!0}));x.props=i,q(),r.interactiveDebounce!==i.interactiveDebounce&&(F(),y=er3(G,i.interactiveDebounce)),r.triggerTarget&&!i.triggerTarget?er4(r.triggerTarget).forEach(function(t){t.removeAttribute("aria-expanded")}):i.triggerTarget&&t.removeAttribute("aria-expanded"),L(),A(),T&&T(r,i),x.popperInstance&&(Q(),ee().forEach(function(t){requestAnimationFrame(t._tippy.popperInstance.forceUpdate)})),N("onAfterUpdate",[x,n])}},setContent:function(t){x.setProps({content:t})},show:function(){var t=x.state.isVisible,n=x.state.isDestroyed,r=!x.state.isEnabled,i=eii.isTouch&&!x.props.touch,o=er0(x.props.duration,0,eic.duration);if(!(t||n||r||i)&&!M().hasAttribute("disabled")&&(N("onShow",[x],!1),!1!==x.props.onShow(x))){if(x.state.isVisible=!0,I()&&(S.style.visibility="visible"),A(),z(),x.state.isMounted||(S.style.transition="none"),I()){var a,u,s,c,d=E();eie([d.box,d.content],0)}l=function(){var t;if(!(!x.state.isVisible||m)){if(m=!0,S.offsetHeight,S.style.transition=x.props.moveTransition,I()&&x.props.animation){var n,r,i=E(),a=i.box,u=i.content;eie([a,u],o),eit([a,u],"visible")}P(),L(),er5(eiT,x),null==(t=x.popperInstance)||t.forceUpdate(),N("onMount",[x]),x.props.animation&&I()&&V(o,r=function(){x.state.isShown=!0,N("onShown",[x])})}},u=x.props.appendTo,s=M(),(a=x.props.interactive&&u===erX||"parent"===u?s.parentNode:er2(u,[s])).contains(S)||a.appendChild(S),x.state.isMounted=!0,Q()}},hide:function(){var t=!x.state.isVisible,n=x.state.isDestroyed,r=!x.state.isEnabled,i=er0(x.props.duration,1,eic.duration);if(!(t||n||r)&&(N("onHide",[x],!1),!1!==x.props.onHide(x))){if(x.state.isVisible=!1,x.state.isShown=!1,m=!1,f=!1,I()&&(S.style.visibility="hidden"),F(),B(),A(!0),I()){var o,a,u=E(),s=u.box,l=u.content;x.props.animation&&(eie([s,l],i),eit([s,l],"hidden"))}P(),L(),x.props.animation?I()&&(a=x.unmount,V(i,function(){!x.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&a()})):x.unmount()}},hideWithInteractivity:function(t){R().addEventListener("mousemove",y),er5(eiS,y),y(t)},enable:function(){x.state.isEnabled=!0},disable:function(){x.hide(),x.state.isEnabled=!1},unmount:function(){x.state.isVisible&&x.hide(),x.state.isMounted&&(X(),ee().forEach(function(t){t._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),eiT=eiT.filter(function(t){return t!==x}),x.state.isMounted=!1,N("onHidden",[x]))},destroy:function(){x.state.isDestroyed||(x.clearDelayTimeouts(),x.unmount(),K(),delete t._tippy,x.state.isDestroyed=!0,N("onDestroy",[x]))}};if(!d.render)return x;var _=d.render(x),S=_.popper,T=_.onUpdate;S.setAttribute("data-tippy-root",""),S.id="tippy-"+x.id,x.popper=S,t._tippy=x,S._tippy=x;var w=b.map(function(t){return t.fn(x)}),O=t.hasAttribute("aria-expanded");return q(),L(),A(),N("onCreate",[x]),d.showOnCreate&&et(),S.addEventListener("mouseenter",function(){x.props.interactive&&x.state.isVisible&&x.clearDelayTimeouts()}),S.addEventListener("mouseleave",function(){x.props.interactive&&x.props.trigger.indexOf("mouseenter")>=0&&R().addEventListener("mousemove",y)}),x;function k(){var t=x.props.touch;return Array.isArray(t)?t:[t,0]}function C(){return"hold"===k()[0]}function I(){var t;return!!(null!=(t=x.props.render)&&t.$$tippy)}function M(){return c||t}function R(){var t,n,r,i=M().parentNode;return i&&null!=(r=er4(i)[0])&&null!=(n=r.ownerDocument)&&n.body?r.ownerDocument:document}function E(){return eib(S)}function j(t){return x.state.isMounted&&!x.state.isVisible||eii.isTouch||u&&"focus"===u.type?0:er0(x.props.delay,t?0:1,eic.delay)}function A(t){void 0===t&&(t=!1),S.style.pointerEvents=x.props.interactive&&!t?"":"none",S.style.zIndex=""+x.props.zIndex}function N(t,n,r){if(void 0===r&&(r=!0),w.forEach(function(r){r[t]&&r[t].apply(r,n)}),r){var i;(i=x.props)[t].apply(i,n)}}function P(){var n=x.props.aria;if(n.content){var r="aria-"+n.content,i=S.id;er4(x.props.triggerTarget||t).forEach(function(t){var n=t.getAttribute(r);if(x.state.isVisible)t.setAttribute(r,n?n+" "+i:i);else{var o=n&&n.replace(i,"").trim();o?t.setAttribute(r,o):t.removeAttribute(r)}})}}function L(){!(O||!x.props.aria.expanded)&&er4(x.props.triggerTarget||t).forEach(function(t){x.props.interactive?t.setAttribute("aria-expanded",x.state.isVisible&&t===M()?"true":"false"):t.removeAttribute("aria-expanded")})}function F(){R().removeEventListener("mousemove",y),eiS=eiS.filter(function(t){return t!==y})}function D(n){if(!(eii.isTouch&&(h||"mousedown"===n.type))){var r=n.composedPath&&n.composedPath()[0]||n.target;if(!(x.props.interactive&&eir(S,r))){if(er4(x.props.triggerTarget||t).some(function(t){return eir(t,r)})){if(eii.isTouch||x.state.isVisible&&x.props.trigger.indexOf("click")>=0)return}else N("onClickOutside",[x,n]);!0===x.props.hideOnClick&&(x.clearDelayTimeouts(),x.hide(),p=!0,setTimeout(function(){p=!1}),x.state.isMounted||B())}}}function W(){h=!0}function U(){h=!1}function z(){var t=R();t.addEventListener("mousedown",D,!0),t.addEventListener("touchend",D,erQ),t.addEventListener("touchstart",U,erQ),t.addEventListener("touchmove",W,erQ)}function B(){var t=R();t.removeEventListener("mousedown",D,!0),t.removeEventListener("touchend",D,erQ),t.removeEventListener("touchstart",U,erQ),t.removeEventListener("touchmove",W,erQ)}function V(t,n){var r=E().box;function i(t){t.target===r&&(ein(r,"remove",i),n())}if(0===t)return n();ein(r,"remove",s),ein(r,"add",i),s=i}function $(n,r,i){void 0===i&&(i=!1),er4(x.props.triggerTarget||t).forEach(function(t){t.addEventListener(n,r,i),g.push({node:t,eventType:n,handler:r,options:i})})}function q(){var t;C()&&($("touchstart",H,{passive:!0}),$("touchend",Z,{passive:!0})),(t=x.props.trigger).split(/\s+/).filter(Boolean).forEach(function(t){if("manual"!==t)switch($(t,H),t){case"mouseenter":$("mouseleave",Z);break;case"focus":$(eil?"focusout":"blur",Y);break;case"focusin":$("focusout",Y)}})}function K(){g.forEach(function(t){var n=t.node,r=t.eventType,i=t.handler,o=t.options;n.removeEventListener(r,i,o)}),g=[]}function H(t){var n,r=!1;if(!(!x.state.isEnabled||J(t)||p)){var i,o=(null==(n=u)?void 0:n.type)==="focus";u=t,c=t.currentTarget,L(),!x.state.isVisible&&er1(t,"MouseEvent")&&eiS.forEach(function(n){return n(t)}),"click"===t.type&&(0>x.props.trigger.indexOf("mouseenter")||f)&&!1!==x.props.hideOnClick&&x.state.isVisible?r=!0:et(t),"click"===t.type&&(f=!r),r&&!o&&en(t)}}function G(t){var n,r,i,o,a=t.target,u=M().contains(a)||S.contains(a);!("mousemove"===t.type&&u)&&(n=ee().concat(S).map(function(t){var n,r=null==(n=t._tippy.popperInstance)?void 0:n.state;return r?{popperRect:t.getBoundingClientRect(),popperState:r,props:d}:null}).filter(Boolean),i=(r=t).clientX,o=r.clientY,n.every(function(t){var n,r=t.popperRect,a=t.popperState,u=t.props.interactiveBorder,s=(n=a.placement).split("-")[0],l=a.modifiersData.offset;if(!l)return!0;var c="bottom"===s?l.top.y:0,d="top"===s?l.bottom.y:0,f="right"===s?l.left.x:0,p="left"===s?l.right.x:0,h=r.top-o+c>u,m=o-r.bottom-d>u,g=r.left-i+f>u,y=i-r.right-p>u;return h||m||g||y})&&(F(),en(t)))}function Z(t){if(!(J(t)||x.props.trigger.indexOf("click")>=0&&f)){if(x.props.interactive){x.hideWithInteractivity(t);return}en(t)}}function Y(t){0>x.props.trigger.indexOf("focusin")&&t.target!==M()||x.props.interactive&&t.relatedTarget&&S.contains(t.relatedTarget)||en(t)}function J(t){return!!eii.isTouch&&C()!==t.type.indexOf("touch")>=0}function Q(){X();var n=x.props,r=n.popperOptions,i=n.placement,o=n.offset,a=n.getReferenceClientRect,u=n.moveTransition,s=I()?eib(S).arrow:null,c=a?{getBoundingClientRect:a,contextElement:a.contextElement||M()}:t,d=[{name:"offset",options:{offset:o}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!u}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(t){var n=t.state;if(I()){var r=E().box;["placement","reference-hidden","escaped"].forEach(function(t){"placement"===t?r.setAttribute("data-placement",n.placement):n.attributes.popper["data-popper-"+t]?r.setAttribute("data-"+t,""):r.removeAttribute("data-"+t)}),n.attributes.popper={}}}}];I()&&s&&d.push({name:"arrow",options:{element:s,padding:3}}),d.push.apply(d,(null==r?void 0:r.modifiers)||[]),x.popperInstance=erG(c,S,Object.assign({},r,{placement:i,onFirstUpdate:l,modifiers:d}))}function X(){x.popperInstance&&(x.popperInstance.destroy(),x.popperInstance=null)}function ee(){return er6(S.querySelectorAll("[data-tippy-root]"))}function et(t){x.clearDelayTimeouts(),t&&N("onTrigger",[x,t]),z();var n=j(!0),r=k(),o=r[0],a=r[1];eii.isTouch&&"hold"===o&&a&&(n=a),n?i=setTimeout(function(){x.show()},n):x.show()}function en(t){if(x.clearDelayTimeouts(),N("onUntrigger",[x,t]),!x.state.isVisible){B();return}if(!(x.props.trigger.indexOf("mouseenter")>=0&&x.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(t.type)>=0&&f)){var n=j(!1);n?o=setTimeout(function(){x.state.isVisible&&x.hide()},n):a=requestAnimationFrame(function(){x.hide()})}}}(n,u);return r&&t.push(r),t},[]);return er7(t)?s[0]:s}eiw.defaultProps=eic,eiw.setDefaultProps=eif,eiw.currentInput=eii,Object.assign({},ert,{effect:function(t){var n=t.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}}),eiw.setDefaultProps({render:eix});class eiO{constructor({editor:t,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:a}){this.preventHide=!1,this.shouldShow=({view:t,state:n,from:r,to:i})=>{let{doc:o,selection:a}=n,{empty:u}=a,s=!o.textBetween(r,i).length&&etL(n.selection),l=this.element.contains(document.activeElement);return!(!(t.hasFocus()||l)||u||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:t})=>{var n;if(this.preventHide){this.preventHide=!1;return}null!=t&&t.relatedTarget&&!(null===(n=this.element.parentNode)||void 0===n)&&n.contains(t.relatedTarget)||this.hide()},this.tippyBlurHandler=t=>{this.blurHandler({event:t})},this.handleDebouncedUpdate=(t,n)=>{let r=!(null!=n&&n.selection.eq(t.state.selection)),i=!(null!=n&&n.doc.eq(t.state.doc));(r||i)&&(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(t,r,i,n)},this.updateDelay))},this.updateHandler=(t,n,r,i)=>{var o,a,u;let{state:s,composing:l}=t,{selection:c}=s;if(l||!n&&!r)return;this.createTooltip();let{ranges:d}=c,f=Math.min(...d.map(t=>t.$from.pos)),p=Math.max(...d.map(t=>t.$to.pos));if(!(null===(o=this.shouldShow)||void 0===o?void 0:o.call(this,{editor:this.editor,view:t,state:s,oldState:i,from:f,to:p}))){this.hide();return}null===(a=this.tippy)||void 0===a||a.setProps({getReferenceClientRect:(null===(u=this.tippyOptions)||void 0===u?void 0:u.getReferenceClientRect)||(()=>{var n;if((n=s.selection)instanceof Jj){let r=t.nodeDOM(f),i=r.dataset.nodeViewWrapper?r:r.querySelector("[data-node-view-wrapper]");if(i&&(r=i.firstChild),r)return r.getBoundingClientRect()}return function(t,n,r){let i=t.state.doc.content.size,o=etF(n,0,i),a=etF(r,0,i),u=t.coordsAtPos(o),s=t.coordsAtPos(a,-1),l=Math.min(u.top,s.top),c=Math.max(u.bottom,s.bottom),d=Math.min(u.left,s.left),f=Math.max(u.right,s.right),p={top:l,bottom:c,left:d,right:f,width:f-d,height:c-l,x:d,y:l};return{...p,toJSON:()=>p}}(t,f,p)})}),this.show()},this.editor=t,this.element=n,this.view=r,this.updateDelay=o,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){let{element:t}=this.editor.options,n=!!t.parentElement;this.tippy||!n||(this.tippy=eiw(t,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(t,n){let{state:r}=t,i=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(t,n);return}let o=!(null!=n&&n.selection.eq(t.state.selection)),a=!(null!=n&&n.doc.eq(t.state.doc));this.updateHandler(t,o,a,n)}show(){var t;null===(t=this.tippy)||void 0===t||t.show()}hide(){var t;null===(t=this.tippy)||void 0===t||t.hide()}destroy(){var t,n;!(null===(t=this.tippy)||void 0===t)&&t.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),null===(n=this.tippy)||void 0===n||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}let eik=t=>new J$({key:"string"==typeof t.pluginKey?new JH(t.pluginKey):t.pluginKey,view:n=>new eiO({view:n,...t})});eth.create({name:"bubbleMenu",addOptions:()=>({element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}),addProseMirrorPlugins(){return this.options.element?[eik({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});let eiC=t=>{let[n,r]=(0,o.useState)(null);return(0,o.useEffect)(()=>{if(!n||t.editor.isDestroyed)return;let{pluginKey:r="bubbleMenu",editor:i,tippyOptions:o={},updateDelay:a,shouldShow:u=null}=t,s=eik({updateDelay:a,editor:i,element:n,pluginKey:r,shouldShow:u,tippyOptions:o});return i.registerPlugin(s),()=>i.unregisterPlugin(r)},[t.editor,n]),o.createElement("div",{ref:r,className:t.className,style:{visibility:"hidden"}},t.children)};class eiI extends enz{constructor(){super(...arguments),this.contentComponent=null}}let eiM=({renderers:t})=>o.createElement(o.Fragment,null,Object.entries(t).map(([t,n])=>x.createPortal(n.reactElement,n.element,t)));class eiR extends o.Component{constructor(t){super(t),this.editorContentRef=o.createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let{editor:t}=this.props;if(t&&t.options.element){if(t.contentComponent)return;let n=this.editorContentRef.current;n.append(...t.options.element.childNodes),t.setOptions({element:n}),t.contentComponent=this,t.createNodeViews(),this.initialized=!0}}maybeFlushSync(t){this.initialized?(0,x.flushSync)(t):t()}setRenderer(t,n){this.maybeFlushSync(()=>{this.setState(({renderers:r})=>({renderers:{...r,[t]:n}}))})}removeRenderer(t){this.maybeFlushSync(()=>{this.setState(({renderers:n})=>{let r={...n};return delete r[t],{renderers:r}})})}componentWillUnmount(){let{editor:t}=this.props;if(!t||(this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null,!t.options.element.firstChild))return;let n=document.createElement("div");n.append(...t.options.element.childNodes),t.setOptions({element:n})}render(){let{editor:t,...n}=this.props;return o.createElement(o.Fragment,null,o.createElement("div",{ref:this.editorContentRef,...n}),o.createElement(eiM,{renderers:this.state.renderers}))}}let eiE=o.memo(eiR),eij=(0,o.createContext)({onDragStart:void 0}),eiA=()=>(0,o.useContext)(eij),eiN=o.forwardRef((t,n)=>{let{onDragStart:r}=eiA(),i=t.as||"div";return o.createElement(i,{...t,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})});class eiP{constructor(t,{editor:n,props:r={},as:i="div",className:o="",attrs:a}){this.ref=null,this.id=Math.floor(4294967295*Math.random()).toString(),this.component=t,this.editor=n,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),a&&Object.keys(a).forEach(t=>{this.element.setAttribute(t,a[t])}),this.render()}render(){var t,n,r,i,a;let u=this.component,s=this.props;("function"==typeof u&&u.prototype&&u.prototype.isReactComponent||"object"==typeof u&&(null===(a=u.$$typeof)||void 0===a?void 0:a.toString())==="Symbol(react.forward_ref)")&&(s.ref=t=>{this.ref=t}),this.reactElement=o.createElement(u,{...s}),null===(n=null===(t=this.editor)||void 0===t?void 0:t.contentComponent)||void 0===n||n.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t,n;null===(n=null===(t=this.editor)||void 0===t?void 0:t.contentComponent)||void 0===n||n.removeRenderer(this.id)}}class eiL extends enH{mount(){let t={editor:this.editor,node:this.node,decorations:this.decorations,selected:!1,extension:this.extension,getPos:()=>this.getPos(),updateAttributes:(t={})=>this.updateAttributes(t),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){var n;this.component.displayName=(n=this.extension.name).charAt(0).toUpperCase()+n.substring(1)}let r=t=>{let n=this.component,r=this.onDragStart.bind(this),i=t=>{t&&this.contentDOMElement&&t.firstChild!==this.contentDOMElement&&t.appendChild(this.contentDOMElement)};return o.createElement(o.Fragment,null,o.createElement(eij.Provider,{value:{onDragStart:r,nodeViewContentRef:i}},o.createElement(n,{...t})))};r.displayName="ReactNodeView",this.contentDOMElement=this.node.isLeaf?null:document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.style.whiteSpace="inherit");let i=this.node.isInline?"span":"div";this.options.as&&(i=this.options.as);let{className:a=""}=this.options;this.renderer=new eiP(r,{editor:this.editor,props:t,as:i,className:`node-${this.node.type.name} ${a}`.trim(),attrs:this.options.attrs})}get dom(){var t;if(this.renderer.element.firstElementChild&&!(!(null===(t=this.renderer.element.firstElementChild)||void 0===t)&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}update(t,n){let r=t=>{this.renderer.updateProps(t)};if(t.type!==this.node.type)return!1;if("function"==typeof this.options.update){let i=this.node,o=this.decorations;return this.node=t,this.decorations=n,this.options.update({oldNode:i,oldDecorations:o,newNode:t,newDecorations:n,updateProps:()=>r({node:t,decorations:n})})}return t===this.node&&this.decorations===n||(this.node=t,this.decorations=n,r({node:t,decorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0})}deselectNode(){this.renderer.updateProps({selected:!1})}destroy(){this.renderer.destroy(),this.contentDOMElement=null}}function eiF(t,n){return r=>r.editor.contentComponent?new eiL(t,r,n):{}}function eiD(t){return setTimeout(()=>{t()})}function eiW(t){let{debouncedUrl:n,content:r,onContentChange:i,selected:a}=t,l=(0,o.useRef)(null),[c,d]=(0,o.useState)(!1);return(0,s.pQ)(n,()=>{var t;c&&(d(!1),null==(t=l.current)||t.reset())}),(0,v.ju)(n)?n===(null==r?void 0:r.embed_url)?M.jsx(eiz,{content:r,selected:a}):M.jsx(u.SV,{ref:l,renderError:eiU,onError:function(){d(!0),i(void 0)},children:M.jsx(o.Suspense,{fallback:r&&M.jsx(eiz,{content:r,selected:a}),children:M.jsx(eiB,{url:n,selected:a,onContentChange:i})})}):null}function eiU(){return M.jsx(u.yO,{title:"There is no embed data available."})}function eiz(t){let{content:n,selected:r}=t;return M.jsx(u.fu,{...function(t){let n="";switch(t.type){case"video":n=t.title??"";break;case"photo":n=`View this post${t.provider_name?` on ${t.provider_name}`:""}`;break;default:n=`Open${t.provider_name?` on ${t.provider_name}`:""}`}return{url:t.embed_url,thumbnail:{url:t.thumbnail_url??"",aspectRatio:"video"===t.type?"16:9":"1:1"},provider:t.provider_name??"",author:t.author_name??"",subtitle:n}}(n),selected:r})}function eiB(t){let{url:n,onContentChange:r,selected:i}=t,a=function(t){let{url:n,onContentChange:r}=t,{embedsUrl:i}=P(),a=(0,d.QT)(eiV,[n,i]),u=(0,s.R9)(r);return(0,o.useEffect)(()=>{let t=eiD(()=>u(a));return()=>{clearTimeout(t)}},[a,u]),a}({url:n,onContentChange:r});return M.jsx(eiz,{content:a,selected:i})}function eiV(t,n){var r;let i=new URL(n);return i.search=new URLSearchParams({url:t}).toString(),(0,p.WY)(i.toString(),{okType:(r=t,tj.object({type:tj.string(),version:tj.string().or(tj.number()).nullish(),title:tj.string().nullish(),author_name:tj.string().nullish(),author_url:tj.string().nullish(),provider_name:tj.string().nullish(),provider_url:tj.string().nullish(),cache_age:tj.string().or(tj.number()).nullish(),thumbnail_url:tj.string().nullish(),thumbnail_width:tj.number().nullish(),thumbnail_height:tj.number().nullish(),html:tj.string().nullish()}).passthrough().transform(t=>{let n={embed_url:r};return{...n,__TYPE__:"EmbedContent",type:t.type,version:t.version,title:t.title,author_name:t.author_name,author_url:t.author_url,provider_name:t.provider_name,provider_url:t.provider_url,cache_age:t.cache_age,thumbnail_url:t.thumbnail_url,thumbnail_width:t.thumbnail_width,thumbnail_height:t.thumbnail_height,html:t.html,all:{...n,...t}}}))})}function ei$(t){let{id:n,readOnly:r,field:i,content:a,onContentChange:l}=t,c=(0,s.$P)({initialState:(null==a?void 0:a.embed_url)??"",startTransition:o.startTransition});function d(t){c.set(t),(0,v.ju)(t)||l(void 0)}return M.jsxs(u.gN,{footer:(0,v.ju)(c.value)&&M.jsx(u.mS,{children:M.jsx(eiW,{debouncedUrl:c.debouncedValue,content:a,onContentChange:l})}),children:[M.jsx(u.fw,{name:"cloud"}),M.jsx(u.Qy,{htmlFor:n,children:Z0(i)}),M.jsx(u.JO,{children:M.jsx(Z5,{id:n,readOnly:r,placeholder:Z1(i),value:c.value,onValueChange:d,variant:(0,v.ju)(c.value)?"link":"normal",endAdornment:M.jsx(u.zx,{startIcon:"close",color:"grey",size:"small",disabled:!c,onClick:()=>d("")})})})]})}function eiq(t){return!(t.lat>85||t.lat<-85||t.lng>180||t.lng<-180)}function eiK(t){let n=t.match(/^.*@(-?\d+.\d+),(-?\d+.\d+).*$/);if(!n)return;let r=parseFloat(n[1]??""),i=parseFloat(n[2]??"");if(isNaN(r)||isNaN(i))return;let o={lat:r,lng:i};if(eiq(o))return o}function eiH(t){return t?`${t.lat}, ${t.lng}`:""}function eiG(t){let n=t.match(/\(?([\d|.|-]*)[\s+]*,[\s]*([\d|.|-]*)\)?/);if(!n)return eiK(t);let r=parseFloat(n[1]??""),i=parseFloat(n[2]??"");if(isNaN(r)||isNaN(i))return eiK(t);let o={lat:r,lng:i};return eiq(o)?o:eiK(t)}function eiZ(t){let{field:n,id:r,readOnly:i,...a}=t,{onValueChange:s,displayedValue:l,onBlur:c,clearValue:d,isValidCoordinates:f}=function(t){let{content:n,onContentChange:r}=t,i=eiH(null==n?void 0:n.position),[a,u]=(0,o.useState)(i),s=Boolean(eiG(a));return{displayedValue:a,isValidCoordinates:s,onValueChange:u,onBlur:function(){let t=eiG(a);if(!t)return u(""),r(void 0);let{lat:n,lng:i}=t;u(eiH({lat:n,lng:i})),r({__TYPE__:"GeoPointContent",position:{lat:n,lng:i}})},clearValue:function(){u(""),r(void 0)}}}(a);return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"place"}),M.jsx(u.Qy,{htmlFor:r,children:Z0(n)}),M.jsx(u.JO,{children:M.jsx(Z5,{id:r,onValueChange:s,placeholder:"...",readOnly:i,value:l,onBlur:c,variant:f?"link":"normal",endAdornment:M.jsx(u.zx,{startIcon:"close",color:"grey",size:"small",disabled:!l,onClick:d})})})]})}let eiY="__MAIN_THUMBNAIL__";function eiJ(t,n,r){let i=t.name===eiY?void 0:t.name,o;return[i,(o=n?(0,c.$)(r)?[r.width,r.height]:(0,c.$)(t.width)||(0,c.$)(t.height)?[t.width??void 0,t.height??void 0]:[n.origin.width,n.origin.height]:void 0)?`${o[0]??"auto"}x${o[1]??"auto"}px`:void 0]}function eiQ(t,n){let{width:r,height:i}=n??{};return r&&i?[r,i]:r?[r,Math.round(t.height*(r/t.width))]:i?[Math.round(t.width*(i/t.height)),i]:[t.width,t.height]}function eiX(t,n,r,i,o){let a=new URL(t);if(o){let{x:u,y:s,width:l,height:c}=n;a.searchParams.set("rect",[u,s,l,c].join(",")),a.searchParams.set("w",r.toString()),a.searchParams.set("h",i.toString())}return a.toString()}function ei0(t){let n=new URL(t);return n.searchParams.delete("q"),n.searchParams.set("w","800"),n.searchParams.set("h","800"),n.searchParams.set("auto","compress,format"),n.searchParams.set("fit","max"),n.toString()}function ei1(t){return null!=t&&t.url?ei0(t.url):void 0}function ei2(t,n){var r;let{width:i,height:o,rect:a}=function(t,n){let[r,i]=eiQ(t,n),o=Math.max(r/t.width,i/t.height),a=Math.round((t.width-r/o)/2),u=Math.round((t.height-i/o)/2);return{width:r,height:i,rect:{x:a,y:u,width:Math.round(r/o),height:Math.round(i/o)}}}({...t,width:(null==t?void 0:t.width)??2e3,height:(null==t?void 0:t.height)??2e3},n),u=Boolean((null==n?void 0:n.width)||(null==n?void 0:n.height));return{url:eiX(t.url,a,i,o,u),alt:t.alt,..."kind"in t&&"extension"in t?{credits:t.credits}:{},origin:{id:t.id,url:t.url,width:t.width??2e3,height:t.height??2e3},width:i,height:o,edit:{background:"transparent",zoom:1,crop:{x:a.x,y:a.y}}}}let ei3=tl({id:e5(),width:e6(),height:e6(),urls:tl({full:e5(),small:e5().transform(function(t){let n=new URL(t);return n.searchParams.delete("q"),n.searchParams.delete("fm"),n.searchParams.set("w","300"),n.searchParams.set("auto","compress,format"),n.toString()})}),alt_description:e5().optional(),description:e5().nullable()}),ei4=tl({results:ts(ei3)}).transform(t=>t.results);function ei5(t,n){let r=new URLSearchParams({page:"1",per_page:"28",query:n});return(0,p.WY)(`${t}/search/photos?${r.toString()}`,{okType:ei4})}function ei6(t){let{onSelectedChange:n}=t,[r,i]=(0,o.useTransition)(),a=(0,s.$P)({initialState:"",ms:300,startTransition:i});return M.jsxs(u.xu,{flexDirection:"column",gap:16,width:"100%",position:"relative",children:[M.jsx(u.CR,{value:a.value,placeholder:"Search on Unsplash.com",onValueChange:a.set}),M.jsx(u.SV,{renderError:()=>M.jsx(t1,{}),children:M.jsx(o.Suspense,{fallback:M.jsx(ei7,{}),children:M.jsx(ei9,{term:a.debouncedValue,loading:r,onSelectedChange:n})})})]})}function ei9(t){let{term:n,onSelectedChange:r,loading:i}=t,{media:a,toggleSelected:l,selectedImageId:c}=function(t){var n;let{term:r,onSelectedChange:i}=t,a=P(),u=function(t,n){let r=(0,o.useRef)(),i=P(),a=(0,d.QT)(ei5,[t,n]);return(0,s.Nr)(n,1e3,()=>{var t;r.current&&n!==r.current&&(null==(t=i.onAnalyticsEvent)||t.call(i,"Unsplash Image Searched")),r.current=n}),a}(a.unsplashUrl,r||"citrus fruit"),l=null==(n=null==u?void 0:u[0])?void 0:n.id,[c,f]=(0,o.useState)();return(0,o.useEffect)(()=>{null==i||i([]),f(void 0)},[l,i]),{media:u,toggleSelected:function(t){if(t.id===c)return f(void 0),null==i?void 0:i([]);f(t.id),null==i||i([{...t,url:t.urls.full,alt:t.alt_description}])},selectedImageId:c}}({term:n,onSelectedChange:r});return M.jsxs(M.Fragment,{children:[M.jsx(ei8,{children:null==a?void 0:a.map(t=>{let n=new URL(t.urls.full).searchParams.get("fm")??"jpg";return M.jsx(u.PB,{url:t.urls.small,filename:t.description??"Unsplash Image",selected:c===t.id,onCardClick:()=>l(t),extension:n,width:t.width,height:t.height,loading:i},t.id)})}),0===a.length&&M.jsx(j,{})]})}function ei8(t){let{children:n}=t;return M.jsx(u.xr,{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 250px), 1fr))",gap:16,paddingBottom:16,position:"relative",width:"100%"},children:n})}function ei7(){return M.jsx(ei8,{children:(0,m.N)(24,M.jsx(nt,{}))})}function eoe(t){let{open:n,onOpenChange:r,onMediaSelected:i,assetType:a}=t,[l,c]=(0,o.useState)("media"),[f,p]=(0,o.useState)(new Set),[h,m]=(0,o.useState)([]),g=f.size+h.length,y=(0,d.q_)(tL),v=P();function b(t){t||p(new Set),r(t)}(0,s.pQ)(n,()=>{n&&tW({config:v,assetType:a})});let{containerRef:x}=(0,u.VY)();return M.jsxs(u.Vq,{open:n,onOpenChange:b,size:{width:"min(calc(100% - 48px), 2000px)",height:"calc(100% - 30px)"},position:"center",onPointerDownOutside(t){x&&(0,s.DX)(x,t.target)&&t.preventDefault()},children:[M.jsx(u.fK,{icon:"image",title:"Media library"}),M.jsxs(u.Zp,{value:l,onValueChange:function(t){if("media"!==t&&"unsplash"!==t)throw Error(`Invalid option ${t}.`);c(t)},padding:"small",width:"auto",children:[M.jsx(u.T9,{value:"media",icon:"photo"}),M.jsx(u.T9,{value:"unsplash",icon:"unsplash"})]}),M.jsx(u.cZ,{children:M.jsxs(u.xu,{overflow:"hidden",backgroundColor:"grey3",padding:{top:16,right:16,left:16},minHeight:"100%",children:["media"===l&&M.jsx(nv,{assetType:a,onSelectedChange:p}),"unsplash"===l&&M.jsx(ei6,{onSelectedChange:m})]})}),M.jsx(u.kX,{asFooter:!0,ok:{text:"Add to page",onClick:function(){var t;let n=y.flatMap(t=>t.items).filter(t=>f.has(t.id)),r="media"===l?n[0]:h[0];r&&(i(r),b(!1),"unsplash"===l&&(null==(t=v.onAnalyticsEvent)||t.call(v,"Unsplash Image Added")))},disabled:1!==g,disabledTooltip:0===g?"Select a media item to add to the page":g>1?"Only one media item can be added to the page":void 0},cancel:{text:"Cancel"}})]})}function eot(t){let{onMediaSelected:n,readOnly:r,isUpdating:i}=t,[a,s]=(0,o.useState)(!1);return M.jsxs(u.aY,{children:[M.jsx(u.Zb,{color:"grey3",variant:"outlined",radius:4,children:M.jsx(u.aY,{children:M.jsx(u.xu,{padding:{block:48},flexDirection:"column",children:M.jsxs(u.R$,{children:[M.jsx(u.av,{name:"cloudUpload"}),M.jsx(u._T,{children:i?"Preparing your image...":"You haven't selected an image"}),!r&&M.jsx(u.Qj,{children:M.jsx(u.zx,{disabled:i,onClick:()=>s(!0),children:"Select image"})})]})})})}),M.jsx(eoe,{open:a,onOpenChange:s,onMediaSelected:n,assetType:"image"})]})}function eon(t){let{id:n,readOnly:r,altText:i,onValueChange:o,selected:a}=t;return M.jsxs(u.gN,{labelPosition:"side",selected:a,children:[M.jsx(u.Qy,{htmlFor:n,children:"Alt text"}),M.jsx(u.JO,{children:M.jsx(u.oi,{id:n,placeholder:"Short description for the visually impaired",readOnly:r,padding:{input:{inline:16}},value:i,onValueChange:o})})]})}d.Fs.registerFetcherConfig(ei5,{cacheCapacity:5,revalidationStrategy:{type:"never"}});let eor=({contentView:t,constraints:n,croppedImage:r})=>{let[i,o]=eiQ(t.origin,n),a=eiX(t.origin.url,r,i,o,!0);return{...t,width:i,height:o,url:a,edit:{...t.edit,zoom:r.zoom,crop:{x:r.x,y:r.y}}}},eoi=({field:t,content:n,thumbnail:r,croppedImage:i})=>{var o,a,u,s;if(r===eiY){let l=eor({contentView:n,constraints:null==(o=null==t?void 0:t.config)?void 0:o.constraint,croppedImage:i});return l.url===n.url?n:{...n,...l}}let c=null==(u=null==(a=null==t?void 0:t.config)?void 0:a.thumbnails)?void 0:u.find(t=>t.name===r),d=null==(s=n.thumbnails)?void 0:s[r];if(!c||!d)return n;let f=eor({contentView:d,constraints:c,croppedImage:i});return f.url===d.url?n:{...n,thumbnails:{...n.thumbnails,[r]:f}}},eoo=({initialSize:t,constraints:n})=>{let r=null!=n&&n.width&&null!=n&&n.height?n.width/n.height:t.width/t.height,[i,o]=t.width<t.height?[t.width,Math.round(t.width/r)]:[Math.round(t.height*r),t.height],a=Math.max(i/t.width,o/t.height,1);return{width:Math.round(i/a),height:Math.round(o/a)}},eoa=({contentView:t,constraints:n})=>{let r=eoo({initialSize:t.origin,constraints:n}),i=t.edit.zoom??1,o=Math.round(r.width/i),a=Math.round(r.height/i);return{...t.edit.crop,width:o,height:a,zoom:i}};function eou(t){let{image:n,crop:r,onCropChange:i,zoom:o,onZoomChange:a,initialCroppedArea:s,onCropAreaChange:l,aspectRatio:c}=t;return M.jsxs(u.xu,{padding:{inline:24,block:16},flexDirection:"column",gap:16,height:"100%",overflowY:"auto",alignItems:"center",children:[M.jsxs(u.xu,{gap:8,height:32,alignItems:"flex-start",width:"100%",children:[M.jsx(u.zx,{color:"grey",size:"medium",startIcon:"centerFocusWeak",onClick:()=>i(eos)}),M.jsx(u.zx,{color:"grey",size:"medium",startIcon:"zoomOutMap",onClick(){i(eos),a(eol)}})]}),M.jsx(u.fl,{image:n,aspect:c,crop:r,onCropChange:i,zoom:o,onZoomChange:a,initialCroppedAreaPixels:s,onCropAreaChange:(t,n)=>l(n)}),M.jsx(u.xu,{width:"100%",maxWidth:320,children:M.jsx(u.iR,{min:1,max:3,step:.01,value:[o],onValueChange:([t])=>a(t??1)})})]})}let eos={x:0,y:0},eol=1;function eoc(t){var n;let{trigger:r,initialImages:i}=t,{open:a,ready:s,option:l,selectedImage:c,croppedImage:d,setZoom:f,setCropArea:p,setCrop:h,setReady:m,setOption:g,initialCroppedArea:y,cropper:v,onOpenChange:b}=function(t){let{initialImages:n,initialOption:r,onClose:i}=t,[a,u]=(0,o.useState)({}),[s,l]=(0,o.useState)({}),[c,d]=(0,o.useState)(!1),[f,p]=(0,o.useState)(!1),[h,m]=(0,o.useState)(r),g=n[h],y=a[(null==g?void 0:g.thumbnail.name)??""],v=c?y??((null==g?void 0:g.contentView)&&eoa({contentView:g.contentView,constraints:g.thumbnail})):void 0,b=s[(null==g?void 0:g.thumbnail.name)??""];return{open:c,ready:f,option:h,selectedImage:g,croppedImage:y,setZoom:function(t){if(!g)return;let n=g.thumbnail.name,r=a[n]??eod;u({...a,[n]:{...r,zoom:t}})},setCropArea:function(t){if(!g)return;let n=g.thumbnail.name,r=a[n]??eod;u({...a,[n]:{...r,...t}})},setCrop:function(t){if(!g)return;let n=g.thumbnail.name,r=s[n];l({...s,[n]:{...r,crop:t}})},setReady:p,setOption:m,initialCroppedArea:v,onClose:i,cropper:b,onOpenChange:function(t){t?(m(r),u({}),l({})):(p(!1),i({option:h,croppedImages:a})),d(t)}}}(t);return M.jsxs(u.Vq,{trigger:r,onAnimationEnd:()=>m(!0),open:a,onOpenChange:b,children:[M.jsx(u.fK,{icon:"photo",title:"Image editor"}),M.jsx(u.Zp,{value:String(l),onValueChange:t=>g(Number(t)),children:i.map((t,n)=>M.jsx(u.T9,{value:String(n),icon:"photo",title:t.labels[0]??"Main",subtitle:t.labels[1]??""},t.thumbnail.name))}),c&&M.jsx(u.cZ,{children:s&&M.jsx(eou,{image:(null==(n=c.contentView)?void 0:n.origin.url)??"",crop:(null==v?void 0:v.crop)??{x:0,y:0},onCropChange:h,zoom:(null==d?void 0:d.zoom)??1,onZoomChange:f,initialCroppedArea:y,onCropAreaChange:p,aspectRatio:function(t){let{thumbnail:n,contentView:r}=t;return n.width&&n.height?n.width/n.height:r?r.origin.width/r.origin.height:1}(c)},c.thumbnail.name)})]})}let eod={x:0,y:0,width:0,height:0,zoom:1};function eof(t){var n,r;let{content:i,selected:a,fieldLabel:s,readOnly:l,imageLabel:c,onMediaSelected:d,initialImages:f,initialOption:p=0,onCropperDialogClose:h,onClear:m,children:g}=t,[v,b]=(0,o.useState)(!1),x=(null==(r=null==(n=null==i?void 0:i.url)?void 0:n.split("?")[0])?void 0:r.slice(-4))===".svg",_=null!=i&&i.url&&!l?"visible":"hidden";return M.jsxs(u.Zb,{color:a?"indigo2":"grey2",variant:a?"selected":"dashed",radius:4,children:[M.jsxs(u.Ol,{sx:{flexWrap:"wrap"},children:[M.jsxs(u.wP,{children:[M.jsx(u.xv,{noWrap:!0,children:(0,y.tx)(s,30)}),0!==c.length&&M.jsx(u.xv,{color:"grey11",noSelect:!0,children:` • ${c.join(" • ")}`})]}),M.jsxs(u.Pf,{sx:{visibility:_},children:[M.jsx(eoc,{trigger:M.jsx(u.zx,{startIcon:"crop",disabled:x,children:"Crop & Resize"}),initialImages:f,initialOption:p,onClose:h}),M.jsx(u.zx,{startIcon:"imageSearch",onClick:()=>b(!0),children:"Replace"}),M.jsx(u.zx,{onClick:m,startIcon:"delete",children:"Clear"})]})]}),g,M.jsx(eoe,{open:v,onOpenChange:b,onMediaSelected:d,assetType:"image"})]})}function eop(t){let{content:n,field:r,id:i,onContentChange:u,readOnly:s}=t,l=n&&n.origin.url.length>0,{onCropperDialogClose:d,onPageChange:f,onMediaSelected:p,isUpdating:h,page:m,thumbnail:g,allThumbnails:y,allContentViews:v,contentView:b,onClear:x}=function(t){var n;let{content:r,onContentChange:i,field:u}=t,[s,l]=(0,o.useState)(0),[c,d]=(0,o.useTransition)(),f=(n=u,(0,o.useMemo)(()=>{var t,r,i;return[{...null==(r=n.config)?void 0:r.constraint,name:eiY}].concat((null==(i=n.config)?void 0:i.thumbnails)??[])},[n])),p=f[s],h=r?function(t,n){var r,i;let{__TYPE__:o,thumbnails:a,...u}=n,s=null==(i=null==(r=t.config)?void 0:r.thumbnails)?void 0:i.map(({name:t})=>null==a?void 0:a[t]);return[u,...s??[]]}(u,r):void 0,m=null==h?void 0:h[s];return{onCropperDialogClose:function({option:t,croppedImages:n}){if(l(t),!r)return;let o=Object.entries(n).reduce((t,[n,r])=>eoi({field:u,content:t,thumbnail:n,croppedImage:r}),r);o!==r&&d(()=>i(o))},onPageChange:function(t){d(()=>l(t))},onMediaSelected:function(t){if(!p)return;let n=function(t,n,r,i){var o,u,s,l,c,d;if(!r){let f=null==(o=n.config)?void 0:o.thumbnails,p=f&&Object.fromEntries(f.map(t=>[t.name,ei2(i,t)]));return{__TYPE__:"ImageContent",...ei2(i,null==(u=n.config)?void 0:u.constraint),thumbnails:p}}if(t===eiY){let h=ei2(i,null==(s=n.config)?void 0:s.constraint);return h.url===r.url?r:{...r,...h}}let m=null==(c=null==(l=n.config)?void 0:l.thumbnails)?void 0:c.find(n=>n.name===t);if(!m)return r;let g=null==(d=r.thumbnails)?void 0:d[t],y=ei2(i,m);return y.url===(null==g?void 0:g.url)?r:{...r,thumbnails:(0,a.Q8)(r.thumbnails??{},(n,r)=>r===t?y:n)}}(p.name,u,r,t);n!==r&&d(()=>i(n))},isUpdating:c,page:s,thumbnail:p,allThumbnails:f,allContentViews:h,contentView:m,onClear:function(){null==l||l(0),i(void 0)}}}({field:r,content:n,onContentChange:u}),_=Z0(r),S=y.map((t,r)=>{let i=null==v?void 0:v[r];return{thumbnail:t,contentView:i,labels:eiJ(t,n,i)}}),T=g&&l?eiJ(g,n,b).filter(c.$):[];return M.jsx(eof,{content:n,fieldLabel:_,imageLabel:T,initialOption:m,initialImages:S,readOnly:s,onMediaSelected:p,onCropperDialogClose:d,onClear:x,children:M.jsx(o.Suspense,{fallback:M.jsx("div",{style:{height:466}}),children:g&&n&&l&&v?M.jsx(eoh,{allContentViews:v,content:n,contentView:b,id:i,onContentChange:u,onPageChange:f,page:m,readOnly:s,thumbnailName:g.name,isUpdating:h}):M.jsx(eot,{onMediaSelected:p,readOnly:s,isUpdating:h})})})}function eoh(t){let{allContentViews:n,content:r,contentView:i,id:o,onContentChange:a,onPageChange:s,page:l,readOnly:c,thumbnailName:d,isUpdating:f}=t;return M.jsxs(u.aY,{children:[M.jsx(u.lr,{getItemSource:ei1,items:n,onPageChange:s,page:l,style:{height:400},children:t=>(null==t?void 0:t.url)&&M.jsx(u.d$,{src:ei0(t.url),alt:t.alt??void 0,isUpdating:f},`${d}_${t.url}`)}),M.jsx(eon,{id:o,readOnly:c||!i,altText:(null==i?void 0:i.alt)??"",onValueChange(t){i&&a(function(t,n,r,i){let o=0===i.length?void 0:i;return t===eiY?{...n,alt:o}:{...n,thumbnails:{...n.thumbnails,[t]:{...r,alt:o}}}}(d,r,i,t))}})]})}function eom(t){let{content:n,field:r,id:i,onContentChange:o,readOnly:a}=t;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"notes"}),M.jsx(u.Qy,{htmlFor:i,children:Z0(r)}),M.jsx(u.JO,{children:M.jsx(u.Kx,{id:i,placeholder:Z1(r),readOnly:a,paddingLeft:4,paddingRight:12,sx:{flexGrow:1},value:(null==n?void 0:n.value)??"",onChange(t){var n;o((n=t,0===n.length?void 0:{__TYPE__:"FieldContent",type:"Text",value:n}))}})})]})}function eog(t,n,r,i){return(0,h.W7)(t,r,i,30,n)}function eoy(){let t=P();t.searchDocuments||F("searchDocuments");let{coreApiUrl:n,env:r}=t,i=`${n}/repository`,o=(0,d.QT)(h.Ag,[i,r]);return new Set(o.languages.map(t=>({id:t.id,label:t.name})))}function eov(){let t=P();t.searchDocuments||F("searchDocuments");let{coreApiUrl:n,env:r}=t,i=`${n}/repository`,o=(0,d.QT)(h.Mi,[i,r]);return new Set(o.results.map(t=>({id:t,label:t})))}function eob(){let t=P();t.searchDocuments||F("searchDocuments");let{customTypesApiUrl:n,env:r,repository:i}=t,o=(0,d.QT)(h.JY,[n,i,r]);return new Set(o)}function eox(t){return t?(0,g.UI)(t,t=>({id:t,label:t})):new Set}function eo_(t){let{filteredLocales:n,setFilteredLocales:r,filteredTags:i,setFilteredTags:a,filteredCustomTypes:s,setFilteredCustomTypes:l,fixedTags:c,fixedCustomTypes:d}=t;return M.jsxs(M.Fragment,{children:[M.jsx(u.SV,{children:M.jsx(o.Suspense,{fallback:M.jsx(eoS,{selectedValues:n,onSelectedValuesChange:r,label:"Locale",icon:"public",fetchFilters:eoy,multiple:!1}),children:M.jsx(eow,{selectedValues:n,onSelectedValuesChange:r})})}),M.jsx(eoS,{selectedValues:i,fixedSelectedValues:eox(c),onSelectedValuesChange:a,label:"Tags",icon:"label",fetchFilters:eov}),M.jsx(eoS,{selectedValues:s,fixedSelectedValues:eox(d),onSelectedValuesChange:l,label:"Type",icon:"description",fetchFilters:eob})]})}function eoS(t){let[n,r]=(0,o.useState)(!1),i=(0,o.useContext)(d.Nk);return M.jsx(u.SV,{renderError:()=>M.jsx(u.R0,{mode:"error",onErrorRetry:null==i?void 0:i.reset,open:n,setOpen:r,values:new Set,...t}),children:M.jsx(o.Suspense,{fallback:M.jsx(u.R0,{mode:"loading",open:n,setOpen:r,values:new Set,...t}),children:M.jsx(eoT,{open:n,setOpen:r,...t})})})}function eoT(t){let{open:n,setOpen:r,onSelectedValuesChange:i,fixedSelectedValues:o,selectedValues:a,label:s,icon:l,fetchFilters:c,multiple:d}=t,f=c();return M.jsx(u.R0,{open:n,setOpen:r,label:s,icon:l,selectedValues:a,values:new Set(f),fixedSelectedValues:o,onSelectedValuesChange:i,multiple:d})}function eow(t){let{selectedValues:n,onSelectedValuesChange:r}=t,[i,a]=(0,o.useState)((0,g.Ps)(n)),u=(0,g.sE)(eoy(),t=>{var r;return t.id===(null==(r=(0,g.Ps)(n))?void 0:r.id)});return(null==u?void 0:u.label)!==(null==i?void 0:i.label)&&a(u),M.jsx(eoS,{selectedValues:new Set(i?[i]:[]),onSelectedValuesChange:function(t){r(t),a((0,g.Ps)(t))},label:"Locale",icon:"public",fetchFilters:eoy,multiple:!1})}function eoO(t){let{onSelectDocument:n,fixedCustomTypes:r,fixedTags:i,...a}=t,l=P(),{searchTerm:c,filteredTags:d,setFilteredTags:f,filteredCustomTypes:p,setFilteredCustomTypes:h,filteredLocales:m,setFilteredLocales:y,typesFilter:v,tagsFilter:b}=function(t,n){let r=P(),i=(0,s.$P)({initialState:""}),[a,u]=(0,o.useState)(new Set),[l,c]=(0,o.useState)(new Set),[d,f]=(0,o.useState)(function(){return r.searchDocuments&&r.localeId?new Set([{id:r.localeId,label:r.localeId}]):new Set}),p=(0,g.G0)(l,eox(t)),h=(0,g.G0)(a,eox(n));return{searchTerm:i,filteredTags:a,setFilteredTags:u,filteredCustomTypes:l,setFilteredCustomTypes:c,filteredLocales:d,setFilteredLocales:f,typesFilter:p,tagsFilter:h}}(r,i),[x,_]=(0,o.useTransition)(),S=(0,s.$P)({initialState:x,ms:100}),{searchDocuments:T}=P();return M.jsx(u.Vq,{size:{height:727,width:656},hasClose:!1,...a,children:M.jsx(u.cZ,{children:M.jsxs(u.xu,{flexDirection:"column",height:"100%",children:[M.jsxs(u.xu,{padding:{top:16,inline:16},flexDirection:"column",gap:12,children:[M.jsx(u.yt,{value:c.value,onValueChange:c.set,placeholder:"Search a page",icon:"search"}),T&&M.jsx(eo_,{filteredTags:d,setFilteredTags:f,filteredCustomTypes:p,setFilteredCustomTypes:h,filteredLocales:m,setFilteredLocales:y,fixedTags:i,fixedCustomTypes:r}),M.jsx(u.xv,{variant:"smallBold",color:"grey11",children:"Link to a document"})]}),l.searchDocuments?M.jsx(u.SV,{renderError:eoC,children:M.jsx(o.Suspense,{children:M.jsx(eoI,{searchTerm:c.debouncedValue,tagsFilter:b,typesFilter:v,localesFilter:m,startTransition:_,onSelectDocument:n})})}):M.jsx(eoM,{message:"Slice Machine does not yet support mock data for linked documents in the simulator."}),M.jsx(eok,{debouncedIsLoading:S.debouncedValue})]})})})}function eok(t){return M.jsx(u.FN,{anchor:M.jsx(u.xu,{position:"relative",width:"100%",justifyContent:"center",bottom:72}),loadingIndicator:!0,open:t.debouncedIsLoading,title:"Loading more results ...",seconds:1})}function eoC(){return M.jsx(u.xu,{height:"100%",flexDirection:"column",alignItems:"center",justifyContent:"center",children:M.jsx(u.Iq,{title:"Request failed",description:"An error occurred while fetching documents.",errorImageSrc:u.Os})})}function eoI(t){let{searchTerm:n,tagsFilter:r,typesFilter:i,localesFilter:a,startTransition:s,onSelectDocument:l}=t,{documents:c,onHasReachedBottom:p}=function(t){var n,r;let{searchTerm:i,tagsFilter:a,typesFilter:u,localesFilter:s}=t,l=P();l.searchDocuments||F("searchDocuments");let{coreApiUrl:c,env:p,status:m}=l,[y,v]=(0,o.useState)(""),[b,x]=(0,o.useState)([]),[_,S]=(0,o.useState)(""),T=new URLSearchParams((0,h.fW)([{name:"tags",values:[...(0,g.UI)(a,t=>t.id)]},{name:"customTypes",values:[...(0,g.UI)(u,t=>t.id)]},{name:"language",values:[...(0,g.UI)(s,t=>t.id)]},{name:"status",values:h.Vu[m]},{name:"term",values:[i]}])).toString(),w=(0,d.QT)(eog,[c,T===_?y:"",p,T]);return T!==_?(S(T),v(""),x(w.results)):w.results.length>0&&(null==(n=(0,f.Z$)(b))?void 0:n.id)!==(null==(r=(0,f.Z$)(w.results))?void 0:r.id)&&x(t=>t.concat(w.results)),{documents:b,onHasReachedBottom:function(){w.cursor&&v(w.cursor)},response:w}}({searchTerm:n,tagsFilter:r,localesFilter:a,typesFilter:i}),m=P();return M.jsx(u.xr,{onScrollToBottom:()=>s(p),style:{height:"100%",gap:u.TV.space[16],paddingTop:u.TV.space[10],paddingBottom:u.TV.space[16],paddingInline:u.TV.space[16]},children:M.jsxs(u.xu,{flexDirection:"column",gap:12,height:"100%",children:[0===c.length&&M.jsx(eoM,{}),c.map(t=>{let n=t.versions[0];if(!n)return null;let i=(0,b.u)({documentId:t.id,versionId:"archived"===n.status?n.version_id:void 0,releaseId:"release"===n.status?n.release_id:void 0,status:n.status,env:m.env}),o=function(t){let{tags:n,tagsFilter:r}=t,i=[...r].map(t=>t.label).reverse();return(0,f.DY)(n,t=>-i.indexOf(t))}({tags:n.tags,tagsFilter:r});return M.jsx(u.z4,{documentType:n.custom_type_label,documentURL:i,description:n.preview_summary,tags:o,title:t.title,previewImageUrl:n.preview_image,onSelect:()=>l(t.id),statusColor:O[n.status].color},`${t.id}-${n.status}`)})]})})}function eoM(t){let{message:n="We can't find any versions matching this request"}=t;return M.jsx(u.xu,{justifyContent:"center",flexDirection:"column",height:"100%",children:M.jsxs(u.R$,{children:[M.jsx(u.av,{name:"close",lineColor:"purple10",backgroundColor:"purple3",borderColor:"purple6",borderStyle:"dashed",size:"xlarge"}),M.jsx(u._T,{size:"big",children:"Oops!"}),M.jsx(u.nf,{width:360,children:n})]})})}function eoR(t){let{hasLink:n,onUnlink:r,selectEnabled:i,selectedType:o,onValueChange:a,openInNewTab:s=!0,setOpenInNewTab:l}=t;return M.jsxs(M.Fragment,{children:[l&&"web"===o&&M.jsx(u.zx,{startIcon:s?"checkBox":"checkBoxOutlinedBlank",color:"grey",size:"small",onClick:()=>l(!s),children:"Open in new tab"}),M.jsxs(u.Ph,{value:o,color:"grey",size:"small",boldTriggerText:!0,startIcon:function(t){if(t)switch(t){case"document":return"description";case"web":return"public";case"media":return"image"}}(o),disabled:!i,onValueChange:a,placeholder:"Choose link type",children:[M.jsx(u.Ql,{value:"web",icon:"public",children:"Link to web page"}),M.jsx(u.Ql,{value:"document",icon:"description",children:"Link to Prismic page"}),M.jsx(u.Ql,{value:"media",icon:"image",children:"Link to media"})]}),M.jsx(u.zx,{startIcon:"close",color:"grey",size:"small",disabled:!n,onClick:r})]})}d.Fs.registerFetcherConfig(eog,{cacheCapacity:500,revalidationStrategy:{type:"never"}});let eoE={DocumentLink:"document",ExternalLink:"web",FileLink:"media",ImageLink:"media"},eoj={document:"DocumentLink",web:"ExternalLink",media:"FileLink"},eoA=tl({id:e5(),title:e5()});function eoN(t,n,r){return(0,p.WY)(`${t}/documents/${r}`,{credentials:(0,p.xb)(n),okType:eoA})}function eoP(t){var n,r,i,o,a,u;let{media:s}=t,l="kind"in s;return l&&"image"===s.kind?{__TYPE__:"LinkContent",value:{__TYPE__:"ImageLink",id:s.id,name:s.filename,url:s.url,kind:s.kind,size:s.size.toString(),height:(null==(n=s.height)?void 0:n.toString())??"2000",width:(null==(r=s.width)?void 0:r.toString())??"2000",date:(null==(i=s.last_modified)?void 0:i.toString())??""}}:l?{__TYPE__:"LinkContent",value:{__TYPE__:"FileLink",id:s.id,name:s.filename,kind:s.kind,url:s.url,size:s.size.toString(),date:(null==(o=s.last_modified)?void 0:o.toString())??""}}:{__TYPE__:"LinkContent",value:{__TYPE__:"ImageLink",id:s.id,name:(null==s?void 0:s.alt)??s.url,kind:"image",url:s.url,size:"0",height:(null==(a=s.height)?void 0:a.toString())??"2000",width:(null==(u=s.width)?void 0:u.toString())??"2000"}}}function eoL(t){var n,r;let{content:i,field:a,id:l,onContentChange:c,readOnly:d}=t,[f,p]=(0,o.useState)(!1),[h,m]=(0,o.useState)(!1),[g,y]=(0,o.useState)(!1),[b,x]=(0,o.useState)(!1),{contentType:_,fieldValue:S,errorBoundaryRef:T,onDocumentSelected:w,onError:O,onMediaSelected:k,...C}=function(t){var n;let{field:r,content:i,onContentChange:a}=t,u=i?"DocumentLink"===i.value.__TYPE__?i.value.id:"ExternalLink"===i.value.__TYPE__?i.value.url:i.value.name:"",[l,c]=(0,o.useState)(()=>{var t,n;return!(null!=(t=r.config)&&t.select)||null!=i&&i.value.__TYPE__?null==i?void 0:i.value.__TYPE__:eoj[null==(n=r.config)?void 0:n.select]}),[d,f]=(0,o.useState)(()=>(null==i?void 0:i.value.__TYPE__)==="ExternalLink"?i.value.target:""),[p,h]=(0,o.useState)(!1),m=(0,o.useRef)(null);(0,s.pQ)(u,function(){var t;p&&(h(!1),null==(t=m.current)||t.reset())});let g=l?eoE[l]:void 0;function y(t){if(!t)return a(void 0);switch(l){case"ExternalLink":return a({__TYPE__:"LinkContent",value:{__TYPE__:"ExternalLink",url:t,target:d}});case"DocumentLink":return a({__TYPE__:"LinkContent",value:{__TYPE__:"DocumentLink",id:t}});default:return a(void 0)}}function v(t){y(t)}return{contentType:l,selectType:g,fieldValue:u,onValueChange:y,onTypeChange:function(t){c(eoj[t]),y("")},placeholder:Z1(r),isTypeSelectEnabled:!(null!=(n=r.config)&&n.select),onDocumentSelected:v,onError:function(){h(!0)},errorBoundaryRef:m,isTargetNewTab:"_blank"===d,updateWebLinkTarget:function(t){let n=t?"_blank":null;f(n),a({__TYPE__:"LinkContent",value:{__TYPE__:"ExternalLink",url:u,target:n}})},onMediaSelected:function(t){a(eoP({media:t}))}}}({content:i,field:a,onContentChange:c}),I="ExternalLink"===_&&(0,v.ju)(S),R={id:l,contentType:_,onBlur:()=>p(!1),onFocus(){p(!0),"DocumentLink"===_&&y(!0),"FileLink"===_&&x(!0),"ImageLink"===_&&x(!0)},readOnly:d||!_,textType:I||"ImageLink"===_||"FileLink"===_?"link":"normal",value:S,...C},{searchDocuments:E}=P();return M.jsxs(M.Fragment,{children:[M.jsxs(u.J2,{onMouseOverChange:m,open:f||h,align:"start",sideOffset:-3,openDelay:100,closeDelay:200,focusOnEnter:!1,anchor:M.jsxs(u.gN,{onMouseOverChange:p,children:[M.jsx(u.fw,{name:"link"}),M.jsx(u.Qy,{htmlFor:l,children:Z0(a)}),M.jsx(u.JO,{children:"DocumentLink"===_&&""!==S&&E?M.jsx(eoW,{errorBoundaryRef:T,onError:O,fallback:M.jsx(eoF,{...R,value:"..."}),renderError(){var t;return t=R,M.jsx(eoF,{...t,textType:"link"})},children:M.jsx(eoD,{...R,documentId:S,openDocumentListModal:()=>y(!0)})}):M.jsx(eoF,{...R})})]}),children:[I&&M.jsx(u.oZ,{url:I,title:(0,v.S$)(I)??"",subTitle:I.toString()}),(null==i?void 0:i.value.__TYPE__)==="ImageLink"&&M.jsx(u.Qi,{url:i.value.url,title:i.value.name,subTitle:`${i.value.width} x ${i.value.height} pixels`})]}),M.jsx(eoe,{open:b,onOpenChange:x,onMediaSelected:k,assetType:"all"}),M.jsx(eoO,{open:g,onOpenChange:y,onSelectDocument(t){y(!1),w(t)},fixedCustomTypes:new Set(null==(n=a.config)?void 0:n.customtypes),fixedTags:new Set(null==(r=a.config)?void 0:r.tags)})]})}function eoF(t){let{id:n,onValueChange:r,placeholder:i,readOnly:o,value:a,textType:u,onFocus:s,onBlur:l,contentType:c,isTypeSelectEnabled:d,selectType:f,onTypeChange:p,isTargetNewTab:h,updateWebLinkTarget:m}=t,g="DocumentLink"===c||"ImageLink"===c||"FileLink"===c;return M.jsx(Z5,{id:n,onValueChange:r,placeholder:i,readOnly:o||g,value:a,variant:u,onFocus:s,onBlur:l,cursor:g?"pointer":"text",endAdornment:M.jsx(eoR,{hasLink:Boolean(a),onUnlink:()=>r(""),selectEnabled:d,selectedType:f,onValueChange:p,openInNewTab:h,setOpenInNewTab:m})})}function eoD(t){let{id:n,documentId:r,openDocumentListModal:i,onValueChange:o,isTypeSelectEnabled:a,selectType:u,onTypeChange:s}=t,l=function(t){let n=P();n.searchDocuments||F("searchDocuments");let{coreApiUrl:r,env:i}=n;return(0,d.QT)(eoN,[r,i,t]).title}(r);return M.jsx(Z5,{id:n,readOnly:!0,value:l,variant:"link",onFocus:i,cursor:"pointer",endAdornment:M.jsx(eoR,{hasLink:!0,onUnlink:()=>o(""),selectEnabled:a,selectedType:u,onValueChange:s})})}function eoW(t){let{errorBoundaryRef:n,onError:r,children:i,fallback:a,renderError:s}=t;return M.jsx(u.SV,{ref:n,onError:r,renderError:s,children:M.jsx(o.Suspense,{fallback:a,children:i})})}let eoU=({content:t,field:n,id:r,onContentChange:i,readOnly:o})=>{var a,s;let l=Number(null==t?void 0:t.value),c=Number.isFinite(l)?l:void 0;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"pin"}),M.jsx(u.Qy,{htmlFor:r,children:Z0(n)}),M.jsx(u.JO,{children:M.jsx(u.Y2,{id:r,value:c,min:null==(a=n.config)?void 0:a.min,max:null==(s=n.config)?void 0:s.max,padding:Z6,placeholder:Z1(n),readOnly:o,onValueChange(t){var n;return i((n=t,void 0===n?void 0:{__TYPE__:"FieldContent",type:"Number",value:String(n)}))}})})]})};var eoz=function(){};eoz.prototype.append=function(t){return t.length?(t=eoz.from(t),!this.length&&t||t.length<200&&this.leafAppend(t)||this.length<200&&t.leafPrepend(this)||this.appendInner(t)):this},eoz.prototype.prepend=function(t){return t.length?eoz.from(t).append(this):this},eoz.prototype.appendInner=function(t){return new eoV(this,t)},eoz.prototype.slice=function(t,n){return void 0===t&&(t=0),void 0===n&&(n=this.length),t>=n?eoz.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))},eoz.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},eoz.prototype.forEach=function(t,n,r){void 0===n&&(n=0),void 0===r&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)},eoz.prototype.map=function(t,n,r){void 0===n&&(n=0),void 0===r&&(r=this.length);var i=[];return this.forEach(function(n,r){return i.push(t(n,r))},n,r),i},eoz.from=function(t){return t instanceof eoz?t:t&&t.length?new eoB(t):eoz.empty};var eoB=function(t){function n(n){t.call(this),this.values=n}t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n;var r={length:{configurable:!0},depth:{configurable:!0}};return n.prototype.flatten=function(){return this.values},n.prototype.sliceInner=function(t,r){return 0==t&&r==this.length?this:new n(this.values.slice(t,r))},n.prototype.getInner=function(t){return this.values[t]},n.prototype.forEachInner=function(t,n,r,i){for(var o=n;o<r;o++)if(!1===t(this.values[o],i+o))return!1},n.prototype.forEachInvertedInner=function(t,n,r,i){for(var o=n-1;o>=r;o--)if(!1===t(this.values[o],i+o))return!1},n.prototype.leafAppend=function(t){if(this.length+t.length<=200)return new n(this.values.concat(t.flatten()))},n.prototype.leafPrepend=function(t){if(this.length+t.length<=200)return new n(t.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(n.prototype,r),n}(eoz);eoz.empty=new eoB([]);var eoV=function(t){function n(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},n.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},n.prototype.forEachInner=function(t,n,r,i){var o=this.left.length;if(n<o&&!1===this.left.forEachInner(t,n,Math.min(r,o),i)||r>o&&!1===this.right.forEachInner(t,Math.max(n-o,0),Math.min(this.length,r)-o,i+o))return!1},n.prototype.forEachInvertedInner=function(t,n,r,i){var o=this.left.length;if(n>o&&!1===this.right.forEachInvertedInner(t,n-o,Math.max(r,o)-o,i+o)||r<o&&!1===this.left.forEachInvertedInner(t,Math.min(n,o),r,i))return!1},n.prototype.sliceInner=function(t,n){if(0==t&&n==this.length)return this;var r=this.left.length;return n<=r?this.left.slice(t,n):t>=r?this.right.slice(t-r,n-r):this.left.slice(t,r).append(this.right.slice(0,n-r))},n.prototype.leafAppend=function(t){var r=this.right.leafAppend(t);if(r)return new n(this.left,r)},n.prototype.leafPrepend=function(t){var r=this.left.leafPrepend(t);if(r)return new n(r,this.right)},n.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new n(this.left,new n(this.right,t)):new n(this,t)},n}(eoz);class eo${constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(0==this.eventCount)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(o=(i=this.remapping(r,this.items.length)).maps.length);let a=t.tr,u,s,l=[],c=[];return this.items.forEach((t,n)=>{if(!t.step){i||(o=(i=this.remapping(r,n+1)).maps.length),o--,c.push(t);return}if(i){c.push(new eoq(t.map));let d=t.step.map(i.slice(o)),f;d&&a.maybeStep(d).doc&&(f=a.mapping.maps[a.mapping.maps.length-1],l.push(new eoq(f,void 0,void 0,l.length+c.length))),o--,f&&i.appendMap(f,o)}else a.maybeStep(t.step);if(t.selection)return u=i?t.selection.map(i.slice(o)):t.selection,s=new eo$(this.items.slice(0,r).append(c.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:s,transform:a,selection:u}}addTransform(t,n,r,i){var o,a;let u=[],s=this.eventCount,l=this.items,c=!i&&l.length?l.get(l.length-1):null;for(let d=0;d<t.steps.length;d++){let f=t.steps[d].invert(t.docs[d]),p=new eoq(t.mapping.maps[d],f,n),h;(h=c&&c.merge(p))&&(p=h,d?u.pop():l=l.slice(0,l.length-1)),u.push(p),n&&(s++,n=void 0),i||(c=p)}let m=s-r.depth,g;return m>eoH&&(o=l,a=m,l=(o.forEach((t,n)=>{if(t.selection&&0==a--)return g=n,!1}),o.slice(g)),s-=m),new eo$(l.append(u),s)}remapping(t,n){let r=new Y1;return this.items.forEach((n,i)=>{let o=null!=n.mirrorOffset&&i-n.mirrorOffset>=t?r.maps.length-n.mirrorOffset:void 0;r.appendMap(n.map,o)},t,n),r}addMaps(t){return 0==this.eventCount?this:new eo$(this.items.append(t.map(t=>new eoq(t))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=t.mapping,a=t.steps.length,u=this.eventCount;this.items.forEach(t=>{t.selection&&u--},i);let s=n;this.items.forEach(n=>{let i=o.getMirror(--s);if(null==i)return;a=Math.min(a,i);let l=o.maps[i];if(n.step){let c=t.steps[i].invert(t.docs[i]),d=n.selection&&n.selection.map(o.slice(s+1,i));d&&u++,r.push(new eoq(l,c,d))}else r.push(new eoq(l))},i);let l=[];for(let c=n;c<a;c++)l.push(new eoq(o.maps[c]));let d=this.items.slice(0,i).append(l).append(r),f=new eo$(d,u);return f.emptyItemCount()>500&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],o=0;return this.items.forEach((a,u)=>{if(u>=t)i.push(a),a.selection&&o++;else if(a.step){let s=a.step.map(n.slice(r)),l=s&&s.getMap();if(r--,l&&n.appendMap(l,r),s){let c=a.selection&&a.selection.map(n.slice(r));c&&o++;let d=new eoq(l.invert(),s,c),f,p=i.length-1;(f=i.length&&i[p].merge(d))?i[p]=f:i.push(d)}}else a.map&&r--},this.items.length,0),new eo$(eoz.from(i.reverse()),o)}}eo$.empty=new eo$(eoz.empty,0);class eoq{constructor(t,n,r,i){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new eoq(n.getMap().invert(),n,this.selection)}}}class eoK{constructor(t,n,r,i,o){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}let eoH=20;function eoG(t){let n=[];return t.forEach((t,r,i,o)=>n.push(i,o)),n}function eoZ(t,n){if(!t)return null;let r=[];for(let i=0;i<t.length;i+=2){let o=n.map(t[i],1),a=n.map(t[i+1],-1);o<=a&&r.push(o,a)}return r}function eoY(t,n,r,i){let o=eoX(n),a=eo0.get(n).spec.config,u=(i?t.undone:t.done).popEvent(n,o);if(!u)return;let s=u.selection.resolve(u.transform.doc),l=(i?t.done:t.undone).addTransform(u.transform,n.selection.getBookmark(),a,o),c=new eoK(i?l:u.remaining,i?u.remaining:l,null,0,-1);r(u.transform.setSelection(s).setMeta(eo0,{redo:i,historyState:c}).scrollIntoView())}let eoJ=!1,eoQ=null;function eoX(t){let n=t.plugins;if(eoQ!=n){eoJ=!1,eoQ=n;for(let r=0;r<n.length;r++)if(n[r].spec.historyPreserveItems){eoJ=!0;break}}return eoJ}let eo0=new JH("history"),eo1=new JH("closeHistory"),eo2=(t,n)=>{let r=eo0.getState(t);return!!r&&0!=r.done.eventCount&&(n&&eoY(r,t,n,!1),!0)},eo3=(t,n)=>{let r=eo0.getState(t);return!!r&&0!=r.undone.eventCount&&(n&&eoY(r,t,n,!0),!0)},eo4=eth.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:t,dispatch:n})=>eo2(t,n),redo:()=>({state:t,dispatch:n})=>eo3(t,n)}),addProseMirrorPlugins(){return[function(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new J$({key:eo0,state:{init:()=>new eoK(eo$.empty,eo$.empty,null,0,-1),apply:(n,r,i)=>(function(t,n,r,i){let o=r.getMeta(eo0),a;if(o)return o.historyState;r.getMeta(eo1)&&(t=new eoK(t.done,t.undone,null,0,-1));let u=r.getMeta("appendedTransaction");if(0==r.steps.length)return t;if(u&&u.getMeta(eo0))return u.getMeta(eo0).redo?new eoK(t.done.addTransform(r,void 0,i,eoX(n)),t.undone,eoG(r.mapping.maps[r.steps.length-1]),t.prevTime,t.prevComposition):new eoK(t.done,t.undone.addTransform(r,void 0,i,eoX(n)),null,t.prevTime,t.prevComposition);if(!1===r.getMeta("addToHistory")||u&&!1===u.getMeta("addToHistory"))return(a=r.getMeta("rebased"))?new eoK(t.done.rebased(r,a),t.undone.rebased(r,a),eoZ(t.prevRanges,r.mapping),t.prevTime,t.prevComposition):new eoK(t.done.addMaps(r.mapping.maps),t.undone.addMaps(r.mapping.maps),eoZ(t.prevRanges,r.mapping),t.prevTime,t.prevComposition);{let s=r.getMeta("composition"),l=0==t.prevTime||!u&&t.prevComposition!=s&&(t.prevTime<(r.time||0)-i.newGroupDelay||!function(t,n){if(!n)return!1;if(!t.docChanged)return!0;let r=!1;return t.mapping.maps[0].forEach((t,i)=>{for(let o=0;o<n.length;o+=2)t<=n[o+1]&&i>=n[o]&&(r=!0)}),r}(r,t.prevRanges)),c=u?eoZ(t.prevRanges,r.mapping):eoG(r.mapping.maps[r.steps.length-1]);return new eoK(t.done.addTransform(r,l?n.selection.getBookmark():void 0,i,eoX(n)),eo$.empty,c,r.time,s??t.prevComposition)}})(r,i,n,t)},config:t,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,i="historyUndo"==r?eo2:"historyRedo"==r?eo3:null;return!!i&&(n.preventDefault(),i(t.state,t.dispatch))}}}})}(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),eo5=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,eo6=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,eo9=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,eo8=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,eo7=enq.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!==t.style.fontWeight&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],renderHTML({HTMLAttributes:t}){return["strong",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[enB({find:eo5,type:this.type}),enB({find:eo9,type:this.type})]},addPasteRules(){return[enG({find:eo6,type:this.type}),enG({find:eo8,type:this.type})]}});var eae,eat,ean=((eae=ean||{}).Document="document",eae.Mark="mark",eae.Node="node",eae),ear=((eat=ear||{}).Text="text",eat.Embed="embed",eat.Image="image",eat);class eai{constructor(t,n,r,i,o,a=!1){w(this,"extType","node"),w(this,"nodeType","text"),this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i,this.placeholder=o,this.lockedFormat=a}}function eao(t){return t instanceof eai}class eaa extends eai{constructor(t,n,r,i,o){super(t,"heading",n,i,o),this.levels=r}}class eau extends eai{constructor(t,n,r,i){super(t,n,r,i)}}function eas(t){return t instanceof eau}let eal=enK.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:t}){return["br",ee5(this.options.HTMLAttributes,t)]},renderText:()=>`
|
|
92
|
+
`,textSerializers:r={}}=t||{};return function(t,n){let r={from:0,to:t.content.size};return etm(t,r,n)}(this.state.doc,{blockSeparator:n,textSerializers:{...etg(this.schema),...r}})}get isEmpty(){return function(t){var n;let r=null===(n=t.type.createAndFill())||void 0===n?void 0:n.toJSON(),i=t.toJSON();return JSON.stringify(r)===JSON.stringify(i)}(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var t;return!(!(null===(t=this.view)||void 0===t)&&t.docView)}};function enB(t){return new eta({find:t.find,handler({state:n,range:r,match:i}){let o=ee8(t.getAttributes,void 0,i);if(!1===o||null===o)return null;let{tr:a}=n,u=i[i.length-1],s=i[0],l=r.to;if(u){let c=s.search(/\S/),d=r.from+s.indexOf(u),f=d+u.length;if(ens(r.from,r.to,n.doc).filter(n=>n.mark.type.excluded.find(r=>r===t.type&&r!==n.mark.type)).filter(t=>t.to>d).length)return null;f<r.to&&a.delete(f,r.to),d>r.from&&a.delete(r.from+c,d),l=r.from+c+u.length,a.addMark(r.from+c,l,t.type.create(o||{})),a.removeStoredMark(t.type)}}})}function enV(t){return new eta({find:t.find,handler({state:n,range:r,match:i}){let o=n.doc.resolve(r.from),a=ee8(t.getAttributes,void 0,i)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;n.tr.delete(r.from,r.to).setBlockType(r.from,r.from,t.type,a)}})}function en$(t){return new eta({find:t.find,handler({state:n,range:r,match:i,chain:o}){let a=ee8(t.getAttributes,void 0,i)||{},u=n.tr.delete(r.from,r.to),s=u.doc.resolve(r.from).blockRange(),l=s&&Jo(s,t.type,a);if(!l)return null;if(u.wrap(s,l),t.keepMarks&&t.editor){let{selection:c,storedMarks:d}=n,{splittableMarks:f}=t.editor.extensionManager,p=d||c.$to.parentOffset&&c.$from.marks();if(p){let h=p.filter(t=>f.includes(t.type.name));u.ensureMarks(h)}}if(t.keepAttributes){let m="bulletList"===t.type.name||"orderedList"===t.type.name?"listItem":"taskList";o().updateAttributes(m,a).run()}let g=u.doc.resolve(r.from-1).nodeBefore;g&&g.type===t.type&&Js(u.doc,r.from-1)&&(!t.joinPredicate||t.joinPredicate(i,g))&&u.join(r.from-1)}})}let enq=class t{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ee8(ee1(this,"addOptions",{name:this.name}))),this.storage=ee8(ee1(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(n={}){return new t(n)}configure(t={}){let n=this.extend();return n.options=etp(this.options,t),n.storage=ee8(ee1(n,"addStorage",{name:n.name,options:n.options})),n}extend(n={}){let r=new t(n);return r.parent=this,this.child=r,r.name=n.name?n.name:r.parent.name,n.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${r.name}".`),r.options=ee8(ee1(r,"addOptions",{name:r.name})),r.storage=ee8(ee1(r,"addStorage",{name:r.name,options:r.options})),r}static handleExit({editor:t,mark:n}){let{tr:r}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){let o=i.marks();if(!o.find(t=>(null==t?void 0:t.type.name)===n.name))return!1;let a=o.find(t=>(null==t?void 0:t.type.name)===n.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}};class enK{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=ee8(ee1(this,"addOptions",{name:this.name}))),this.storage=ee8(ee1(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new enK(t)}configure(t={}){let n=this.extend();return n.options=etp(this.options,t),n.storage=ee8(ee1(n,"addStorage",{name:n.name,options:n.options})),n}extend(t={}){let n=new enK(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=ee8(ee1(n,"addOptions",{name:n.name})),n.storage=ee8(ee1(n,"addStorage",{name:n.name,options:n.options})),n}}class enH{constructor(t,n,r){this.isDragging=!1,this.component=t,this.editor=n.editor,this.options={stopEvent:null,ignoreMutation:null,...r},this.extension=n.extension,this.node=n.node,this.decorations=n.decorations,this.getPos=n.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var n,r,i,o,a,u,s;let{view:l}=this.editor,c=t.target,d=3===c.nodeType?null===(n=c.parentElement)||void 0===n?void 0:n.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||!(null===(r=this.contentDOM)||void 0===r)&&r.contains(c)||!d)return;let f=0,p=0;if(this.dom!==d){let h=this.dom.getBoundingClientRect(),m=d.getBoundingClientRect(),g=null!==(i=t.offsetX)&&void 0!==i?i:null===(o=t.nativeEvent)||void 0===o?void 0:o.offsetX,y=null!==(a=t.offsetY)&&void 0!==a?a:null===(u=t.nativeEvent)||void 0===u?void 0:u.offsetY;f=m.x-h.x+g,p=m.y-h.y+y}null===(s=t.dataTransfer)||void 0===s||s.setDragImage(this.dom,f,p);let v=Jj.create(l.state.doc,this.getPos()),b=l.state.tr.setSelection(v);l.dispatch(b)}stopEvent(t){var n;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:t});let r=t.target;if(!(this.dom.contains(r)&&!(!(null===(n=this.contentDOM)||void 0===n)&&n.contains(r))))return!1;let i=t.type.startsWith("drag"),o="drop"===t.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!o&&!i)return!0;let{isEditable:a}=this.editor,{isDragging:u}=this,s=!!this.node.type.spec.draggable,l=Jj.isSelectable(this.node),c="copy"===t.type,d="paste"===t.type,f="cut"===t.type,p="mousedown"===t.type;if(!s&&l&&i&&t.preventDefault(),s&&i&&!u)return t.preventDefault(),!1;if(s&&a&&!u&&p){let h=r.closest("[data-drag-handle]");h&&(this.dom===h||this.dom.contains(h))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(u||o||c||d||f||p&&l)}ignoreMutation(t){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:t}):!!this.node.isLeaf||!!this.node.isAtom||!("selection"===t.type||this.dom.contains(t.target)&&"childList"===t.type&&etW()&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(t=>t.isContentEditable))&&(this.contentDOM===t.target&&"attributes"===t.type||!this.contentDOM.contains(t.target)))}updateAttributes(t){this.editor.commands.command(({tr:n})=>{let r=this.getPos();return n.setNodeMarkup(r,void 0,{...this.node.attrs,...t}),!0})}deleteNode(){let t=this.getPos(),n=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:n})}}function enG(t){return new etl({find:t.find,handler({state:n,range:r,match:i}){let o=ee8(t.getAttributes,void 0,i);if(!1===o||null===o)return null;let{tr:a}=n,u=i[i.length-1],s=i[0],l=r.to;if(u){let c=s.search(/\S/),d=r.from+s.indexOf(u),f=d+u.length;if(ens(r.from,r.to,n.doc).filter(n=>n.mark.type.excluded.find(r=>r===t.type&&r!==n.mark.type)).filter(t=>t.to>d).length)return null;f<r.to&&a.delete(f,r.to),d>r.from&&a.delete(r.from+c,d),l=r.from+c+u.length,a.addMark(r.from+c,l,t.type.create(o||{})),a.removeStoredMark(t.type)}}})}var enZ="bottom",enY="right",enJ="left",enQ="auto",enX=["top",enZ,enY,enJ],en0="start",en1="viewport",en2="popper",en3=enX.reduce(function(t,n){return t.concat([n+"-"+en0,n+"-end"])},[]),en4=[].concat(enX,[enQ]).reduce(function(t,n){return t.concat([n,n+"-"+en0,n+"-end"])},[]),en5=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function en6(t){return t?(t.nodeName||"").toLowerCase():null}function en9(t){if(null==t)return window;if("[object Window]"!==t.toString()){var n=t.ownerDocument;return n&&n.defaultView||window}return t}function en8(t){var n=en9(t).Element;return t instanceof n||t instanceof Element}function en7(t){var n=en9(t).HTMLElement;return t instanceof n||t instanceof HTMLElement}function ere(t){if(typeof ShadowRoot>"u")return!1;var n=en9(t).ShadowRoot;return t instanceof n||t instanceof ShadowRoot}let ert={name:"applyStyles",enabled:!0,phase:"write",fn:function(t){var n=t.state;Object.keys(n.elements).forEach(function(t){var r=n.styles[t]||{},i=n.attributes[t]||{},o=n.elements[t];en7(o)&&en6(o)&&(Object.assign(o.style,r),Object.keys(i).forEach(function(t){var n=i[t];!1===n?o.removeAttribute(t):o.setAttribute(t,!0===n?"":n)}))})},effect:function(t){var n=t.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow),function(){Object.keys(n.elements).forEach(function(t){var i=n.elements[t],o=n.attributes[t]||{},a=Object.keys(n.styles.hasOwnProperty(t)?n.styles[t]:r[t]).reduce(function(t,n){return t[n]="",t},{});en7(i)&&en6(i)&&(Object.assign(i.style,a),Object.keys(o).forEach(function(t){i.removeAttribute(t)}))})}},requires:["computeStyles"]};function ern(t){return t.split("-")[0]}var err=Math.max,eri=Math.min,ero=Math.round;function era(){var t=navigator.userAgentData;return null!=t&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function eru(){return!/^((?!chrome|android).)*safari/i.test(era())}function ers(t,n,r){void 0===n&&(n=!1),void 0===r&&(r=!1);var i=t.getBoundingClientRect(),o=1,a=1;n&&en7(t)&&(o=t.offsetWidth>0&&ero(i.width)/t.offsetWidth||1,a=t.offsetHeight>0&&ero(i.height)/t.offsetHeight||1);var u=(en8(t)?en9(t):window).visualViewport,s=!eru()&&r,l=(i.left+(s&&u?u.offsetLeft:0))/o,c=(i.top+(s&&u?u.offsetTop:0))/a,d=i.width/o,f=i.height/a;return{width:d,height:f,top:c,right:l+d,bottom:c+f,left:l,x:l,y:c}}function erl(t){var n=ers(t),r=t.offsetWidth,i=t.offsetHeight;return 1>=Math.abs(n.width-r)&&(r=n.width),1>=Math.abs(n.height-i)&&(i=n.height),{x:t.offsetLeft,y:t.offsetTop,width:r,height:i}}function erc(t,n){var r=n.getRootNode&&n.getRootNode();if(t.contains(n))return!0;if(r&&ere(r)){var i=n;do{if(i&&t.isSameNode(i))return!0;i=i.parentNode||i.host}while(i)}return!1}function erd(t){return en9(t).getComputedStyle(t)}function erf(t){return["table","td","th"].indexOf(en6(t))>=0}function erp(t){return((en8(t)?t.ownerDocument:t.document)||window.document).documentElement}function erh(t){return"html"===en6(t)?t:t.assignedSlot||t.parentNode||(ere(t)?t.host:null)||erp(t)}function erm(t){return en7(t)&&"fixed"!==erd(t).position?t.offsetParent:null}function erg(t){for(var n=en9(t),r=erm(t);r&&erf(r)&&"static"===erd(r).position;)r=erm(r);return r&&("html"===en6(r)||"body"===en6(r)&&"static"===erd(r).position)?n:r||function(t){var n=/firefox/i.test(era());if(/Trident/i.test(era())&&en7(t)&&"fixed"===erd(t).position)return null;var r=erh(t);for(ere(r)&&(r=r.host);en7(r)&&0>["html","body"].indexOf(en6(r));){var i=erd(r);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||n&&"filter"===i.willChange||n&&i.filter&&"none"!==i.filter)return r;r=r.parentNode}return null}(t)||n}function ery(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function erv(t,n,r){return err(t,eri(n,r))}function erb(){return{top:0,right:0,bottom:0,left:0}}function erx(t){return Object.assign({},erb(),t)}function er_(t,n){return n.reduce(function(n,r){return n[r]=t,n},{})}function erS(t){return t.split("-")[1]}var erT={top:"auto",right:"auto",bottom:"auto",left:"auto"};function erw(t){var n,r,i=t.popper,o=t.popperRect,a=t.placement,u=t.variation,s=t.offsets,l=t.position,c=t.gpuAcceleration,d=t.adaptive,f=t.roundOffsets,p=t.isFixed,h=s.x,m=void 0===h?0:h,g=s.y,y=void 0===g?0:g,v="function"==typeof f?f({x:m,y:y}):{x:m,y:y};m=v.x,y=v.y;var b=s.hasOwnProperty("x"),x=s.hasOwnProperty("y"),_=enJ,S="top",T=window;if(d){var w=erg(i),O="clientHeight",k="clientWidth";w===en9(i)&&(w=erp(i),"static"!==erd(w).position&&"absolute"===l&&(O="scrollHeight",k="scrollWidth")),("top"===a||(a===enJ||a===enY)&&"end"===u)&&(S=enZ,y-=(p&&w===T&&T.visualViewport?T.visualViewport.height:w[O])-o.height,y*=c?1:-1),(a===enJ||("top"===a||a===enZ)&&"end"===u)&&(_=enY,m-=(p&&w===T&&T.visualViewport?T.visualViewport.width:w[k])-o.width,m*=c?1:-1)}var C,I,M,R,E,j=Object.assign({position:l},d&&erT),A=!0===f?(C={x:m,y:y},I=en9(i),M=C.x,R=C.y,{x:ero(M*(E=I.devicePixelRatio||1))/E||0,y:ero(R*E)/E||0}):{x:m,y:y};return(m=A.x,y=A.y,c)?Object.assign({},j,((n={})[S]=x?"0":"",n[_]=b?"0":"",n.transform=1>=(T.devicePixelRatio||1)?"translate("+m+"px, "+y+"px)":"translate3d("+m+"px, "+y+"px, 0)",n)):Object.assign({},j,((r={})[S]=x?y+"px":"",r[_]=b?m+"px":"",r.transform="",r))}var erO={passive:!0},erk={left:"right",right:"left",bottom:"top",top:"bottom"};function erC(t){return t.replace(/left|right|bottom|top/g,function(t){return erk[t]})}var erI={start:"end",end:"start"};function erM(t){return t.replace(/start|end/g,function(t){return erI[t]})}function erR(t){var n,r=en9(t);return{scrollLeft:r.pageXOffset,scrollTop:r.pageYOffset}}function erE(t){return ers(erp(t)).left+erR(t).scrollLeft}function erj(t){var n=erd(t),r=n.overflow,i=n.overflowX,o=n.overflowY;return/auto|scroll|overlay|hidden/.test(r+o+i)}function erA(t,n){void 0===n&&(n=[]);var r,i=function t(n){return["html","body","#document"].indexOf(en6(n))>=0?n.ownerDocument.body:en7(n)&&erj(n)?n:t(erh(n))}(t),o=i===(null==(r=t.ownerDocument)?void 0:r.body),a=en9(i),u=o?[a].concat(a.visualViewport||[],erj(i)?i:[]):i,s=n.concat(u);return o?s:s.concat(erA(erh(u)))}function erN(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function erP(t,n,r){var i,o,a,u,s,l,c,d,f,p,h,m;return n===en1?erN(function(t,n){var r=en9(t),i=erp(t),o=r.visualViewport,a=i.clientWidth,u=i.clientHeight,s=0,l=0;if(o){a=o.width,u=o.height;var c=eru();(c||!c&&"fixed"===n)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:a,height:u,x:s+erE(t),y:l}}(t,r)):en8(n)?((a=ers(n,!1,"fixed"===r)).top=a.top+n.clientTop,a.left=a.left+n.clientLeft,a.bottom=a.top+n.clientHeight,a.right=a.left+n.clientWidth,a.width=n.clientWidth,a.height=n.clientHeight,a.x=a.left,a.y=a.top,a):erN((u=erp(t),l=erp(u),c=erR(u),d=null==(s=u.ownerDocument)?void 0:s.body,f=err(l.scrollWidth,l.clientWidth,d?d.scrollWidth:0,d?d.clientWidth:0),p=err(l.scrollHeight,l.clientHeight,d?d.scrollHeight:0,d?d.clientHeight:0),h=-c.scrollLeft+erE(u),m=-c.scrollTop,"rtl"===erd(d||l).direction&&(h+=err(l.clientWidth,d?d.clientWidth:0)-f),{width:f,height:p,x:h,y:m}))}function erL(t){var n,r=t.reference,i=t.element,o=t.placement,a=o?ern(o):null,u=o?erS(o):null,s=r.x+r.width/2-i.width/2,l=r.y+r.height/2-i.height/2;switch(a){case"top":n={x:s,y:r.y-i.height};break;case enZ:n={x:s,y:r.y+r.height};break;case enY:n={x:r.x+r.width,y:l};break;case enJ:n={x:r.x-i.width,y:l};break;default:n={x:r.x,y:r.y}}var c=a?ery(a):null;if(null!=c){var d="y"===c?"height":"width";switch(u){case en0:n[c]=n[c]-(r[d]/2-i[d]/2);break;case"end":n[c]=n[c]+(r[d]/2-i[d]/2)}}return n}function erF(t,n){void 0===n&&(n={});var r,i,o,a,u,s,l,c,d,f,p=n,h=p.placement,m=void 0===h?t.placement:h,g=p.strategy,y=void 0===g?t.strategy:g,v=p.boundary,b=p.rootBoundary,x=p.elementContext,_=void 0===x?en2:x,S=p.altBoundary,T=p.padding,w=void 0===T?0:T,O=erx("number"!=typeof w?w:er_(w,enX)),k=t.rects.popper,C=t.elements[void 0!==S&&S?_===en2?"reference":en2:_],I=(r=en8(C)?C:C.contextElement||erp(t.elements.popper),d=(c=[].concat("clippingParents"===(i=void 0===v?"clippingParents":v)?(s=erA(erh(r)),l=["absolute","fixed"].indexOf(erd(r).position)>=0&&en7(r)?erg(r):r,en8(l)?s.filter(function(t){return en8(t)&&erc(t,l)&&"body"!==en6(t)}):[]):[].concat(i),[void 0===b?en1:b]))[0],(f=c.reduce(function(t,n){var i=erP(r,n,y);return t.top=err(i.top,t.top),t.right=eri(i.right,t.right),t.bottom=eri(i.bottom,t.bottom),t.left=err(i.left,t.left),t},erP(r,d,y))).width=f.right-f.left,f.height=f.bottom-f.top,f.x=f.left,f.y=f.top,f),M=ers(t.elements.reference),R=erL({reference:M,element:k,strategy:"absolute",placement:m}),E=erN(Object.assign({},k,R)),j=_===en2?E:M,A={top:I.top-j.top+O.top,bottom:j.bottom-I.bottom+O.bottom,left:I.left-j.left+O.left,right:j.right-I.right+O.right},N=t.modifiersData.offset;if(_===en2&&N){var P=N[m];Object.keys(A).forEach(function(t){var n=[enY,enZ].indexOf(t)>=0?1:-1,r=["top",enZ].indexOf(t)>=0?"y":"x";A[t]+=P[r]*n})}return A}function erD(t,n,r){return void 0===r&&(r={x:0,y:0}),{top:t.top-n.height-r.y,right:t.right-n.width+r.x,bottom:t.bottom-n.height+r.y,left:t.left-n.width-r.x}}function erW(t){return["top",enY,enZ,enJ].some(function(n){return t[n]>=0})}var erU={placement:"bottom",modifiers:[],strategy:"absolute"};function erz(){for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return!n.some(function(t){return!(t&&"function"==typeof t.getBoundingClientRect)})}var erB,erV,er$,erq,erK,erH,erG=(erB={defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(t){var n=t.state,r=t.instance,i=t.options,o=i.scroll,a=void 0===o||o,u=i.resize,s=void 0===u||u,l=en9(n.elements.popper),c=[].concat(n.scrollParents.reference,n.scrollParents.popper);return a&&c.forEach(function(t){t.addEventListener("scroll",r.update,erO)}),s&&l.addEventListener("resize",r.update,erO),function(){a&&c.forEach(function(t){t.removeEventListener("scroll",r.update,erO)}),s&&l.removeEventListener("resize",r.update,erO)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(t){var n=t.state,r=t.name;n.modifiersData[r]=erL({reference:n.rects.reference,element:n.rects.popper,strategy:"absolute",placement:n.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(t){var n=t.state,r=t.options,i=r.gpuAcceleration,o=r.adaptive,a=r.roundOffsets,u=void 0===a||a,s={placement:ern(n.placement),variation:erS(n.placement),popper:n.elements.popper,popperRect:n.rects.popper,gpuAcceleration:void 0===i||i,isFixed:"fixed"===n.options.strategy};null!=n.modifiersData.popperOffsets&&(n.styles.popper=Object.assign({},n.styles.popper,erw(Object.assign({},s,{offsets:n.modifiersData.popperOffsets,position:n.options.strategy,adaptive:void 0===o||o,roundOffsets:u})))),null!=n.modifiersData.arrow&&(n.styles.arrow=Object.assign({},n.styles.arrow,erw(Object.assign({},s,{offsets:n.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-placement":n.placement})},data:{}},ert,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(t){var n=t.state,r=t.options,i=t.name,o=r.offset,a=void 0===o?[0,0]:o,u=en4.reduce(function(t,r){var i,o,u,s,l,c,d,f;return t[r]=(o=n.rects,l=[enJ,"top"].indexOf(s=ern(r))>=0?-1:1,d=(c="function"==typeof a?a(Object.assign({},o,{placement:r})):a)[0],f=c[1],d=d||0,f=(f||0)*l,[enJ,enY].indexOf(s)>=0?{x:f,y:d}:{x:d,y:f}),t},{}),s=u[n.placement],l=s.x,c=s.y;null!=n.modifiersData.popperOffsets&&(n.modifiersData.popperOffsets.x+=l,n.modifiersData.popperOffsets.y+=c),n.modifiersData[i]=u}},{name:"flip",enabled:!0,phase:"main",fn:function(t){var n=t.state,r=t.options,i=t.name;if(!n.modifiersData[i]._skip){for(var o=r.mainAxis,a=void 0===o||o,u=r.altAxis,s=void 0===u||u,l=r.fallbackPlacements,c=r.padding,d=r.boundary,f=r.rootBoundary,p=r.altBoundary,h=r.flipVariations,m=void 0===h||h,g=r.allowedAutoPlacements,y=n.options.placement,v=ern(y),b=l||(v!==y&&m?function(t){if(ern(t)===enQ)return[];var n=erC(t);return[erM(t),n,erM(n)]}(y):[erC(y)]),x=[y].concat(b).reduce(function(t,r){var i,o,a,u,s,l,p,h,y,v,b,x,_,S;return t.concat(ern(r)===enQ?(o={placement:r,boundary:d,rootBoundary:f,padding:c,flipVariations:m,allowedAutoPlacements:g},u=(a=o).placement,s=a.boundary,l=a.rootBoundary,p=a.padding,h=a.flipVariations,v=void 0===(y=a.allowedAutoPlacements)?en4:y,0===(_=(x=(b=erS(u))?h?en3:en3.filter(function(t){return erS(t)===b}):enX).filter(function(t){return v.indexOf(t)>=0})).length&&(_=x),Object.keys(S=_.reduce(function(t,r){return t[r]=erF(n,{placement:r,boundary:s,rootBoundary:l,padding:p})[ern(r)],t},{})).sort(function(t,n){return S[t]-S[n]})):r)},[]),_=n.rects.reference,S=n.rects.popper,T=new Map,w=!0,O=x[0],k=0;k<x.length;k++){var C=x[k],I=ern(C),M=erS(C)===en0,R=["top",enZ].indexOf(I)>=0,E=R?"width":"height",j=erF(n,{placement:C,boundary:d,rootBoundary:f,altBoundary:p,padding:c}),A=R?M?enY:enJ:M?enZ:"top";_[E]>S[E]&&(A=erC(A));var N=erC(A),P=[];if(a&&P.push(j[I]<=0),s&&P.push(j[A]<=0,j[N]<=0),P.every(function(t){return t})){O=C,w=!1;break}T.set(C,P)}if(w)for(var L=m?3:1,F=function(t){var n=x.find(function(n){var r=T.get(n);if(r)return r.slice(0,t).every(function(t){return t})});if(n)return O=n,"break"},D=L;D>0&&"break"!==F(D);D--);n.placement!==O&&(n.modifiersData[i]._skip=!0,n.placement=O,n.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(t){var n,r=t.state,i=t.options,o=t.name,a=i.mainAxis,u=i.altAxis,s=i.boundary,l=i.rootBoundary,c=i.altBoundary,d=i.padding,f=i.tether,p=void 0===f||f,h=i.tetherOffset,m=void 0===h?0:h,g=erF(r,{boundary:s,rootBoundary:l,padding:d,altBoundary:c}),y=ern(r.placement),v=erS(r.placement),b=!v,x=ery(y),_="x"===x?"y":"x",S=r.modifiersData.popperOffsets,T=r.rects.reference,w=r.rects.popper,O="function"==typeof m?m(Object.assign({},r.rects,{placement:r.placement})):m,k="number"==typeof O?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),C=r.modifiersData.offset?r.modifiersData.offset[r.placement]:null,I={x:0,y:0};if(S){if(void 0===a||a){var M,R="y"===x?"top":enJ,E="y"===x?enZ:enY,j="y"===x?"height":"width",A=S[x],N=A+g[R],P=A-g[E],L=p?-w[j]/2:0,F=v===en0?T[j]:w[j],D=v===en0?-w[j]:-T[j],W=r.elements.arrow,U=p&&W?erl(W):{width:0,height:0},z=r.modifiersData["arrow#persistent"]?r.modifiersData["arrow#persistent"].padding:erb(),B=z[R],V=z[E],$=erv(0,T[j],U[j]),q=b?T[j]/2-L-$-B-k.mainAxis:F-$-B-k.mainAxis,K=b?-T[j]/2+L+$+V+k.mainAxis:D+$+V+k.mainAxis,H=r.elements.arrow&&erg(r.elements.arrow),G=H?"y"===x?H.clientTop||0:H.clientLeft||0:0,Z=null!=(M=null==C?void 0:C[x])?M:0,Y=erv(p?eri(N,A+q-Z-G):N,A,p?err(P,A+K-Z):P);S[x]=Y,I[x]=Y-A}if(void 0!==u&&u){var J,Q,X,ee,et,en=S[_],er="y"===_?"height":"width",ei=en+g["x"===x?"top":enJ],eo=en-g["x"===x?enZ:enY],ea=-1!==["top",enJ].indexOf(y),eu=null!=(et=null==C?void 0:C[_])?et:0,es=ea?ei:en-T[er]-w[er]-eu+k.altAxis,el=ea?en+T[er]+w[er]-eu-k.altAxis:eo,ec=p&&ea?(ee=erv(es,en,el))>el?el:ee:erv(p?es:ei,en,p?el:eo);S[_]=ec,I[_]=ec-en}r.modifiersData[o]=I}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(t){var n,r=t.state,i=t.name,o=t.options,a=r.elements.arrow,u=r.modifiersData.popperOffsets,s=ern(r.placement),l=ery(s),c=[enJ,enY].indexOf(s)>=0?"height":"width";if(!(!a||!u)){var d,f,p=erx("number"!=typeof(d="function"==typeof(d=o.padding)?d(Object.assign({},r.rects,{placement:r.placement})):d)?d:er_(d,enX)),h=erl(a),m=r.rects.reference[c]+r.rects.reference[l]-u[l]-r.rects.popper[c],g=u[l]-r.rects.reference[l],y=erg(a),v=y?"y"===l?y.clientHeight||0:y.clientWidth||0:0,b=p["y"===l?"top":enJ],x=v-h[c]-p["y"===l?enZ:enY],_=v/2-h[c]/2+(m/2-g/2),S=erv(b,_,x);r.modifiersData[i]=((n={})[l]=S,n.centerOffset=S-_,n)}},effect:function(t){var n=t.state,r=t.options.element,i=void 0===r?"[data-popper-arrow]":r;null==i||("string"!=typeof i||(i=n.elements.popper.querySelector(i)))&&erc(n.elements.popper,i)&&(n.elements.arrow=i)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(t){var n=t.state,r=t.name,i=n.rects.reference,o=n.rects.popper,a=n.modifiersData.preventOverflow,u=erF(n,{elementContext:"reference"}),s=erF(n,{altBoundary:!0}),l=erD(u,i),c=erD(s,o,a),d=erW(l),f=erW(c);n.modifiersData[r]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:f},n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}}]},erq=void 0===(er$=(erV=erB).defaultModifiers)?[]:er$,erH=void 0===(erK=erV.defaultOptions)?erU:erK,function(t,n,r){void 0===r&&(r=erH);var i,o,a={placement:"bottom",orderedModifiers:[],options:Object.assign({},erU,erH),modifiersData:{},elements:{reference:t,popper:n},attributes:{},styles:{}},u=[],s=!1,l={state:a,setOptions:function(r){var i,o,s,d,f,p,h,m,g="function"==typeof r?r(a.options):r;c(),a.options=Object.assign({},erH,a.options,g),a.scrollParents={reference:en8(t)?erA(t):t.contextElement?erA(t.contextElement):[],popper:erA(n)};var y=(s=Object.keys(o=(i=[].concat(erq,a.options.modifiers)).reduce(function(t,n){var r=t[n.name];return t[n.name]=r?Object.assign({},r,n,{options:Object.assign({},r.options,n.options),data:Object.assign({},r.data,n.data)}):n,t},{})).map(function(t){return o[t]}),f=new Map,p=new Set,h=[],s.forEach(function(t){f.set(t.name,t)}),s.forEach(function(t){p.has(t.name)||function t(n){p.add(n.name),[].concat(n.requires||[],n.requiresIfExists||[]).forEach(function(n){if(!p.has(n)){var r=f.get(n);r&&t(r)}}),h.push(n)}(t)}),en5.reduce(function(t,n){return t.concat(h.filter(function(t){return t.phase===n}))},[]));return a.orderedModifiers=y.filter(function(t){return t.enabled}),a.orderedModifiers.forEach(function(t){var n=t.name,r=t.options,i=t.effect;if("function"==typeof i){var o=i({state:a,name:n,instance:l,options:void 0===r?{}:r}),s=function(){};u.push(o||s)}}),l.update()},forceUpdate:function(){if(!s){var t,n,r,i,o,u,c,d,f,p,h,m,g,y,v,b=a.elements,x=b.reference,_=b.popper;if(erz(x,_)){a.rects={reference:(t=x,n=erg(_),r="fixed"===a.options.strategy,d=en7(n),f=en7(n)&&(u=ero((o=(i=n).getBoundingClientRect()).width)/i.offsetWidth||1,c=ero(o.height)/i.offsetHeight||1,1!==u||1!==c),p=erp(n),h=ers(t,f,r),m={scrollLeft:0,scrollTop:0},g={x:0,y:0},(d||!d&&!r)&&(("body"!==en6(n)||erj(p))&&(m=(y=n)!==en9(y)&&en7(y)?{scrollLeft:(v=y).scrollLeft,scrollTop:v.scrollTop}:erR(y)),en7(n)?(g=ers(n,!0),g.x+=n.clientLeft,g.y+=n.clientTop):p&&(g.x=erE(p))),{x:h.left+m.scrollLeft-g.x,y:h.top+m.scrollTop-g.y,width:h.width,height:h.height}),popper:erl(_)},a.reset=!1,a.placement=a.options.placement,a.orderedModifiers.forEach(function(t){return a.modifiersData[t.name]=Object.assign({},t.data)});for(var S=0;S<a.orderedModifiers.length;S++){if(!0===a.reset){a.reset=!1,S=-1;continue}var T=a.orderedModifiers[S],w=T.fn,O=T.options,k=void 0===O?{}:O,C=T.name;"function"==typeof w&&(a=w({state:a,options:k,name:C,instance:l})||a)}}}},update:function(){return o||(o=new Promise(function(t){Promise.resolve().then(function(){o=void 0,t(new Promise(function(t){l.forceUpdate(),t(a)}))})})),o},destroy:function(){c(),s=!0}};if(!erz(t,n))return l;function c(){u.forEach(function(t){return t()}),u=[]}return l.setOptions(r).then(function(t){!s&&r.onFirstUpdate&&r.onFirstUpdate(t)}),l}),erZ="tippy-content",erY="tippy-arrow",erJ="tippy-svg-arrow",erQ={passive:!0,capture:!0},erX=function(){return document.body};function er0(t,n,r){return Array.isArray(t)?t[n]??(Array.isArray(r)?r[n]:r):t}function er1(t,n){var r=({}).toString.call(t);return 0===r.indexOf("[object")&&r.indexOf(n+"]")>-1}function er2(t,n){return"function"==typeof t?t.apply(void 0,n):t}function er3(t,n){var r;return 0===n?t:function(i){clearTimeout(r),r=setTimeout(function(){t(i)},n)}}function er4(t){return[].concat(t)}function er5(t,n){-1===t.indexOf(n)&&t.push(n)}function er6(t){return[].slice.call(t)}function er9(t){return Object.keys(t).reduce(function(n,r){return void 0!==t[r]&&(n[r]=t[r]),n},{})}function er8(){return document.createElement("div")}function er7(t){return["Element","Fragment"].some(function(n){return er1(t,n)})}function eie(t,n){t.forEach(function(t){t&&(t.style.transitionDuration=n+"ms")})}function eit(t,n){t.forEach(function(t){t&&t.setAttribute("data-state",n)})}function ein(t,n,r){var i=n+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(n){t[i](n,r)})}function eir(t,n){for(var r,i=n;i;){if(t.contains(i))return!0;i=null==i.getRootNode||null==(r=i.getRootNode())?void 0:r.host}return!1}var eii={isTouch:!1},eio=0;function eia(){eii.isTouch||(eii.isTouch=!0,window.performance&&document.addEventListener("mousemove",eiu))}function eiu(){var t=performance.now();t-eio<20&&(eii.isTouch=!1,document.removeEventListener("mousemove",eiu)),eio=t}function eis(){var t,n=document.activeElement;if(n&&n._tippy&&n._tippy.reference===n){var r=n._tippy;n.blur&&!r.state.isVisible&&n.blur()}}var eil=!!("u">typeof window&&"u">typeof document)&&!!window.msCrypto,eic=Object.assign({appendTo:erX,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},{animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},{allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999}),eid=Object.keys(eic),eif=function(t){Object.keys(t).forEach(function(n){eic[n]=t[n]})};function eip(t){var n=(t.plugins||[]).reduce(function(n,r){var i,o=r.name,a=r.defaultValue;return o&&(n[o]=void 0!==t[o]?t[o]:null!=(i=eic[o])?i:a),n},{});return Object.assign({},t,n)}function eih(t,n){var r,i,o=Object.assign({},n,{content:er2(n.content,[t])},n.ignoreAttributes?{}:((i=n.plugins)?Object.keys(eip(Object.assign({},eic,{plugins:i}))):eid).reduce(function(n,r){var i=(t.getAttribute("data-tippy-"+r)||"").trim();if(!i)return n;if("content"===r)n[r]=i;else try{n[r]=JSON.parse(i)}catch{n[r]=i}return n},{}));return o.aria=Object.assign({},eic.aria,o.aria),o.aria={expanded:"auto"===o.aria.expanded?n.interactive:o.aria.expanded,content:"auto"===o.aria.content?n.interactive?null:"describedby":o.aria.content},o}var eim=function(){return"innerHTML"};function eig(t,n){t[eim()]=n}function eiy(t){var n=er8();return!0===t?n.className=erY:(n.className=erJ,er7(t)?n.appendChild(t):eig(n,t)),n}function eiv(t,n){er7(n.content)?(eig(t,""),t.appendChild(n.content)):"function"!=typeof n.content&&(n.allowHTML?eig(t,n.content):t.textContent=n.content)}function eib(t){var n=t.firstElementChild,r=er6(n.children);return{box:n,content:r.find(function(t){return t.classList.contains(erZ)}),arrow:r.find(function(t){return t.classList.contains(erY)||t.classList.contains(erJ)}),backdrop:r.find(function(t){return t.classList.contains("tippy-backdrop")})}}function eix(t){var n=er8(),r=er8();r.className="tippy-box",r.setAttribute("data-state","hidden"),r.setAttribute("tabindex","-1");var i=er8();function o(r,i){var o=eib(n),a=o.box,u=o.content,s=o.arrow;i.theme?a.setAttribute("data-theme",i.theme):a.removeAttribute("data-theme"),"string"==typeof i.animation?a.setAttribute("data-animation",i.animation):a.removeAttribute("data-animation"),i.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth="number"==typeof i.maxWidth?i.maxWidth+"px":i.maxWidth,i.role?a.setAttribute("role",i.role):a.removeAttribute("role"),(r.content!==i.content||r.allowHTML!==i.allowHTML)&&eiv(u,t.props),i.arrow?s?r.arrow!==i.arrow&&(a.removeChild(s),a.appendChild(eiy(i.arrow))):a.appendChild(eiy(i.arrow)):s&&a.removeChild(s)}return i.className=erZ,i.setAttribute("data-state","hidden"),eiv(i,t.props),n.appendChild(r),r.appendChild(i),o(t.props,t.props),{popper:n,onUpdate:o}}eix.$$tippy=!0;var ei_=1,eiS=[],eiT=[];function eiw(t,n){void 0===n&&(n={});var r,i,o=eic.plugins.concat(n.plugins||[]);document.addEventListener("touchstart",eia,erQ),window.addEventListener("blur",eis);var a,u=Object.assign({},n,{plugins:o}),s=(er7(t)?[t]:er1(t,"NodeList")?er6(t):Array.isArray(t)?t:er6(document.querySelectorAll(t))).reduce(function(t,n){var r=n&&function(t,n){var r,i,o,a,u,s,l,c,d=eih(t,Object.assign({},eic,eip(er9(n)))),f=!1,p=!1,h=!1,m=!1,g=[],y=er3(G,d.interactiveDebounce),v=ei_++,b=(r=d.plugins).filter(function(t,n){return r.indexOf(t)===n}),x={id:v,reference:t,popper:er8(),popperInstance:null,props:d,state:{isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},plugins:b,clearDelayTimeouts:function(){clearTimeout(i),clearTimeout(o),cancelAnimationFrame(a)},setProps:function(n){if(!x.state.isDestroyed){N("onBeforeUpdate",[x,n]),K();var r=x.props,i=eih(t,Object.assign({},r,er9(n),{ignoreAttributes:!0}));x.props=i,q(),r.interactiveDebounce!==i.interactiveDebounce&&(F(),y=er3(G,i.interactiveDebounce)),r.triggerTarget&&!i.triggerTarget?er4(r.triggerTarget).forEach(function(t){t.removeAttribute("aria-expanded")}):i.triggerTarget&&t.removeAttribute("aria-expanded"),L(),A(),T&&T(r,i),x.popperInstance&&(Q(),ee().forEach(function(t){requestAnimationFrame(t._tippy.popperInstance.forceUpdate)})),N("onAfterUpdate",[x,n])}},setContent:function(t){x.setProps({content:t})},show:function(){var t=x.state.isVisible,n=x.state.isDestroyed,r=!x.state.isEnabled,i=eii.isTouch&&!x.props.touch,o=er0(x.props.duration,0,eic.duration);if(!(t||n||r||i)&&!M().hasAttribute("disabled")&&(N("onShow",[x],!1),!1!==x.props.onShow(x))){if(x.state.isVisible=!0,I()&&(S.style.visibility="visible"),A(),z(),x.state.isMounted||(S.style.transition="none"),I()){var a,u,s,c,d=E();eie([d.box,d.content],0)}l=function(){var t;if(!(!x.state.isVisible||m)){if(m=!0,S.offsetHeight,S.style.transition=x.props.moveTransition,I()&&x.props.animation){var n,r,i=E(),a=i.box,u=i.content;eie([a,u],o),eit([a,u],"visible")}P(),L(),er5(eiT,x),null==(t=x.popperInstance)||t.forceUpdate(),N("onMount",[x]),x.props.animation&&I()&&V(o,r=function(){x.state.isShown=!0,N("onShown",[x])})}},u=x.props.appendTo,s=M(),(a=x.props.interactive&&u===erX||"parent"===u?s.parentNode:er2(u,[s])).contains(S)||a.appendChild(S),x.state.isMounted=!0,Q()}},hide:function(){var t=!x.state.isVisible,n=x.state.isDestroyed,r=!x.state.isEnabled,i=er0(x.props.duration,1,eic.duration);if(!(t||n||r)&&(N("onHide",[x],!1),!1!==x.props.onHide(x))){if(x.state.isVisible=!1,x.state.isShown=!1,m=!1,f=!1,I()&&(S.style.visibility="hidden"),F(),B(),A(!0),I()){var o,a,u=E(),s=u.box,l=u.content;x.props.animation&&(eie([s,l],i),eit([s,l],"hidden"))}P(),L(),x.props.animation?I()&&(a=x.unmount,V(i,function(){!x.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&a()})):x.unmount()}},hideWithInteractivity:function(t){R().addEventListener("mousemove",y),er5(eiS,y),y(t)},enable:function(){x.state.isEnabled=!0},disable:function(){x.hide(),x.state.isEnabled=!1},unmount:function(){x.state.isVisible&&x.hide(),x.state.isMounted&&(X(),ee().forEach(function(t){t._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),eiT=eiT.filter(function(t){return t!==x}),x.state.isMounted=!1,N("onHidden",[x]))},destroy:function(){x.state.isDestroyed||(x.clearDelayTimeouts(),x.unmount(),K(),delete t._tippy,x.state.isDestroyed=!0,N("onDestroy",[x]))}};if(!d.render)return x;var _=d.render(x),S=_.popper,T=_.onUpdate;S.setAttribute("data-tippy-root",""),S.id="tippy-"+x.id,x.popper=S,t._tippy=x,S._tippy=x;var w=b.map(function(t){return t.fn(x)}),O=t.hasAttribute("aria-expanded");return q(),L(),A(),N("onCreate",[x]),d.showOnCreate&&et(),S.addEventListener("mouseenter",function(){x.props.interactive&&x.state.isVisible&&x.clearDelayTimeouts()}),S.addEventListener("mouseleave",function(){x.props.interactive&&x.props.trigger.indexOf("mouseenter")>=0&&R().addEventListener("mousemove",y)}),x;function k(){var t=x.props.touch;return Array.isArray(t)?t:[t,0]}function C(){return"hold"===k()[0]}function I(){var t;return!!(null!=(t=x.props.render)&&t.$$tippy)}function M(){return c||t}function R(){var t,n,r,i=M().parentNode;return i&&null!=(r=er4(i)[0])&&null!=(n=r.ownerDocument)&&n.body?r.ownerDocument:document}function E(){return eib(S)}function j(t){return x.state.isMounted&&!x.state.isVisible||eii.isTouch||u&&"focus"===u.type?0:er0(x.props.delay,t?0:1,eic.delay)}function A(t){void 0===t&&(t=!1),S.style.pointerEvents=x.props.interactive&&!t?"":"none",S.style.zIndex=""+x.props.zIndex}function N(t,n,r){if(void 0===r&&(r=!0),w.forEach(function(r){r[t]&&r[t].apply(r,n)}),r){var i;(i=x.props)[t].apply(i,n)}}function P(){var n=x.props.aria;if(n.content){var r="aria-"+n.content,i=S.id;er4(x.props.triggerTarget||t).forEach(function(t){var n=t.getAttribute(r);if(x.state.isVisible)t.setAttribute(r,n?n+" "+i:i);else{var o=n&&n.replace(i,"").trim();o?t.setAttribute(r,o):t.removeAttribute(r)}})}}function L(){!(O||!x.props.aria.expanded)&&er4(x.props.triggerTarget||t).forEach(function(t){x.props.interactive?t.setAttribute("aria-expanded",x.state.isVisible&&t===M()?"true":"false"):t.removeAttribute("aria-expanded")})}function F(){R().removeEventListener("mousemove",y),eiS=eiS.filter(function(t){return t!==y})}function D(n){if(!(eii.isTouch&&(h||"mousedown"===n.type))){var r=n.composedPath&&n.composedPath()[0]||n.target;if(!(x.props.interactive&&eir(S,r))){if(er4(x.props.triggerTarget||t).some(function(t){return eir(t,r)})){if(eii.isTouch||x.state.isVisible&&x.props.trigger.indexOf("click")>=0)return}else N("onClickOutside",[x,n]);!0===x.props.hideOnClick&&(x.clearDelayTimeouts(),x.hide(),p=!0,setTimeout(function(){p=!1}),x.state.isMounted||B())}}}function W(){h=!0}function U(){h=!1}function z(){var t=R();t.addEventListener("mousedown",D,!0),t.addEventListener("touchend",D,erQ),t.addEventListener("touchstart",U,erQ),t.addEventListener("touchmove",W,erQ)}function B(){var t=R();t.removeEventListener("mousedown",D,!0),t.removeEventListener("touchend",D,erQ),t.removeEventListener("touchstart",U,erQ),t.removeEventListener("touchmove",W,erQ)}function V(t,n){var r=E().box;function i(t){t.target===r&&(ein(r,"remove",i),n())}if(0===t)return n();ein(r,"remove",s),ein(r,"add",i),s=i}function $(n,r,i){void 0===i&&(i=!1),er4(x.props.triggerTarget||t).forEach(function(t){t.addEventListener(n,r,i),g.push({node:t,eventType:n,handler:r,options:i})})}function q(){var t;C()&&($("touchstart",H,{passive:!0}),$("touchend",Z,{passive:!0})),(t=x.props.trigger).split(/\s+/).filter(Boolean).forEach(function(t){if("manual"!==t)switch($(t,H),t){case"mouseenter":$("mouseleave",Z);break;case"focus":$(eil?"focusout":"blur",Y);break;case"focusin":$("focusout",Y)}})}function K(){g.forEach(function(t){var n=t.node,r=t.eventType,i=t.handler,o=t.options;n.removeEventListener(r,i,o)}),g=[]}function H(t){var n,r=!1;if(!(!x.state.isEnabled||J(t)||p)){var i,o=(null==(n=u)?void 0:n.type)==="focus";u=t,c=t.currentTarget,L(),!x.state.isVisible&&er1(t,"MouseEvent")&&eiS.forEach(function(n){return n(t)}),"click"===t.type&&(0>x.props.trigger.indexOf("mouseenter")||f)&&!1!==x.props.hideOnClick&&x.state.isVisible?r=!0:et(t),"click"===t.type&&(f=!r),r&&!o&&en(t)}}function G(t){var n,r,i,o,a=t.target,u=M().contains(a)||S.contains(a);!("mousemove"===t.type&&u)&&(n=ee().concat(S).map(function(t){var n,r=null==(n=t._tippy.popperInstance)?void 0:n.state;return r?{popperRect:t.getBoundingClientRect(),popperState:r,props:d}:null}).filter(Boolean),i=(r=t).clientX,o=r.clientY,n.every(function(t){var n,r=t.popperRect,a=t.popperState,u=t.props.interactiveBorder,s=(n=a.placement).split("-")[0],l=a.modifiersData.offset;if(!l)return!0;var c="bottom"===s?l.top.y:0,d="top"===s?l.bottom.y:0,f="right"===s?l.left.x:0,p="left"===s?l.right.x:0,h=r.top-o+c>u,m=o-r.bottom-d>u,g=r.left-i+f>u,y=i-r.right-p>u;return h||m||g||y})&&(F(),en(t)))}function Z(t){if(!(J(t)||x.props.trigger.indexOf("click")>=0&&f)){if(x.props.interactive){x.hideWithInteractivity(t);return}en(t)}}function Y(t){0>x.props.trigger.indexOf("focusin")&&t.target!==M()||x.props.interactive&&t.relatedTarget&&S.contains(t.relatedTarget)||en(t)}function J(t){return!!eii.isTouch&&C()!==t.type.indexOf("touch")>=0}function Q(){X();var n=x.props,r=n.popperOptions,i=n.placement,o=n.offset,a=n.getReferenceClientRect,u=n.moveTransition,s=I()?eib(S).arrow:null,c=a?{getBoundingClientRect:a,contextElement:a.contextElement||M()}:t,d=[{name:"offset",options:{offset:o}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!u}},{name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(t){var n=t.state;if(I()){var r=E().box;["placement","reference-hidden","escaped"].forEach(function(t){"placement"===t?r.setAttribute("data-placement",n.placement):n.attributes.popper["data-popper-"+t]?r.setAttribute("data-"+t,""):r.removeAttribute("data-"+t)}),n.attributes.popper={}}}}];I()&&s&&d.push({name:"arrow",options:{element:s,padding:3}}),d.push.apply(d,(null==r?void 0:r.modifiers)||[]),x.popperInstance=erG(c,S,Object.assign({},r,{placement:i,onFirstUpdate:l,modifiers:d}))}function X(){x.popperInstance&&(x.popperInstance.destroy(),x.popperInstance=null)}function ee(){return er6(S.querySelectorAll("[data-tippy-root]"))}function et(t){x.clearDelayTimeouts(),t&&N("onTrigger",[x,t]),z();var n=j(!0),r=k(),o=r[0],a=r[1];eii.isTouch&&"hold"===o&&a&&(n=a),n?i=setTimeout(function(){x.show()},n):x.show()}function en(t){if(x.clearDelayTimeouts(),N("onUntrigger",[x,t]),!x.state.isVisible){B();return}if(!(x.props.trigger.indexOf("mouseenter")>=0&&x.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(t.type)>=0&&f)){var n=j(!1);n?o=setTimeout(function(){x.state.isVisible&&x.hide()},n):a=requestAnimationFrame(function(){x.hide()})}}}(n,u);return r&&t.push(r),t},[]);return er7(t)?s[0]:s}eiw.defaultProps=eic,eiw.setDefaultProps=eif,eiw.currentInput=eii,Object.assign({},ert,{effect:function(t){var n=t.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}}),eiw.setDefaultProps({render:eix});class eiO{constructor({editor:t,element:n,view:r,tippyOptions:i={},updateDelay:o=250,shouldShow:a}){this.preventHide=!1,this.shouldShow=({view:t,state:n,from:r,to:i})=>{let{doc:o,selection:a}=n,{empty:u}=a,s=!o.textBetween(r,i).length&&etL(n.selection),l=this.element.contains(document.activeElement);return!(!(t.hasFocus()||l)||u||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:t})=>{var n;if(this.preventHide){this.preventHide=!1;return}null!=t&&t.relatedTarget&&!(null===(n=this.element.parentNode)||void 0===n)&&n.contains(t.relatedTarget)||this.hide()},this.tippyBlurHandler=t=>{this.blurHandler({event:t})},this.handleDebouncedUpdate=(t,n)=>{let r=!(null!=n&&n.selection.eq(t.state.selection)),i=!(null!=n&&n.doc.eq(t.state.doc));(r||i)&&(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(t,r,i,n)},this.updateDelay))},this.updateHandler=(t,n,r,i)=>{var o,a,u;let{state:s,composing:l}=t,{selection:c}=s;if(l||!n&&!r)return;this.createTooltip();let{ranges:d}=c,f=Math.min(...d.map(t=>t.$from.pos)),p=Math.max(...d.map(t=>t.$to.pos));if(!(null===(o=this.shouldShow)||void 0===o?void 0:o.call(this,{editor:this.editor,view:t,state:s,oldState:i,from:f,to:p}))){this.hide();return}null===(a=this.tippy)||void 0===a||a.setProps({getReferenceClientRect:(null===(u=this.tippyOptions)||void 0===u?void 0:u.getReferenceClientRect)||(()=>{var n;if((n=s.selection)instanceof Jj){let r=t.nodeDOM(f),i=r.dataset.nodeViewWrapper?r:r.querySelector("[data-node-view-wrapper]");if(i&&(r=i.firstChild),r)return r.getBoundingClientRect()}return function(t,n,r){let i=t.state.doc.content.size,o=etF(n,0,i),a=etF(r,0,i),u=t.coordsAtPos(o),s=t.coordsAtPos(a,-1),l=Math.min(u.top,s.top),c=Math.max(u.bottom,s.bottom),d=Math.min(u.left,s.left),f=Math.max(u.right,s.right),p={top:l,bottom:c,left:d,right:f,width:f-d,height:c-l,x:d,y:l};return{...p,toJSON:()=>p}}(t,f,p)})}),this.show()},this.editor=t,this.element=n,this.view=r,this.updateDelay=o,a&&(this.shouldShow=a),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=i,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){let{element:t}=this.editor.options,n=!!t.parentElement;this.tippy||!n||(this.tippy=eiw(t,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(t,n){let{state:r}=t,i=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(t,n);return}let o=!(null!=n&&n.selection.eq(t.state.selection)),a=!(null!=n&&n.doc.eq(t.state.doc));this.updateHandler(t,o,a,n)}show(){var t;null===(t=this.tippy)||void 0===t||t.show()}hide(){var t;null===(t=this.tippy)||void 0===t||t.hide()}destroy(){var t,n;!(null===(t=this.tippy)||void 0===t)&&t.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),null===(n=this.tippy)||void 0===n||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}}let eik=t=>new J$({key:"string"==typeof t.pluginKey?new JH(t.pluginKey):t.pluginKey,view:n=>new eiO({view:n,...t})});eth.create({name:"bubbleMenu",addOptions:()=>({element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}),addProseMirrorPlugins(){return this.options.element?[eik({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});let eiC=t=>{let[n,r]=(0,o.useState)(null);return(0,o.useEffect)(()=>{if(!n||t.editor.isDestroyed)return;let{pluginKey:r="bubbleMenu",editor:i,tippyOptions:o={},updateDelay:a,shouldShow:u=null}=t,s=eik({updateDelay:a,editor:i,element:n,pluginKey:r,shouldShow:u,tippyOptions:o});return i.registerPlugin(s),()=>i.unregisterPlugin(r)},[t.editor,n]),o.createElement("div",{ref:r,className:t.className,style:{visibility:"hidden"}},t.children)};class eiI extends enz{constructor(){super(...arguments),this.contentComponent=null}}let eiM=({renderers:t})=>o.createElement(o.Fragment,null,Object.entries(t).map(([t,n])=>x.createPortal(n.reactElement,n.element,t)));class eiR extends o.Component{constructor(t){super(t),this.editorContentRef=o.createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let{editor:t}=this.props;if(t&&t.options.element){if(t.contentComponent)return;let n=this.editorContentRef.current;n.append(...t.options.element.childNodes),t.setOptions({element:n}),t.contentComponent=this,t.createNodeViews(),this.initialized=!0}}maybeFlushSync(t){this.initialized?(0,x.flushSync)(t):t()}setRenderer(t,n){this.maybeFlushSync(()=>{this.setState(({renderers:r})=>({renderers:{...r,[t]:n}}))})}removeRenderer(t){this.maybeFlushSync(()=>{this.setState(({renderers:n})=>{let r={...n};return delete r[t],{renderers:r}})})}componentWillUnmount(){let{editor:t}=this.props;if(!t||(this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null,!t.options.element.firstChild))return;let n=document.createElement("div");n.append(...t.options.element.childNodes),t.setOptions({element:n})}render(){let{editor:t,...n}=this.props;return o.createElement(o.Fragment,null,o.createElement("div",{ref:this.editorContentRef,...n}),o.createElement(eiM,{renderers:this.state.renderers}))}}let eiE=o.memo(eiR),eij=(0,o.createContext)({onDragStart:void 0}),eiA=()=>(0,o.useContext)(eij),eiN=o.forwardRef((t,n)=>{let{onDragStart:r}=eiA(),i=t.as||"div";return o.createElement(i,{...t,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...t.style}})});class eiP{constructor(t,{editor:n,props:r={},as:i="div",className:o="",attrs:a}){this.ref=null,this.id=Math.floor(4294967295*Math.random()).toString(),this.component=t,this.editor=n,this.props=r,this.element=document.createElement(i),this.element.classList.add("react-renderer"),o&&this.element.classList.add(...o.split(" ")),a&&Object.keys(a).forEach(t=>{this.element.setAttribute(t,a[t])}),this.render()}render(){var t,n,r,i,a;let u=this.component,s=this.props;("function"==typeof u&&u.prototype&&u.prototype.isReactComponent||"object"==typeof u&&(null===(a=u.$$typeof)||void 0===a?void 0:a.toString())==="Symbol(react.forward_ref)")&&(s.ref=t=>{this.ref=t}),this.reactElement=o.createElement(u,{...s}),null===(n=null===(t=this.editor)||void 0===t?void 0:t.contentComponent)||void 0===n||n.setRenderer(this.id,this)}updateProps(t={}){this.props={...this.props,...t},this.render()}destroy(){var t,n;null===(n=null===(t=this.editor)||void 0===t?void 0:t.contentComponent)||void 0===n||n.removeRenderer(this.id)}}class eiL extends enH{mount(){let t={editor:this.editor,node:this.node,decorations:this.decorations,selected:!1,extension:this.extension,getPos:()=>this.getPos(),updateAttributes:(t={})=>this.updateAttributes(t),deleteNode:()=>this.deleteNode()};if(!this.component.displayName){var n;this.component.displayName=(n=this.extension.name).charAt(0).toUpperCase()+n.substring(1)}let r=t=>{let n=this.component,r=this.onDragStart.bind(this),i=t=>{t&&this.contentDOMElement&&t.firstChild!==this.contentDOMElement&&t.appendChild(this.contentDOMElement)};return o.createElement(o.Fragment,null,o.createElement(eij.Provider,{value:{onDragStart:r,nodeViewContentRef:i}},o.createElement(n,{...t})))};r.displayName="ReactNodeView",this.contentDOMElement=this.node.isLeaf?null:document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement&&(this.contentDOMElement.style.whiteSpace="inherit");let i=this.node.isInline?"span":"div";this.options.as&&(i=this.options.as);let{className:a=""}=this.options;this.renderer=new eiP(r,{editor:this.editor,props:t,as:i,className:`node-${this.node.type.name} ${a}`.trim(),attrs:this.options.attrs})}get dom(){var t;if(this.renderer.element.firstElementChild&&!(!(null===(t=this.renderer.element.firstElementChild)||void 0===t)&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}update(t,n){let r=t=>{this.renderer.updateProps(t)};if(t.type!==this.node.type)return!1;if("function"==typeof this.options.update){let i=this.node,o=this.decorations;return this.node=t,this.decorations=n,this.options.update({oldNode:i,oldDecorations:o,newNode:t,newDecorations:n,updateProps:()=>r({node:t,decorations:n})})}return t===this.node&&this.decorations===n||(this.node=t,this.decorations=n,r({node:t,decorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0})}deselectNode(){this.renderer.updateProps({selected:!1})}destroy(){this.renderer.destroy(),this.contentDOMElement=null}}function eiF(t,n){return r=>r.editor.contentComponent?new eiL(t,r,n):{}}function eiD(t){return setTimeout(()=>{t()})}function eiW(t){let{debouncedUrl:n,content:r,onContentChange:i,selected:a}=t,l=(0,o.useRef)(null),[c,d]=(0,o.useState)(!1);return(0,s.pQ)(n,()=>{var t;c&&(d(!1),null==(t=l.current)||t.reset())}),(0,v.ju)(n)?n===(null==r?void 0:r.embed_url)?M.jsx(eiz,{content:r,selected:a}):M.jsx(u.SV,{ref:l,renderError:eiU,onError:function(){d(!0),i(void 0)},children:M.jsx(o.Suspense,{fallback:r&&M.jsx(eiz,{content:r,selected:a}),children:M.jsx(eiB,{url:n,selected:a,onContentChange:i})})}):null}function eiU(){return M.jsx(u.yO,{title:"There is no embed data available."})}function eiz(t){let{content:n,selected:r}=t;return M.jsx(u.fu,{...function(t){let n="";switch(t.type){case"video":n=t.title??"";break;case"photo":n=`View this post${t.provider_name?` on ${t.provider_name}`:""}`;break;default:n=`Open${t.provider_name?` on ${t.provider_name}`:""}`}return{url:t.embed_url,thumbnail:{url:t.thumbnail_url??"",aspectRatio:"video"===t.type?"16:9":"1:1"},provider:t.provider_name??"",author:t.author_name??"",subtitle:n}}(n),selected:r})}function eiB(t){let{url:n,onContentChange:r,selected:i}=t,a=function(t){let{url:n,onContentChange:r}=t,{embedsUrl:i}=P(),a=(0,d.QT)(eiV,[n,i]),u=(0,s.R9)(r);return(0,o.useEffect)(()=>{let t=eiD(()=>u(a));return()=>{clearTimeout(t)}},[a,u]),a}({url:n,onContentChange:r});return M.jsx(eiz,{content:a,selected:i})}function eiV(t,n){var r;let i=new URL(n);return i.search=new URLSearchParams({url:t}).toString(),(0,p.WY)(i.toString(),{okType:(r=t,tj.object({type:tj.string(),version:tj.string().or(tj.number()).nullish(),title:tj.string().nullish(),author_name:tj.string().nullish(),author_url:tj.string().nullish(),provider_name:tj.string().nullish(),provider_url:tj.string().nullish(),cache_age:tj.string().or(tj.number()).nullish(),thumbnail_url:tj.string().nullish(),thumbnail_width:tj.number().nullish(),thumbnail_height:tj.number().nullish(),html:tj.string().nullish()}).passthrough().transform(t=>{let n={embed_url:r};return{...n,__TYPE__:"EmbedContent",type:t.type,version:t.version,title:t.title,author_name:t.author_name,author_url:t.author_url,provider_name:t.provider_name,provider_url:t.provider_url,cache_age:t.cache_age,thumbnail_url:t.thumbnail_url,thumbnail_width:t.thumbnail_width,thumbnail_height:t.thumbnail_height,html:t.html,all:{...n,...t}}}))})}function ei$(t){let{id:n,readOnly:r,field:i,content:a,onContentChange:l}=t,c=(0,s.$P)({initialState:(null==a?void 0:a.embed_url)??"",startTransition:o.startTransition});function d(t){c.set(t),(0,v.ju)(t)||l(void 0)}return M.jsxs(u.gN,{footer:(0,v.ju)(c.value)&&M.jsx(u.mS,{children:M.jsx(eiW,{debouncedUrl:c.debouncedValue,content:a,onContentChange:l})}),children:[M.jsx(u.fw,{name:"cloud"}),M.jsx(u.Qy,{htmlFor:n,children:Z0(i)}),M.jsx(u.JO,{children:M.jsx(Z5,{id:n,readOnly:r,placeholder:Z1(i),value:c.value,onValueChange:d,variant:(0,v.ju)(c.value)?"link":"normal",endAdornment:M.jsx(u.zx,{startIcon:"close",color:"grey",size:"small",disabled:!c,onClick:()=>d("")})})})]})}function eiq(t){return!(t.lat>85||t.lat<-85||t.lng>180||t.lng<-180)}function eiK(t){let n=t.match(/^.*@(-?\d+.\d+),(-?\d+.\d+).*$/);if(!n)return;let r=parseFloat(n[1]??""),i=parseFloat(n[2]??"");if(isNaN(r)||isNaN(i))return;let o={lat:r,lng:i};if(eiq(o))return o}function eiH(t){return t?`${t.lat}, ${t.lng}`:""}function eiG(t){let n=t.match(/\(?([\d|.|-]*)[\s+]*,[\s]*([\d|.|-]*)\)?/);if(!n)return eiK(t);let r=parseFloat(n[1]??""),i=parseFloat(n[2]??"");if(isNaN(r)||isNaN(i))return eiK(t);let o={lat:r,lng:i};return eiq(o)?o:eiK(t)}function eiZ(t){let{field:n,id:r,readOnly:i,...a}=t,{onValueChange:s,displayedValue:l,onBlur:c,clearValue:d,isValidCoordinates:f}=function(t){let{content:n,onContentChange:r}=t,i=eiH(null==n?void 0:n.position),[a,u]=(0,o.useState)(i),s=Boolean(eiG(a));return{displayedValue:a,isValidCoordinates:s,onValueChange:u,onBlur:function(){let t=eiG(a);if(!t)return u(""),r(void 0);let{lat:n,lng:i}=t;u(eiH({lat:n,lng:i})),r({__TYPE__:"GeoPointContent",position:{lat:n,lng:i}})},clearValue:function(){u(""),r(void 0)}}}(a);return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"place"}),M.jsx(u.Qy,{htmlFor:r,children:Z0(n)}),M.jsx(u.JO,{children:M.jsx(Z5,{id:r,onValueChange:s,placeholder:"...",readOnly:i,value:l,onBlur:c,variant:f?"link":"normal",endAdornment:M.jsx(u.zx,{startIcon:"close",color:"grey",size:"small",disabled:!l,onClick:d})})})]})}let eiY="__MAIN_THUMBNAIL__";function eiJ(t,n,r){let i=t.name===eiY?void 0:t.name,o;return[i,(o=n?(0,c.$)(r)?[r.width,r.height]:(0,c.$)(t.width)||(0,c.$)(t.height)?[t.width??void 0,t.height??void 0]:[n.origin.width,n.origin.height]:void 0)?`${o[0]??"auto"}x${o[1]??"auto"}px`:void 0]}function eiQ(t,n){let{width:r,height:i}=n??{};return r&&i?[r,i]:r?[r,Math.round(t.height*(r/t.width))]:i?[Math.round(t.width*(i/t.height)),i]:[t.width,t.height]}function eiX(t,n,r,i,o){let a=new URL(t);if(o){let{x:u,y:s,width:l,height:c}=n;a.searchParams.set("rect",[u,s,l,c].join(",")),a.searchParams.set("w",r.toString()),a.searchParams.set("h",i.toString())}return a.toString()}function ei0(t){let n=new URL(t);return n.searchParams.delete("q"),n.searchParams.set("w","800"),n.searchParams.set("h","800"),n.searchParams.set("auto","compress,format"),n.searchParams.set("fit","max"),n.toString()}function ei1(t){return null!=t&&t.url?ei0(t.url):void 0}function ei2(t,n){var r;let{width:i,height:o,rect:a}=function(t,n){let[r,i]=eiQ(t,n),o=Math.max(r/t.width,i/t.height),a=Math.round((t.width-r/o)/2),u=Math.round((t.height-i/o)/2);return{width:r,height:i,rect:{x:a,y:u,width:Math.round(r/o),height:Math.round(i/o)}}}({...t,width:(null==t?void 0:t.width)??2e3,height:(null==t?void 0:t.height)??2e3},n),u=Boolean((null==n?void 0:n.width)||(null==n?void 0:n.height));return{url:eiX(t.url,a,i,o,u),alt:t.alt,..."kind"in t&&"extension"in t?{credits:t.credits}:{},origin:{id:t.id,url:t.url,width:t.width??2e3,height:t.height??2e3},width:i,height:o,edit:{background:"transparent",zoom:1,crop:{x:a.x,y:a.y}}}}let ei3=tl({id:e5(),width:e6(),height:e6(),urls:tl({full:e5(),small:e5().transform(function(t){let n=new URL(t);return n.searchParams.delete("q"),n.searchParams.delete("fm"),n.searchParams.set("w","300"),n.searchParams.set("auto","compress,format"),n.toString()})}),alt_description:e5().optional(),description:e5().nullable()}),ei4=tl({results:ts(ei3)}).transform(t=>t.results);function ei5(t,n){let r=new URLSearchParams({page:"1",per_page:"28",query:n});return(0,p.WY)(`${t}/search/photos?${r.toString()}`,{okType:ei4})}function ei6(t){let{onSelectedChange:n}=t,[r,i]=(0,o.useTransition)(),a=(0,s.$P)({initialState:"",ms:300,startTransition:i});return M.jsxs(u.xu,{flexDirection:"column",gap:16,width:"100%",position:"relative",children:[M.jsx(u.CR,{value:a.value,placeholder:"Search on Unsplash.com",onValueChange:a.set}),M.jsx(u.SV,{renderError:()=>M.jsx(t1,{}),children:M.jsx(o.Suspense,{fallback:M.jsx(ei7,{}),children:M.jsx(ei9,{term:a.debouncedValue,loading:r,onSelectedChange:n})})})]})}function ei9(t){let{term:n,onSelectedChange:r,loading:i}=t,{media:a,toggleSelected:l,selectedImageId:c}=function(t){var n;let{term:r,onSelectedChange:i}=t,a=P(),u=function(t,n){let r=(0,o.useRef)(),i=P(),a=(0,d.QT)(ei5,[t,n]);return(0,s.Nr)(n,1e3,()=>{var t;r.current&&n!==r.current&&(null==(t=i.onAnalyticsEvent)||t.call(i,"Unsplash Image Searched")),r.current=n}),a}(a.unsplashUrl,r||"citrus fruit"),l=null==(n=null==u?void 0:u[0])?void 0:n.id,[c,f]=(0,o.useState)();return(0,o.useEffect)(()=>{null==i||i([]),f(void 0)},[l,i]),{media:u,toggleSelected:function(t){if(t.id===c)return f(void 0),null==i?void 0:i([]);f(t.id),null==i||i([{...t,url:t.urls.full,alt:t.alt_description}])},selectedImageId:c}}({term:n,onSelectedChange:r});return M.jsxs(M.Fragment,{children:[M.jsx(ei8,{children:null==a?void 0:a.map(t=>{let n=new URL(t.urls.full).searchParams.get("fm")??"jpg";return M.jsx(u.PB,{url:t.urls.small,filename:t.description??"Unsplash Image",selected:c===t.id,onCardClick:()=>l(t),extension:n,width:t.width,height:t.height,loading:i},t.id)})}),0===a.length&&M.jsx(j,{})]})}function ei8(t){let{children:n}=t;return M.jsx(u.xr,{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 250px), 1fr))",gap:16,paddingBottom:16,position:"relative",width:"100%"},children:n})}function ei7(){return M.jsx(ei8,{children:(0,m.N)(24,M.jsx(nt,{}))})}function eoe(t){let{open:n,onOpenChange:r,onMediaSelected:i,assetType:a}=t,l=P(),c=l.mediaLibrary,[f,p]=(0,o.useState)(()=>c?"media":"unsplash"),[h,m]=(0,o.useState)(new Set),[g,y]=(0,o.useState)([]),v=h.size+g.length,b=(0,d.q_)(tL);function x(t){t||m(new Set),r(t)}(0,o.useEffect)(()=>{n&&c&&tW({config:l,assetType:a})},[n,l,a,c]);let{containerRef:_}=(0,u.VY)();return M.jsxs(u.Vq,{open:n,onOpenChange:x,size:{width:"min(calc(100% - 48px), 2000px)",height:"calc(100% - 30px)"},position:"center",onPointerDownOutside(t){_&&(0,s.DX)(_,t.target)&&t.preventDefault()},children:[M.jsx(u.fK,{icon:"image",title:"Media library"}),M.jsxs(u.Zp,{value:f,onValueChange:function(t){if("media"!==t&&"unsplash"!==t)throw Error(`Invalid option ${t}.`);p(t)},padding:"small",width:"auto",children:[c&&M.jsx(u.T9,{value:"media",icon:"photo"}),M.jsx(u.T9,{value:"unsplash",icon:"unsplash"})]}),M.jsx(u.cZ,{children:M.jsxs(u.xu,{overflow:"hidden",backgroundColor:"grey3",padding:{top:16,right:16,left:16},minHeight:"100%",children:["media"===f&&M.jsx(nv,{assetType:a,onSelectedChange:m}),"unsplash"===f&&M.jsx(ei6,{onSelectedChange:y})]})}),M.jsx(u.kX,{asFooter:!0,ok:{text:"Add to page",onClick:function(){var t;let n=b.flatMap(t=>t.items).filter(t=>h.has(t.id)),r="media"===f?n[0]:g[0];r&&(i(r),x(!1),"unsplash"===f&&(null==(t=l.onAnalyticsEvent)||t.call(l,"Unsplash Image Added")))},disabled:1!==v,disabledTooltip:0===v?"Select a media item to add to the page":v>1?"Only one media item can be added to the page":void 0},cancel:{text:"Cancel"}})]})}function eot(t){let{onMediaSelected:n,readOnly:r,isUpdating:i}=t,[a,s]=(0,o.useState)(!1);return M.jsxs(u.aY,{children:[M.jsx(u.Zb,{color:"grey3",variant:"outlined",radius:4,children:M.jsx(u.aY,{children:M.jsx(u.xu,{padding:{block:48},flexDirection:"column",children:M.jsxs(u.R$,{children:[M.jsx(u.av,{name:"cloudUpload"}),M.jsx(u._T,{children:i?"Preparing your image...":"You haven't selected an image"}),!r&&M.jsx(u.Qj,{children:M.jsx(u.zx,{disabled:i,onClick:()=>s(!0),children:"Select image"})})]})})})}),M.jsx(eoe,{open:a,onOpenChange:s,onMediaSelected:n,assetType:"image"})]})}function eon(t){let{id:n,readOnly:r,altText:i,onValueChange:o,selected:a}=t;return M.jsxs(u.gN,{labelPosition:"side",selected:a,children:[M.jsx(u.Qy,{htmlFor:n,children:"Alt text"}),M.jsx(u.JO,{children:M.jsx(u.oi,{id:n,placeholder:"Short description for the visually impaired",readOnly:r,padding:{input:{inline:16}},value:i,onValueChange:o})})]})}d.Fs.registerFetcherConfig(ei5,{cacheCapacity:5,revalidationStrategy:{type:"never"}});let eor=({contentView:t,constraints:n,croppedImage:r})=>{let[i,o]=eiQ(t.origin,n),a=eiX(t.origin.url,r,i,o,!0);return{...t,width:i,height:o,url:a,edit:{...t.edit,zoom:r.zoom,crop:{x:r.x,y:r.y}}}},eoi=({field:t,content:n,thumbnail:r,croppedImage:i})=>{var o,a,u,s;if(r===eiY){let l=eor({contentView:n,constraints:null==(o=null==t?void 0:t.config)?void 0:o.constraint,croppedImage:i});return l.url===n.url?n:{...n,...l}}let c=null==(u=null==(a=null==t?void 0:t.config)?void 0:a.thumbnails)?void 0:u.find(t=>t.name===r),d=null==(s=n.thumbnails)?void 0:s[r];if(!c||!d)return n;let f=eor({contentView:d,constraints:c,croppedImage:i});return f.url===d.url?n:{...n,thumbnails:{...n.thumbnails,[r]:f}}},eoo=({initialSize:t,constraints:n})=>{let r=null!=n&&n.width&&null!=n&&n.height?n.width/n.height:t.width/t.height,[i,o]=t.width<t.height?[t.width,Math.round(t.width/r)]:[Math.round(t.height*r),t.height],a=Math.max(i/t.width,o/t.height,1);return{width:Math.round(i/a),height:Math.round(o/a)}},eoa=({contentView:t,constraints:n})=>{let r=eoo({initialSize:t.origin,constraints:n}),i=t.edit.zoom??1,o=Math.round(r.width/i),a=Math.round(r.height/i);return{...t.edit.crop,width:o,height:a,zoom:i}};function eou(t){let{image:n,crop:r,onCropChange:i,zoom:o,onZoomChange:a,initialCroppedArea:s,onCropAreaChange:l,aspectRatio:c}=t;return M.jsxs(u.xu,{padding:{inline:24,block:16},flexDirection:"column",gap:16,height:"100%",overflowY:"auto",alignItems:"center",children:[M.jsxs(u.xu,{gap:8,height:32,alignItems:"flex-start",width:"100%",children:[M.jsx(u.zx,{color:"grey",size:"medium",startIcon:"centerFocusWeak",onClick:()=>i(eos)}),M.jsx(u.zx,{color:"grey",size:"medium",startIcon:"zoomOutMap",onClick(){i(eos),a(eol)}})]}),M.jsx(u.fl,{image:n,aspect:c,crop:r,onCropChange:i,zoom:o,onZoomChange:a,initialCroppedAreaPixels:s,onCropAreaChange:(t,n)=>l(n)}),M.jsx(u.xu,{width:"100%",maxWidth:320,children:M.jsx(u.iR,{min:1,max:3,step:.01,value:[o],onValueChange:([t])=>a(t??1)})})]})}let eos={x:0,y:0},eol=1;function eoc(t){var n;let{trigger:r,initialImages:i}=t,{open:a,ready:s,option:l,selectedImage:c,croppedImage:d,setZoom:f,setCropArea:p,setCrop:h,setReady:m,setOption:g,initialCroppedArea:y,cropper:v,onOpenChange:b}=function(t){let{initialImages:n,initialOption:r,onClose:i}=t,[a,u]=(0,o.useState)({}),[s,l]=(0,o.useState)({}),[c,d]=(0,o.useState)(!1),[f,p]=(0,o.useState)(!1),[h,m]=(0,o.useState)(r),g=n[h],y=a[(null==g?void 0:g.thumbnail.name)??""],v=c?y??((null==g?void 0:g.contentView)&&eoa({contentView:g.contentView,constraints:g.thumbnail})):void 0,b=s[(null==g?void 0:g.thumbnail.name)??""];return{open:c,ready:f,option:h,selectedImage:g,croppedImage:y,setZoom:function(t){if(!g)return;let n=g.thumbnail.name,r=a[n]??eod;u({...a,[n]:{...r,zoom:t}})},setCropArea:function(t){if(!g)return;let n=g.thumbnail.name,r=a[n]??eod;u({...a,[n]:{...r,...t}})},setCrop:function(t){if(!g)return;let n=g.thumbnail.name,r=s[n];l({...s,[n]:{...r,crop:t}})},setReady:p,setOption:m,initialCroppedArea:v,onClose:i,cropper:b,onOpenChange:function(t){t?(m(r),u({}),l({})):(p(!1),i({option:h,croppedImages:a})),d(t)}}}(t);return M.jsxs(u.Vq,{trigger:r,onAnimationEnd:()=>m(!0),open:a,onOpenChange:b,children:[M.jsx(u.fK,{icon:"photo",title:"Image editor"}),M.jsx(u.Zp,{value:String(l),onValueChange:t=>g(Number(t)),children:i.map((t,n)=>M.jsx(u.T9,{value:String(n),icon:"photo",title:t.labels[0]??"Main",subtitle:t.labels[1]??""},t.thumbnail.name))}),c&&M.jsx(u.cZ,{children:s&&M.jsx(eou,{image:(null==(n=c.contentView)?void 0:n.origin.url)??"",crop:(null==v?void 0:v.crop)??{x:0,y:0},onCropChange:h,zoom:(null==d?void 0:d.zoom)??1,onZoomChange:f,initialCroppedArea:y,onCropAreaChange:p,aspectRatio:function(t){let{thumbnail:n,contentView:r}=t;return n.width&&n.height?n.width/n.height:r?r.origin.width/r.origin.height:1}(c)},c.thumbnail.name)})]})}let eod={x:0,y:0,width:0,height:0,zoom:1};function eof(t){var n,r;let{content:i,selected:a,fieldLabel:s,readOnly:l,imageLabel:c,onMediaSelected:d,initialImages:f,initialOption:p=0,onCropperDialogClose:h,onClear:m,children:g}=t,[v,b]=(0,o.useState)(!1),x=(null==(r=null==(n=null==i?void 0:i.url)?void 0:n.split("?")[0])?void 0:r.slice(-4))===".svg",_=null!=i&&i.url&&!l?"visible":"hidden";return M.jsxs(u.Zb,{color:a?"indigo2":"grey2",variant:a?"selected":"dashed",radius:4,children:[M.jsxs(u.Ol,{sx:{flexWrap:"wrap"},children:[M.jsxs(u.wP,{children:[M.jsx(u.xv,{noWrap:!0,children:(0,y.tx)(s,30)}),0!==c.length&&M.jsx(u.xv,{color:"grey11",noSelect:!0,children:` • ${c.join(" • ")}`})]}),M.jsxs(u.Pf,{sx:{visibility:_},children:[M.jsx(eoc,{trigger:M.jsx(u.zx,{startIcon:"crop",disabled:x,children:"Crop & Resize"}),initialImages:f,initialOption:p,onClose:h}),M.jsx(u.zx,{startIcon:"imageSearch",onClick:()=>b(!0),children:"Replace"}),M.jsx(u.zx,{onClick:m,startIcon:"delete",children:"Clear"})]})]}),g,M.jsx(eoe,{open:v,onOpenChange:b,onMediaSelected:d,assetType:"image"})]})}function eop(t){let{content:n,field:r,id:i,onContentChange:u,readOnly:s}=t,l=n&&n.origin.url.length>0,{onCropperDialogClose:d,onPageChange:f,onMediaSelected:p,isUpdating:h,page:m,thumbnail:g,allThumbnails:y,allContentViews:v,contentView:b,onClear:x}=function(t){var n;let{content:r,onContentChange:i,field:u}=t,[s,l]=(0,o.useState)(0),[c,d]=(0,o.useTransition)(),f=(n=u,(0,o.useMemo)(()=>{var t,r,i;return[{...null==(r=n.config)?void 0:r.constraint,name:eiY}].concat((null==(i=n.config)?void 0:i.thumbnails)??[])},[n])),p=f[s],h=r?function(t,n){var r,i;let{__TYPE__:o,thumbnails:a,...u}=n,s=null==(i=null==(r=t.config)?void 0:r.thumbnails)?void 0:i.map(({name:t})=>null==a?void 0:a[t]);return[u,...s??[]]}(u,r):void 0,m=null==h?void 0:h[s];return{onCropperDialogClose:function({option:t,croppedImages:n}){if(l(t),!r)return;let o=Object.entries(n).reduce((t,[n,r])=>eoi({field:u,content:t,thumbnail:n,croppedImage:r}),r);o!==r&&d(()=>i(o))},onPageChange:function(t){d(()=>l(t))},onMediaSelected:function(t){if(!p)return;let n=function(t,n,r,i){var o,u,s,l,c,d;if(!r){let f=null==(o=n.config)?void 0:o.thumbnails,p=f&&Object.fromEntries(f.map(t=>[t.name,ei2(i,t)]));return{__TYPE__:"ImageContent",...ei2(i,null==(u=n.config)?void 0:u.constraint),thumbnails:p}}if(t===eiY){let h=ei2(i,null==(s=n.config)?void 0:s.constraint);return h.url===r.url?r:{...r,...h}}let m=null==(c=null==(l=n.config)?void 0:l.thumbnails)?void 0:c.find(n=>n.name===t);if(!m)return r;let g=null==(d=r.thumbnails)?void 0:d[t],y=ei2(i,m);return y.url===(null==g?void 0:g.url)?r:{...r,thumbnails:(0,a.Q8)(r.thumbnails??{},(n,r)=>r===t?y:n)}}(p.name,u,r,t);n!==r&&d(()=>i(n))},isUpdating:c,page:s,thumbnail:p,allThumbnails:f,allContentViews:h,contentView:m,onClear:function(){null==l||l(0),i(void 0)}}}({field:r,content:n,onContentChange:u}),_=Z0(r),S=y.map((t,r)=>{let i=null==v?void 0:v[r];return{thumbnail:t,contentView:i,labels:eiJ(t,n,i)}}),T=g&&l?eiJ(g,n,b).filter(c.$):[];return M.jsx(eof,{content:n,fieldLabel:_,imageLabel:T,initialOption:m,initialImages:S,readOnly:s,onMediaSelected:p,onCropperDialogClose:d,onClear:x,children:M.jsx(o.Suspense,{fallback:M.jsx("div",{style:{height:466}}),children:g&&n&&l&&v?M.jsx(eoh,{allContentViews:v,content:n,contentView:b,id:i,onContentChange:u,onPageChange:f,page:m,readOnly:s,thumbnailName:g.name,isUpdating:h}):M.jsx(eot,{onMediaSelected:p,readOnly:s,isUpdating:h})})})}function eoh(t){let{allContentViews:n,content:r,contentView:i,id:o,onContentChange:a,onPageChange:s,page:l,readOnly:c,thumbnailName:d,isUpdating:f}=t;return M.jsxs(u.aY,{children:[M.jsx(u.lr,{getItemSource:ei1,items:n,onPageChange:s,page:l,style:{height:400},children:t=>(null==t?void 0:t.url)&&M.jsx(u.d$,{src:ei0(t.url),alt:t.alt??void 0,isUpdating:f},`${d}_${t.url}`)}),M.jsx(eon,{id:o,readOnly:c||!i,altText:(null==i?void 0:i.alt)??"",onValueChange(t){i&&a(function(t,n,r,i){let o=0===i.length?void 0:i;return t===eiY?{...n,alt:o}:{...n,thumbnails:{...n.thumbnails,[t]:{...r,alt:o}}}}(d,r,i,t))}})]})}function eom(t){let{content:n,field:r,id:i,onContentChange:o,readOnly:a}=t;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"notes"}),M.jsx(u.Qy,{htmlFor:i,children:Z0(r)}),M.jsx(u.JO,{children:M.jsx(u.Kx,{id:i,placeholder:Z1(r),readOnly:a,paddingLeft:4,paddingRight:12,sx:{flexGrow:1},value:(null==n?void 0:n.value)??"",onChange(t){var n;o((n=t,0===n.length?void 0:{__TYPE__:"FieldContent",type:"Text",value:n}))}})})]})}function eog(t,n,r,i){return(0,h.W7)(t,r,i,30,n)}function eoy(){let t=P();t.searchDocuments||F("searchDocuments");let{coreApiUrl:n,env:r}=t,i=`${n}/repository`,o=(0,d.QT)(h.Ag,[i,r]);return new Set(o.languages.map(t=>({id:t.id,label:t.name})))}function eov(){let t=P();t.searchDocuments||F("searchDocuments");let{coreApiUrl:n,env:r}=t,i=`${n}/repository`,o=(0,d.QT)(h.Mi,[i,r]);return new Set(o.results.map(t=>({id:t,label:t})))}function eob(){let t=P();t.searchDocuments||F("searchDocuments");let{customTypesApiUrl:n,env:r,repository:i}=t,o=(0,d.QT)(h.JY,[n,i,r]);return new Set(o)}function eox(t){return t?(0,g.UI)(t,t=>({id:t,label:t})):new Set}function eo_(t){let{filteredLocales:n,setFilteredLocales:r,filteredTags:i,setFilteredTags:a,filteredCustomTypes:s,setFilteredCustomTypes:l,fixedTags:c,fixedCustomTypes:d}=t;return M.jsxs(M.Fragment,{children:[M.jsx(u.SV,{children:M.jsx(o.Suspense,{fallback:M.jsx(eoS,{selectedValues:n,onSelectedValuesChange:r,label:"Locale",icon:"public",fetchFilters:eoy,multiple:!1}),children:M.jsx(eow,{selectedValues:n,onSelectedValuesChange:r})})}),M.jsx(eoS,{selectedValues:i,fixedSelectedValues:eox(c),onSelectedValuesChange:a,label:"Tags",icon:"label",fetchFilters:eov}),M.jsx(eoS,{selectedValues:s,fixedSelectedValues:eox(d),onSelectedValuesChange:l,label:"Type",icon:"description",fetchFilters:eob})]})}function eoS(t){let[n,r]=(0,o.useState)(!1),i=(0,o.useContext)(d.Nk);return M.jsx(u.SV,{renderError:()=>M.jsx(u.R0,{mode:"error",onErrorRetry:null==i?void 0:i.reset,open:n,setOpen:r,values:new Set,...t}),children:M.jsx(o.Suspense,{fallback:M.jsx(u.R0,{mode:"loading",open:n,setOpen:r,values:new Set,...t}),children:M.jsx(eoT,{open:n,setOpen:r,...t})})})}function eoT(t){let{open:n,setOpen:r,onSelectedValuesChange:i,fixedSelectedValues:o,selectedValues:a,label:s,icon:l,fetchFilters:c,multiple:d}=t,f=c();return M.jsx(u.R0,{open:n,setOpen:r,label:s,icon:l,selectedValues:a,values:new Set(f),fixedSelectedValues:o,onSelectedValuesChange:i,multiple:d})}function eow(t){let{selectedValues:n,onSelectedValuesChange:r}=t,[i,a]=(0,o.useState)((0,g.Ps)(n)),u=(0,g.sE)(eoy(),t=>{var r;return t.id===(null==(r=(0,g.Ps)(n))?void 0:r.id)});return(null==u?void 0:u.label)!==(null==i?void 0:i.label)&&a(u),M.jsx(eoS,{selectedValues:new Set(i?[i]:[]),onSelectedValuesChange:function(t){r(t),a((0,g.Ps)(t))},label:"Locale",icon:"public",fetchFilters:eoy,multiple:!1})}function eoO(t){let{onSelectDocument:n,fixedCustomTypes:r,fixedTags:i,...a}=t,l=P(),{searchTerm:c,filteredTags:d,setFilteredTags:f,filteredCustomTypes:p,setFilteredCustomTypes:h,filteredLocales:m,setFilteredLocales:y,typesFilter:v,tagsFilter:b}=function(t,n){let r=P(),i=(0,s.$P)({initialState:""}),[a,u]=(0,o.useState)(new Set),[l,c]=(0,o.useState)(new Set),[d,f]=(0,o.useState)(function(){return r.searchDocuments&&r.localeId?new Set([{id:r.localeId,label:r.localeId}]):new Set}),p=(0,g.G0)(l,eox(t)),h=(0,g.G0)(a,eox(n));return{searchTerm:i,filteredTags:a,setFilteredTags:u,filteredCustomTypes:l,setFilteredCustomTypes:c,filteredLocales:d,setFilteredLocales:f,typesFilter:p,tagsFilter:h}}(r,i),[x,_]=(0,o.useTransition)(),S=(0,s.$P)({initialState:x,ms:100}),{searchDocuments:T}=P();return M.jsx(u.Vq,{size:{height:727,width:656},hasClose:!1,...a,children:M.jsx(u.cZ,{children:M.jsxs(u.xu,{flexDirection:"column",height:"100%",children:[M.jsxs(u.xu,{padding:{top:16,inline:16},flexDirection:"column",gap:12,children:[M.jsx(u.yt,{value:c.value,onValueChange:c.set,placeholder:"Search a page",icon:"search"}),T&&M.jsx(eo_,{filteredTags:d,setFilteredTags:f,filteredCustomTypes:p,setFilteredCustomTypes:h,filteredLocales:m,setFilteredLocales:y,fixedTags:i,fixedCustomTypes:r}),M.jsx(u.xv,{variant:"smallBold",color:"grey11",children:"Link to a document"})]}),l.searchDocuments?M.jsx(u.SV,{renderError:eoC,children:M.jsx(o.Suspense,{children:M.jsx(eoI,{searchTerm:c.debouncedValue,tagsFilter:b,typesFilter:v,localesFilter:m,startTransition:_,onSelectDocument:n})})}):M.jsx(eoM,{message:"Slice Machine does not yet support mock data for linked documents in the simulator."}),M.jsx(eok,{debouncedIsLoading:S.debouncedValue})]})})})}function eok(t){return M.jsx(u.FN,{anchor:M.jsx(u.xu,{position:"relative",width:"100%",justifyContent:"center",bottom:72}),loadingIndicator:!0,open:t.debouncedIsLoading,title:"Loading more results ...",seconds:1})}function eoC(){return M.jsx(u.xu,{height:"100%",flexDirection:"column",alignItems:"center",justifyContent:"center",children:M.jsx(u.Iq,{title:"Request failed",description:"An error occurred while fetching documents.",errorImageSrc:u.Os})})}function eoI(t){let{searchTerm:n,tagsFilter:r,typesFilter:i,localesFilter:a,startTransition:s,onSelectDocument:l}=t,{documents:c,onHasReachedBottom:p}=function(t){var n,r;let{searchTerm:i,tagsFilter:a,typesFilter:u,localesFilter:s}=t,l=P();l.searchDocuments||F("searchDocuments");let{coreApiUrl:c,env:p,status:m}=l,[y,v]=(0,o.useState)(""),[b,x]=(0,o.useState)([]),[_,S]=(0,o.useState)(""),T=new URLSearchParams((0,h.fW)([{name:"tags",values:[...(0,g.UI)(a,t=>t.id)]},{name:"customTypes",values:[...(0,g.UI)(u,t=>t.id)]},{name:"language",values:[...(0,g.UI)(s,t=>t.id)]},{name:"status",values:h.Vu[m]},{name:"term",values:[i]}])).toString(),w=(0,d.QT)(eog,[c,T===_?y:"",p,T]);return T!==_?(S(T),v(""),x(w.results)):w.results.length>0&&(null==(n=(0,f.Z$)(b))?void 0:n.id)!==(null==(r=(0,f.Z$)(w.results))?void 0:r.id)&&x(t=>t.concat(w.results)),{documents:b,onHasReachedBottom:function(){w.cursor&&v(w.cursor)},response:w}}({searchTerm:n,tagsFilter:r,localesFilter:a,typesFilter:i}),m=P();return M.jsx(u.xr,{onScrollToBottom:()=>s(p),style:{height:"100%",gap:u.TV.space[16],paddingTop:u.TV.space[10],paddingBottom:u.TV.space[16],paddingInline:u.TV.space[16]},children:M.jsxs(u.xu,{flexDirection:"column",gap:12,height:"100%",children:[0===c.length&&M.jsx(eoM,{}),c.map(t=>{let n=t.versions[0];if(!n)return null;let i=(0,b.u)({documentId:t.id,versionId:"archived"===n.status?n.version_id:void 0,releaseId:"release"===n.status?n.release_id:void 0,status:n.status,env:m.env}),o=function(t){let{tags:n,tagsFilter:r}=t,i=[...r].map(t=>t.label).reverse();return(0,f.DY)(n,t=>-i.indexOf(t))}({tags:n.tags,tagsFilter:r});return M.jsx(u.z4,{documentType:n.custom_type_label,documentURL:i,description:n.preview_summary,tags:o,title:t.title,previewImageUrl:n.preview_image,onSelect:()=>l(t.id),statusColor:O[n.status].color},`${t.id}-${n.status}`)})]})})}function eoM(t){let{message:n="We can't find any versions matching this request"}=t;return M.jsx(u.xu,{justifyContent:"center",flexDirection:"column",height:"100%",children:M.jsxs(u.R$,{children:[M.jsx(u.av,{name:"close",lineColor:"purple10",backgroundColor:"purple3",borderColor:"purple6",borderStyle:"dashed",size:"xlarge"}),M.jsx(u._T,{size:"big",children:"Oops!"}),M.jsx(u.nf,{width:360,children:n})]})})}function eoR(t){let{hasLink:n,onUnlink:r,selectEnabled:i,selectedType:o,onValueChange:a,openInNewTab:s=!0,setOpenInNewTab:l}=t;return M.jsxs(M.Fragment,{children:[l&&"web"===o&&M.jsx(u.zx,{startIcon:s?"checkBox":"checkBoxOutlinedBlank",color:"grey",size:"small",onClick:()=>l(!s),children:"Open in new tab"}),M.jsxs(u.Ph,{value:o,color:"grey",size:"small",boldTriggerText:!0,startIcon:function(t){if(t)switch(t){case"document":return"description";case"web":return"public";case"media":return"image"}}(o),disabled:!i,onValueChange:a,placeholder:"Choose link type",children:[M.jsx(u.Ql,{value:"web",icon:"public",children:"Link to web page"}),M.jsx(u.Ql,{value:"document",icon:"description",children:"Link to Prismic page"}),M.jsx(u.Ql,{value:"media",icon:"image",children:"Link to media"})]}),M.jsx(u.zx,{startIcon:"close",color:"grey",size:"small",disabled:!n,onClick:r})]})}d.Fs.registerFetcherConfig(eog,{cacheCapacity:500,revalidationStrategy:{type:"never"}});let eoE={DocumentLink:"document",ExternalLink:"web",FileLink:"media",ImageLink:"media"},eoj={document:"DocumentLink",web:"ExternalLink",media:"FileLink"},eoA=tl({id:e5(),title:e5()});function eoN(t,n,r){return(0,p.WY)(`${t}/documents/${r}`,{credentials:(0,p.xb)(n),okType:eoA})}function eoP(t){var n,r,i,o,a,u;let{media:s}=t,l="kind"in s;return l&&"image"===s.kind?{__TYPE__:"LinkContent",value:{__TYPE__:"ImageLink",id:s.id,name:s.filename,url:s.url,kind:s.kind,size:s.size.toString(),height:(null==(n=s.height)?void 0:n.toString())??"2000",width:(null==(r=s.width)?void 0:r.toString())??"2000",date:(null==(i=s.last_modified)?void 0:i.toString())??""}}:l?{__TYPE__:"LinkContent",value:{__TYPE__:"FileLink",id:s.id,name:s.filename,kind:s.kind,url:s.url,size:s.size.toString(),date:(null==(o=s.last_modified)?void 0:o.toString())??""}}:{__TYPE__:"LinkContent",value:{__TYPE__:"ImageLink",id:s.id,name:(null==s?void 0:s.alt)??s.url,kind:"image",url:s.url,size:"0",height:(null==(a=s.height)?void 0:a.toString())??"2000",width:(null==(u=s.width)?void 0:u.toString())??"2000"}}}function eoL(t){var n,r;let{content:i,field:a,id:l,onContentChange:c,readOnly:d}=t,[f,p]=(0,o.useState)(!1),[h,m]=(0,o.useState)(!1),[g,y]=(0,o.useState)(!1),[b,x]=(0,o.useState)(!1),{contentType:_,fieldValue:S,errorBoundaryRef:T,onDocumentSelected:w,onError:O,onMediaSelected:k,...C}=function(t){var n;let{field:r,content:i,onContentChange:a}=t,u=i?"DocumentLink"===i.value.__TYPE__?i.value.id:"ExternalLink"===i.value.__TYPE__?i.value.url:i.value.name:"",[l,c]=(0,o.useState)(()=>{var t,n;return!(null!=(t=r.config)&&t.select)||null!=i&&i.value.__TYPE__?null==i?void 0:i.value.__TYPE__:eoj[null==(n=r.config)?void 0:n.select]}),[d,f]=(0,o.useState)(()=>(null==i?void 0:i.value.__TYPE__)==="ExternalLink"?i.value.target:""),[p,h]=(0,o.useState)(!1),m=(0,o.useRef)(null);(0,s.pQ)(u,function(){var t;p&&(h(!1),null==(t=m.current)||t.reset())});let g=l?eoE[l]:void 0;function y(t){if(!t)return a(void 0);switch(l){case"ExternalLink":return a({__TYPE__:"LinkContent",value:{__TYPE__:"ExternalLink",url:t,target:d}});case"DocumentLink":return a({__TYPE__:"LinkContent",value:{__TYPE__:"DocumentLink",id:t}});default:return a(void 0)}}function v(t){y(t)}return{contentType:l,selectType:g,fieldValue:u,onValueChange:y,onTypeChange:function(t){c(eoj[t]),y("")},placeholder:Z1(r),isTypeSelectEnabled:!(null!=(n=r.config)&&n.select),onDocumentSelected:v,onError:function(){h(!0)},errorBoundaryRef:m,isTargetNewTab:"_blank"===d,updateWebLinkTarget:function(t){let n=t?"_blank":null;f(n),a({__TYPE__:"LinkContent",value:{__TYPE__:"ExternalLink",url:u,target:n}})},onMediaSelected:function(t){a(eoP({media:t}))}}}({content:i,field:a,onContentChange:c}),I="ExternalLink"===_&&(0,v.ju)(S),R={id:l,contentType:_,onBlur:()=>p(!1),onFocus(){p(!0),"DocumentLink"===_&&y(!0),"FileLink"===_&&x(!0),"ImageLink"===_&&x(!0)},readOnly:d||!_,textType:I||"ImageLink"===_||"FileLink"===_?"link":"normal",value:S,...C},{searchDocuments:E}=P();return M.jsxs(M.Fragment,{children:[M.jsxs(u.J2,{onMouseOverChange:m,open:f||h,align:"start",sideOffset:-3,openDelay:100,closeDelay:200,focusOnEnter:!1,anchor:M.jsxs(u.gN,{onMouseOverChange:p,children:[M.jsx(u.fw,{name:"link"}),M.jsx(u.Qy,{htmlFor:l,children:Z0(a)}),M.jsx(u.JO,{children:"DocumentLink"===_&&""!==S&&E?M.jsx(eoW,{errorBoundaryRef:T,onError:O,fallback:M.jsx(eoF,{...R,value:"..."}),renderError(){var t;return t=R,M.jsx(eoF,{...t,textType:"link"})},children:M.jsx(eoD,{...R,documentId:S,openDocumentListModal:()=>y(!0)})}):M.jsx(eoF,{...R})})]}),children:[I&&M.jsx(u.oZ,{url:I,title:(0,v.S$)(I)??"",subTitle:I.toString()}),(null==i?void 0:i.value.__TYPE__)==="ImageLink"&&M.jsx(u.Qi,{url:i.value.url,title:i.value.name,subTitle:`${i.value.width} x ${i.value.height} pixels`})]}),M.jsx(eoe,{open:b,onOpenChange:x,onMediaSelected:k,assetType:"all"}),M.jsx(eoO,{open:g,onOpenChange:y,onSelectDocument(t){y(!1),w(t)},fixedCustomTypes:new Set(null==(n=a.config)?void 0:n.customtypes),fixedTags:new Set(null==(r=a.config)?void 0:r.tags)})]})}function eoF(t){let{id:n,onValueChange:r,placeholder:i,readOnly:o,value:a,textType:u,onFocus:s,onBlur:l,contentType:c,isTypeSelectEnabled:d,selectType:f,onTypeChange:p,isTargetNewTab:h,updateWebLinkTarget:m}=t,g="DocumentLink"===c||"ImageLink"===c||"FileLink"===c;return M.jsx(Z5,{id:n,onValueChange:r,placeholder:i,readOnly:o||g,value:a,variant:u,onFocus:s,onBlur:l,cursor:g?"pointer":"text",endAdornment:M.jsx(eoR,{hasLink:Boolean(a),onUnlink:()=>r(""),selectEnabled:d,selectedType:f,onValueChange:p,openInNewTab:h,setOpenInNewTab:m})})}function eoD(t){let{id:n,documentId:r,openDocumentListModal:i,onValueChange:o,isTypeSelectEnabled:a,selectType:u,onTypeChange:s}=t,l=function(t){let n=P();n.searchDocuments||F("searchDocuments");let{coreApiUrl:r,env:i}=n;return(0,d.QT)(eoN,[r,i,t]).title}(r);return M.jsx(Z5,{id:n,readOnly:!0,value:l,variant:"link",onFocus:i,cursor:"pointer",endAdornment:M.jsx(eoR,{hasLink:!0,onUnlink:()=>o(""),selectEnabled:a,selectedType:u,onValueChange:s})})}function eoW(t){let{errorBoundaryRef:n,onError:r,children:i,fallback:a,renderError:s}=t;return M.jsx(u.SV,{ref:n,onError:r,renderError:s,children:M.jsx(o.Suspense,{fallback:a,children:i})})}let eoU=({content:t,field:n,id:r,onContentChange:i,readOnly:o})=>{var a,s;let l=Number(null==t?void 0:t.value),c=Number.isFinite(l)?l:void 0;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"pin"}),M.jsx(u.Qy,{htmlFor:r,children:Z0(n)}),M.jsx(u.JO,{children:M.jsx(u.Y2,{id:r,value:c,min:null==(a=n.config)?void 0:a.min,max:null==(s=n.config)?void 0:s.max,padding:Z6,placeholder:Z1(n),readOnly:o,onValueChange(t){var n;return i((n=t,void 0===n?void 0:{__TYPE__:"FieldContent",type:"Number",value:String(n)}))}})})]})};var eoz=function(){};eoz.prototype.append=function(t){return t.length?(t=eoz.from(t),!this.length&&t||t.length<200&&this.leafAppend(t)||this.length<200&&t.leafPrepend(this)||this.appendInner(t)):this},eoz.prototype.prepend=function(t){return t.length?eoz.from(t).append(this):this},eoz.prototype.appendInner=function(t){return new eoV(this,t)},eoz.prototype.slice=function(t,n){return void 0===t&&(t=0),void 0===n&&(n=this.length),t>=n?eoz.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))},eoz.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},eoz.prototype.forEach=function(t,n,r){void 0===n&&(n=0),void 0===r&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)},eoz.prototype.map=function(t,n,r){void 0===n&&(n=0),void 0===r&&(r=this.length);var i=[];return this.forEach(function(n,r){return i.push(t(n,r))},n,r),i},eoz.from=function(t){return t instanceof eoz?t:t&&t.length?new eoB(t):eoz.empty};var eoB=function(t){function n(n){t.call(this),this.values=n}t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n;var r={length:{configurable:!0},depth:{configurable:!0}};return n.prototype.flatten=function(){return this.values},n.prototype.sliceInner=function(t,r){return 0==t&&r==this.length?this:new n(this.values.slice(t,r))},n.prototype.getInner=function(t){return this.values[t]},n.prototype.forEachInner=function(t,n,r,i){for(var o=n;o<r;o++)if(!1===t(this.values[o],i+o))return!1},n.prototype.forEachInvertedInner=function(t,n,r,i){for(var o=n-1;o>=r;o--)if(!1===t(this.values[o],i+o))return!1},n.prototype.leafAppend=function(t){if(this.length+t.length<=200)return new n(this.values.concat(t.flatten()))},n.prototype.leafPrepend=function(t){if(this.length+t.length<=200)return new n(t.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(n.prototype,r),n}(eoz);eoz.empty=new eoB([]);var eoV=function(t){function n(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},n.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},n.prototype.forEachInner=function(t,n,r,i){var o=this.left.length;if(n<o&&!1===this.left.forEachInner(t,n,Math.min(r,o),i)||r>o&&!1===this.right.forEachInner(t,Math.max(n-o,0),Math.min(this.length,r)-o,i+o))return!1},n.prototype.forEachInvertedInner=function(t,n,r,i){var o=this.left.length;if(n>o&&!1===this.right.forEachInvertedInner(t,n-o,Math.max(r,o)-o,i+o)||r<o&&!1===this.left.forEachInvertedInner(t,Math.min(n,o),r,i))return!1},n.prototype.sliceInner=function(t,n){if(0==t&&n==this.length)return this;var r=this.left.length;return n<=r?this.left.slice(t,n):t>=r?this.right.slice(t-r,n-r):this.left.slice(t,r).append(this.right.slice(0,n-r))},n.prototype.leafAppend=function(t){var r=this.right.leafAppend(t);if(r)return new n(this.left,r)},n.prototype.leafPrepend=function(t){var r=this.left.leafPrepend(t);if(r)return new n(r,this.right)},n.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new n(this.left,new n(this.right,t)):new n(this,t)},n}(eoz);class eo${constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(0==this.eventCount)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(o=(i=this.remapping(r,this.items.length)).maps.length);let a=t.tr,u,s,l=[],c=[];return this.items.forEach((t,n)=>{if(!t.step){i||(o=(i=this.remapping(r,n+1)).maps.length),o--,c.push(t);return}if(i){c.push(new eoq(t.map));let d=t.step.map(i.slice(o)),f;d&&a.maybeStep(d).doc&&(f=a.mapping.maps[a.mapping.maps.length-1],l.push(new eoq(f,void 0,void 0,l.length+c.length))),o--,f&&i.appendMap(f,o)}else a.maybeStep(t.step);if(t.selection)return u=i?t.selection.map(i.slice(o)):t.selection,s=new eo$(this.items.slice(0,r).append(c.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:s,transform:a,selection:u}}addTransform(t,n,r,i){var o,a;let u=[],s=this.eventCount,l=this.items,c=!i&&l.length?l.get(l.length-1):null;for(let d=0;d<t.steps.length;d++){let f=t.steps[d].invert(t.docs[d]),p=new eoq(t.mapping.maps[d],f,n),h;(h=c&&c.merge(p))&&(p=h,d?u.pop():l=l.slice(0,l.length-1)),u.push(p),n&&(s++,n=void 0),i||(c=p)}let m=s-r.depth,g;return m>eoH&&(o=l,a=m,l=(o.forEach((t,n)=>{if(t.selection&&0==a--)return g=n,!1}),o.slice(g)),s-=m),new eo$(l.append(u),s)}remapping(t,n){let r=new Y1;return this.items.forEach((n,i)=>{let o=null!=n.mirrorOffset&&i-n.mirrorOffset>=t?r.maps.length-n.mirrorOffset:void 0;r.appendMap(n.map,o)},t,n),r}addMaps(t){return 0==this.eventCount?this:new eo$(this.items.append(t.map(t=>new eoq(t))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=t.mapping,a=t.steps.length,u=this.eventCount;this.items.forEach(t=>{t.selection&&u--},i);let s=n;this.items.forEach(n=>{let i=o.getMirror(--s);if(null==i)return;a=Math.min(a,i);let l=o.maps[i];if(n.step){let c=t.steps[i].invert(t.docs[i]),d=n.selection&&n.selection.map(o.slice(s+1,i));d&&u++,r.push(new eoq(l,c,d))}else r.push(new eoq(l))},i);let l=[];for(let c=n;c<a;c++)l.push(new eoq(o.maps[c]));let d=this.items.slice(0,i).append(l).append(r),f=new eo$(d,u);return f.emptyItemCount()>500&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],o=0;return this.items.forEach((a,u)=>{if(u>=t)i.push(a),a.selection&&o++;else if(a.step){let s=a.step.map(n.slice(r)),l=s&&s.getMap();if(r--,l&&n.appendMap(l,r),s){let c=a.selection&&a.selection.map(n.slice(r));c&&o++;let d=new eoq(l.invert(),s,c),f,p=i.length-1;(f=i.length&&i[p].merge(d))?i[p]=f:i.push(d)}}else a.map&&r--},this.items.length,0),new eo$(eoz.from(i.reverse()),o)}}eo$.empty=new eo$(eoz.empty,0);class eoq{constructor(t,n,r,i){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new eoq(n.getMap().invert(),n,this.selection)}}}class eoK{constructor(t,n,r,i,o){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}let eoH=20;function eoG(t){let n=[];return t.forEach((t,r,i,o)=>n.push(i,o)),n}function eoZ(t,n){if(!t)return null;let r=[];for(let i=0;i<t.length;i+=2){let o=n.map(t[i],1),a=n.map(t[i+1],-1);o<=a&&r.push(o,a)}return r}function eoY(t,n,r,i){let o=eoX(n),a=eo0.get(n).spec.config,u=(i?t.undone:t.done).popEvent(n,o);if(!u)return;let s=u.selection.resolve(u.transform.doc),l=(i?t.done:t.undone).addTransform(u.transform,n.selection.getBookmark(),a,o),c=new eoK(i?l:u.remaining,i?u.remaining:l,null,0,-1);r(u.transform.setSelection(s).setMeta(eo0,{redo:i,historyState:c}).scrollIntoView())}let eoJ=!1,eoQ=null;function eoX(t){let n=t.plugins;if(eoQ!=n){eoJ=!1,eoQ=n;for(let r=0;r<n.length;r++)if(n[r].spec.historyPreserveItems){eoJ=!0;break}}return eoJ}let eo0=new JH("history"),eo1=new JH("closeHistory"),eo2=(t,n)=>{let r=eo0.getState(t);return!!r&&0!=r.done.eventCount&&(n&&eoY(r,t,n,!1),!0)},eo3=(t,n)=>{let r=eo0.getState(t);return!!r&&0!=r.undone.eventCount&&(n&&eoY(r,t,n,!0),!0)},eo4=eth.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:t,dispatch:n})=>eo2(t,n),redo:()=>({state:t,dispatch:n})=>eo3(t,n)}),addProseMirrorPlugins(){return[function(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new J$({key:eo0,state:{init:()=>new eoK(eo$.empty,eo$.empty,null,0,-1),apply:(n,r,i)=>(function(t,n,r,i){let o=r.getMeta(eo0),a;if(o)return o.historyState;r.getMeta(eo1)&&(t=new eoK(t.done,t.undone,null,0,-1));let u=r.getMeta("appendedTransaction");if(0==r.steps.length)return t;if(u&&u.getMeta(eo0))return u.getMeta(eo0).redo?new eoK(t.done.addTransform(r,void 0,i,eoX(n)),t.undone,eoG(r.mapping.maps[r.steps.length-1]),t.prevTime,t.prevComposition):new eoK(t.done,t.undone.addTransform(r,void 0,i,eoX(n)),null,t.prevTime,t.prevComposition);if(!1===r.getMeta("addToHistory")||u&&!1===u.getMeta("addToHistory"))return(a=r.getMeta("rebased"))?new eoK(t.done.rebased(r,a),t.undone.rebased(r,a),eoZ(t.prevRanges,r.mapping),t.prevTime,t.prevComposition):new eoK(t.done.addMaps(r.mapping.maps),t.undone.addMaps(r.mapping.maps),eoZ(t.prevRanges,r.mapping),t.prevTime,t.prevComposition);{let s=r.getMeta("composition"),l=0==t.prevTime||!u&&t.prevComposition!=s&&(t.prevTime<(r.time||0)-i.newGroupDelay||!function(t,n){if(!n)return!1;if(!t.docChanged)return!0;let r=!1;return t.mapping.maps[0].forEach((t,i)=>{for(let o=0;o<n.length;o+=2)t<=n[o+1]&&i>=n[o]&&(r=!0)}),r}(r,t.prevRanges)),c=u?eoZ(t.prevRanges,r.mapping):eoG(r.mapping.maps[r.steps.length-1]);return new eoK(t.done.addTransform(r,l?n.selection.getBookmark():void 0,i,eoX(n)),eo$.empty,c,r.time,s??t.prevComposition)}})(r,i,n,t)},config:t,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,i="historyUndo"==r?eo2:"historyRedo"==r?eo3:null;return!!i&&(n.preventDefault(),i(t.state,t.dispatch))}}}})}(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),eo5=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,eo6=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,eo9=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,eo8=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,eo7=enq.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!==t.style.fontWeight&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],renderHTML({HTMLAttributes:t}){return["strong",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[enB({find:eo5,type:this.type}),enB({find:eo9,type:this.type})]},addPasteRules(){return[enG({find:eo6,type:this.type}),enG({find:eo8,type:this.type})]}});var eae,eat,ean=((eae=ean||{}).Document="document",eae.Mark="mark",eae.Node="node",eae),ear=((eat=ear||{}).Text="text",eat.Embed="embed",eat.Image="image",eat);class eai{constructor(t,n,r,i,o,a=!1){w(this,"extType","node"),w(this,"nodeType","text"),this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i,this.placeholder=o,this.lockedFormat=a}}function eao(t){return t instanceof eai}class eaa extends eai{constructor(t,n,r,i,o){super(t,"heading",n,i,o),this.levels=r}}class eau extends eai{constructor(t,n,r,i){super(t,n,r,i)}}function eas(t){return t instanceof eau}let eal=enK.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:t}){return["br",ee5(this.options.HTMLAttributes,t)]},renderText:()=>`
|
|
93
93
|
`,addCommands(){return{setHardBreak:()=>({commands:t,chain:n,state:r,editor:i})=>t.first([()=>t.exitCode(),()=>t.command(()=>{let{selection:t,storedMarks:o}=r;if(t.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:u}=i.extensionManager,s=o||t.$to.parentOffset&&t.$from.marks();return n().insertContent({type:this.name}).command(({tr:t,dispatch:n})=>{if(n&&s&&a){let r=s.filter(t=>u.includes(t.type.name));t.ensureMarks(r)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),eac={isHardBreak:t=>t.type.name===eal.name,children:{reduce(t,n,r){let i=r;return t.forEach((t,r,o)=>{i=n(i,t,o)}),i},map(t,n){return this.reduce(t,(t,r)=>[...t,n(r)],[])},exists(t,n){return this.reduce(t,(t,r)=>t||n(r),!1)},filter(t,n){return this.reduce(t,(t,r)=>[...t,...n(r)?[r]:[]],[])}},marks:{reduce(t,n,r){let i=r;return t.marks.forEach((t,r)=>{i=n(i,t,r)}),i},map(t,n){return this.reduce(t,(t,r)=>[...t,n(r)],[])},filter(t,n){return this.reduce(t,(t,r)=>[...t,...n(r)?[r]:[]],[])}}};function ead(){return{extensions:ela(),defaultTextConverter:void 0}}let eaf=eo7.extend({name:"bold"}),eap=new class{constructor(t,n,r){w(this,"extType",ean.Mark),w(this,"richTextNodeTypes",qJ.RichTextNodeType.strong),this.name=t,this.component=n,this.converter=r}}(eaf.name,eaf,{fromPrismic:t=>function(){var n;return null==(n=t.marks[eaf.name])?void 0:n.create()},toPrismic(){}}),eah=enK.create({name:"listItem",addOptions:()=>({HTMLAttributes:{}}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:t}){return["li",ee5(this.options.HTMLAttributes,t),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)}}}),eam=enq.create({name:"textStyle",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"span",getAttrs:t=>!!t.hasAttribute("style")&&{}}],renderHTML({HTMLAttributes:t}){return["span",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:n})=>{let r=enu(t,this.type);return!!Object.entries(r).some(([,t])=>!!t)||n.unsetMark(this.name)}}}}),eag=/^\s*([-+*])\s$/,eay=enK.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:t}){return["ul",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:n})=>this.options.keepAttributes?n().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(eah.name,this.editor.getAttributes(eam.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=en$({find:eag,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=en$({find:eag,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(eam.name),editor:this.editor})),[t]}}),eav=enK.create({name:"doc",topNode:!0,content:"block+"}),eab=enK.create({name:"listItem",addOptions:()=>({HTMLAttributes:{}}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:t}){return["li",ee5(this.options.HTMLAttributes,t),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)}}}),eax=eab.extend({name:"listItem",content:"paragraph*",addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name)}}}),ea_={component:eax,converter:{fromPrismic:t=>function(n){var r;let i=esv.converter.fromPrismic(t)(n);if(i)return null==(r=t.nodes[eax.name])?void 0:r.create({},i)},toPrismic:(t,n)=>eac.children.reduce(t,(t,r)=>{let i=esv.converter.toPrismic(r),o=i instanceof Array?i.map(t=>({...t,type:n})):i?[{...i,type:n}]:[];return[...t,...o]},[])},placeholder:"List"},eaS="document",eaT=t=>eav.extend({name:eaS,content:t?"block+":"block"}),eaw=t=>({fromPrismic(n,r){function i(t,n){return!n&&r&&n0.TextBlock.is(t)?r(t):n}return function(r){var o;let a=r.value.reduce((r,o)=>{let a=t.find(t=>t.richTextNodeTypes.includes(o.type)),u=function(t){let{ext:n,block:r,schema:i}=t;if(n)switch(n.nodeType){case ear.Embed:return n0.EmbedBlock.is(r)?n.converter.fromPrismic(i)(r):void 0;case ear.Text:return n0.TextBlock.is(r)?n.converter.fromPrismic(i)(r):void 0;case ear.Image:return n0.ImageBlock.is(r)?n.converter.fromPrismic(i)(r):void 0;default:return}}({ext:a,block:o,schema:n}),s=r.slice(0,r.length-1),l=(0,f.Z$)(r),c=function(t){var n,r;let{node:i,block:o,nodeWithDefault:a,previousNode:u}=t;return i&&u?i.type.name===u.type.name&&(i.type.name===esC.name||i.type.name===eli.name)?{merged:!0,updatedNode:u.copy(u.content.append(i.content))}:{merged:!1,updatedNode:a(o,i)}:{merged:!1,updatedNode:i}}({node:u,block:o,nodeWithDefault:i,previousNode:l});return c.updatedNode?[...c.merged?s:r,c.updatedNode]:r},[]);return null==(o=n.nodes[eaS])?void 0:o.create({},a)}},toPrismic:n=>({__TYPE__:"StructuredTextContent",value:[...eac.children.reduce(n,(n,r)=>{let i=Object.values(t).find(t=>r.type.name===t.name),o=null==i?void 0:i.converter.toPrismic(r);return o||console.warn(`Cannot convert node of type '${r.type.name}'.`),o?[...n,...o instanceof Array?o:[o]]:n},[])]})}),eaO=new class{constructor(t,n,r){w(this,"extType","document"),this.name=t,this.component=n,this.converter=r}}(eaS,eaT,eaw),eak=eal.extend({name:"hard_break"}),eaC=`
|
|
94
94
|
`,eaI={fromPrismic:t=>function(n){var r;if(n===eaC)return null==(r=t.nodes[eak.name])?void 0:r.create({})},toPrismic(t){if(t.type.name===eak.name)return eaC}},eaM={isEmptyLine:t=>0===t.length,isFirst:t=>0===t},eaR={name:eak.name,component:eak,converter:eaI,splitTextToNodes:function(t,n){return function(r){let i=eaI.fromPrismic(t)(eaC);if(!i)return[r(n)];let o=n.split(eaC);return 1===o.length?n.length?[r(n)]:[i]:o.reduce((t,n,o)=>eaM.isFirst(o)?eaM.isEmptyLine(n)?t:[...t,r(n)]:eaM.isEmptyLine(n)?[...t,i]:[...t,i,r(n)],[])}}},eaE=eth.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[new J$({key:new JH("placeholder"),props:{decorations:({doc:t,selection:n})=>{let r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,o=[];if(!r)return null;let a=t.type.createAndFill(),u=(null==a?void 0:a.sameMarkup(t))&&null===a.content.findDiffStart(t.content);return t.descendants((t,n)=>{let r=i>=n&&i<=n+t.nodeSize,a=!t.isLeaf&&!t.childCount;if((r||!this.options.showOnlyCurrent)&&a){let s=[this.options.emptyNodeClass];u&&s.push(this.options.emptyEditorClass);let l=X1.node(n,n+t.nodeSize,{class:s.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});o.push(l)}return this.options.includeChildren}),X4.create(t,o)}}})]}}),eaj=t=>eaE.configure({includeChildren:!0,placeholder:n=>(function({props:t,params:n}){var r;let{editor:i,hasAnchor:o,node:a}=t,{placeholderByNodeType:u,unfocusedPlaceholder:s,nodeExtensions:l}=n,c=!eac.children.exists(i.state.doc,t=>t===a),d=i.isEditable,f=i.isFocused&&o,p=a.type.name!==esv.name,h=f||p||c,m=l.length>1,g=function(){if(c)return ea_.placeholder;let t=u[a.type.name];return"string"==typeof t?t:null==t?void 0:t(a.attrs)}();return s&&!f&&i.isEmpty?s:("Type '/' for commands"===g?d&&h&&m:d&&h)&&g||""})({props:n,params:t}),showOnlyCurrent:!1,showOnlyWhenEditable:!1});function eaA(t){return t.split("-")[1]}function eaN(t){return"y"===t?"height":"width"}function eaP(t){return t.split("-")[0]}function eaL(t){return["top","bottom"].includes(eaP(t))?"x":"y"}function eaF(t,n,r){let{reference:i,floating:o}=t,a=i.x+i.width/2-o.width/2,u=i.y+i.height/2-o.height/2,s=eaL(n),l=eaN(s),c=i[l]/2-o[l]/2,d=eaP(n),f="x"===s,p;switch(d){case"top":p={x:a,y:i.y-o.height};break;case"bottom":p={x:a,y:i.y+i.height};break;case"right":p={x:i.x+i.width,y:u};break;case"left":p={x:i.x-o.width,y:u};break;default:p={x:i.x,y:i.y}}switch(eaA(n)){case"start":p[s]-=c*(r&&f?-1:1);break;case"end":p[s]+=c*(r&&f?-1:1)}return p}let eaD=async(t,n,r)=>{let{placement:i="bottom",strategy:o="absolute",middleware:a=[],platform:u}=r,s=a.filter(Boolean),l=await (null==u.isRTL?void 0:u.isRTL(n)),c=await u.getElementRects({reference:t,floating:n,strategy:o}),{x:d,y:f}=eaF(c,i,l),p=i,h={},m=0;for(let g=0;g<s.length;g++){let{name:y,fn:v}=s[g],{x:b,y:x,data:_,reset:S}=await v({x:d,y:f,initialPlacement:i,placement:p,strategy:o,middlewareData:h,rects:c,platform:u,elements:{reference:t,floating:n}});if(d=b??d,f=x??f,h={...h,[y]:{...h[y],..._}},S&&m<=50){m++,"object"==typeof S&&(S.placement&&(p=S.placement),S.rects&&(c=!0===S.rects?await u.getElementRects({reference:t,floating:n,strategy:o}):S.rects),{x:d,y:f}=eaF(c,p,l)),g=-1;continue}}return{x:d,y:f,placement:p,strategy:o,middlewareData:h}};function eaW(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function eaU(t,n){var r,i,o;void 0===n&&(n={});let{x:a,y:u,platform:s,rects:l,elements:c,strategy:d}=t,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:h="floating",altBoundary:m=!1,padding:g=0}=n,y="number"!=typeof g?{top:0,right:0,bottom:0,left:0,...g}:{top:g,right:g,bottom:g,left:g},v=c[m?"floating"===h?"reference":"floating":h],b=eaW(await s.getClippingRect({element:null==(r=await (null==s.isElement?void 0:s.isElement(v)))||r?v:v.contextElement||await (null==s.getDocumentElement?void 0:s.getDocumentElement(c.floating)),boundary:f,rootBoundary:p,strategy:d})),x="floating"===h?{...l.floating,x:a,y:u}:l.reference,_=await (null==s.getOffsetParent?void 0:s.getOffsetParent(c.floating)),S=await (null==s.isElement?void 0:s.isElement(_))&&await (null==s.getScale?void 0:s.getScale(_))||{x:1,y:1},T=eaW(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({rect:x,offsetParent:_,strategy:d}):x);return{top:(b.top-T.top+y.top)/S.y,bottom:(T.bottom-b.bottom+y.bottom)/S.y,left:(b.left-T.left+y.left)/S.x,right:(T.right-b.right+y.right)/S.x}}let eaz=Math.min,eaB=Math.max;function eaV(t,n,r){return eaB(t,eaz(n,r))}let ea$={left:"right",right:"left",bottom:"top",top:"bottom"};function eaq(t){return t.replace(/left|right|bottom|top/g,t=>ea$[t])}let eaK={start:"end",end:"start"};function eaH(t){return t.replace(/start|end/g,t=>eaK[t])}async function eaG(t,n){let{placement:r,platform:i,elements:o}=t,a=await (null==i.isRTL?void 0:i.isRTL(o.floating)),u=eaP(r),s=eaA(r),l="x"===eaL(r),c=["left","top"].includes(u)?-1:1,d=a&&l?-1:1,f="function"==typeof n?n(t):n,{mainAxis:p,crossAxis:h,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return s&&"number"==typeof m&&(h="end"===s?-1*m:m),l?{x:h*d,y:p*c}:{x:p*c,y:h*d}}function eaZ(t){return"x"===t?"y":"x"}function eaY(t){var n;return(null==(n=t.ownerDocument)?void 0:n.defaultView)||window}function eaJ(t){return eaY(t).getComputedStyle(t)}let eaQ=Math.min,eaX=Math.max,ea0=Math.round;function ea1(t){let n=eaJ(t),r=parseFloat(n.width),i=parseFloat(n.height),o=t.offsetWidth,a=t.offsetHeight,u=ea0(r)!==o||ea0(i)!==a;return u&&(r=o,i=a),{width:r,height:i,fallback:u}}function ea2(t){return ea9(t)?(t.nodeName||"").toLowerCase():""}let ea3;function ea4(){if(ea3)return ea3;let t=navigator.userAgentData;return t&&Array.isArray(t.brands)?ea3=t.brands.map(t=>t.brand+"/"+t.version).join(" "):navigator.userAgent}function ea5(t){return t instanceof eaY(t).HTMLElement}function ea6(t){return t instanceof eaY(t).Element}function ea9(t){return t instanceof eaY(t).Node}function ea8(t){if(typeof ShadowRoot>"u")return!1;let n=eaY(t).ShadowRoot;return t instanceof n||t instanceof ShadowRoot}function ea7(t){let{overflow:n,overflowX:r,overflowY:i,display:o}=eaJ(t);return/auto|scroll|overlay|hidden|clip/.test(n+i+r)&&!["inline","contents"].includes(o)}function eue(t){return["table","td","th"].includes(ea2(t))}function eut(t){let n=/firefox/i.test(ea4()),r=eaJ(t),i=r.backdropFilter||r.WebkitBackdropFilter;return"none"!==r.transform||"none"!==r.perspective||!!i&&"none"!==i||n&&"filter"===r.willChange||n&&!!r.filter&&"none"!==r.filter||["transform","perspective"].some(t=>r.willChange.includes(t))||["paint","layout","strict","content"].some(t=>{let n=r.contain;return null!=n&&n.includes(t)})}function eun(){return/^((?!chrome|android).)*safari/i.test(ea4())}function eur(t){return["html","body","#document"].includes(ea2(t))}function eui(t){return ea6(t)?t:t.contextElement}let euo={x:1,y:1};function eua(t){let n=eui(t);if(!ea5(n))return euo;let r=n.getBoundingClientRect(),{width:i,height:o,fallback:a}=ea1(n),u=(a?ea0(r.width):r.width)/i,s=(a?ea0(r.height):r.height)/o;return u&&Number.isFinite(u)||(u=1),s&&Number.isFinite(s)||(s=1),{x:u,y:s}}function euu(t,n,r,i){var o,a;void 0===n&&(n=!1),void 0===r&&(r=!1);let u=t.getBoundingClientRect(),s=eui(t),l=euo;n&&(i?ea6(i)&&(l=eua(i)):l=eua(t));let c=s?eaY(s):window,d=eun()&&r,f=(u.left+(d&&(null==(o=c.visualViewport)?void 0:o.offsetLeft)||0))/l.x,p=(u.top+(d&&(null==(a=c.visualViewport)?void 0:a.offsetTop)||0))/l.y,h=u.width/l.x,m=u.height/l.y;if(s){let g=eaY(s),y=i&&ea6(i)?eaY(i):i,v=g.frameElement;for(;v&&i&&y!==g;){let b=eua(v),x=v.getBoundingClientRect(),_=getComputedStyle(v);x.x+=(v.clientLeft+parseFloat(_.paddingLeft))*b.x,x.y+=(v.clientTop+parseFloat(_.paddingTop))*b.y,f*=b.x,p*=b.y,h*=b.x,m*=b.y,f+=x.x,p+=x.y,v=eaY(v).frameElement}}return{width:h,height:m,top:p,right:f+h,bottom:p+m,left:f,x:f,y:p}}function eus(t){return((ea9(t)?t.ownerDocument:t.document)||window.document).documentElement}function eul(t){return ea6(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function euc(t){return euu(eus(t)).left+eul(t).scrollLeft}function eud(t){if("html"===ea2(t))return t;let n=t.assignedSlot||t.parentNode||ea8(t)&&t.host||eus(t);return ea8(n)?n.host:n}function euf(t,n){var r;void 0===n&&(n=[]);let i=function t(n){let r=eud(n);return eur(r)?r.ownerDocument.body:ea5(r)&&ea7(r)?r:t(r)}(t),o=i===(null==(r=t.ownerDocument)?void 0:r.body),a=eaY(i);return o?n.concat(a,a.visualViewport||[],ea7(i)?i:[]):n.concat(i,euf(i))}function eup(t,n,r){let i;if("viewport"===n)i=function(t,n){let r=eaY(t),i=eus(t),o=r.visualViewport,a=i.clientWidth,u=i.clientHeight,s=0,l=0;if(o){a=o.width,u=o.height;let c=eun();(!c||c&&"fixed"===n)&&(s=o.offsetLeft,l=o.offsetTop)}return{width:a,height:u,x:s,y:l}}(t,r);else if("document"===n)i=function(t){let n=eus(t),r=eul(t),i=t.ownerDocument.body,o=eaX(n.scrollWidth,n.clientWidth,i.scrollWidth,i.clientWidth),a=eaX(n.scrollHeight,n.clientHeight,i.scrollHeight,i.clientHeight),u=-r.scrollLeft+euc(t),s=-r.scrollTop;return"rtl"===eaJ(i).direction&&(u+=eaX(n.clientWidth,i.clientWidth)-o),{width:o,height:a,x:u,y:s}}(eus(t));else if(ea6(n))i=function(t,n){let r=euu(t,!0,"fixed"===n),i=r.top+t.clientTop,o=r.left+t.clientLeft,a=ea5(t)?eua(t):{x:1,y:1},u=t.clientWidth*a.x,s=t.clientHeight*a.y,l=o*a.x,c=i*a.y;return{width:u,height:s,x:l,y:c}}(n,r);else{let o={...n};if(eun()){var a,u;let s=eaY(t);o.x-=(null==(a=s.visualViewport)?void 0:a.offsetLeft)||0,o.y-=(null==(u=s.visualViewport)?void 0:u.offsetTop)||0}i=o}return eaW(i)}function euh(t,n){return ea5(t)&&"fixed"!==eaJ(t).position?n?n(t):t.offsetParent:null}function eum(t,n){let r=eaY(t),i=euh(t,n);for(;i&&eue(i)&&"static"===eaJ(i).position;)i=euh(i,n);return i&&("html"===ea2(i)||"body"===ea2(i)&&"static"===eaJ(i).position&&!eut(i))?r:i||function(t){let n=eud(t);for(;ea5(n)&&!eur(n);){if(eut(n))return n;n=eud(n)}return null}(t)||r}let eug={getClippingRect:function(t){let{element:n,boundary:r,rootBoundary:i,strategy:o}=t,a=[..."clippingAncestors"===r?function(t,n){let r=n.get(t);if(r)return r;let i=euf(t).filter(t=>ea6(t)&&"body"!==ea2(t)),o=null,a="fixed"===eaJ(t).position,u=a?eud(t):t;for(;ea6(u)&&!eur(u);){let s=eaJ(u),l=eut(u);"fixed"===s.position?o=null:(a?l||o:!(!l&&"static"===s.position&&o&&["absolute","fixed"].includes(o.position)))?o=s:i=i.filter(t=>t!==u),u=eud(u)}return n.set(t,i),i}(n,this._c):[].concat(r),i],u=a[0],s=a.reduce((t,r)=>{let i=eup(n,r,o);return t.top=eaX(i.top,t.top),t.right=eaQ(i.right,t.right),t.bottom=eaQ(i.bottom,t.bottom),t.left=eaX(i.left,t.left),t},eup(n,u,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:n,offsetParent:r,strategy:i}=t,o=ea5(r),a=eus(r);if(r===a)return n;let u={scrollLeft:0,scrollTop:0},s={x:1,y:1},l={x:0,y:0};if((o||!o&&"fixed"!==i)&&(("body"!==ea2(r)||ea7(a))&&(u=eul(r)),ea5(r))){let c=euu(r);s=eua(r),l.x=c.x+r.clientLeft,l.y=c.y+r.clientTop}return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-u.scrollLeft*s.x+l.x,y:n.y*s.y-u.scrollTop*s.y+l.y}},isElement:ea6,getDimensions:function(t){return ea5(t)?ea1(t):t.getBoundingClientRect()},getOffsetParent:eum,getDocumentElement:eus,getScale:eua,async getElementRects(t){let{reference:n,floating:r,strategy:i}=t,o=this.getOffsetParent||eum,a=this.getDimensions;return{reference:function(t,n,r){let i=ea5(n),o=eus(n),a=euu(t,!0,"fixed"===r,n),u={scrollLeft:0,scrollTop:0},s={x:0,y:0};if(i||!i&&"fixed"!==r){if(("body"!==ea2(n)||ea7(o))&&(u=eul(n)),ea5(n)){let l=euu(n,!0);s.x=l.x+n.clientLeft,s.y=l.y+n.clientTop}else o&&(s.x=euc(o))}return{x:a.left+u.scrollLeft-s.x,y:a.top+u.scrollTop-s.y,width:a.width,height:a.height}}(n,await o(r),i),floating:{x:0,y:0,...await a(r)}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===eaJ(t).direction};function euy(t,n,r,i){void 0===i&&(i={});let{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:u=!0,animationFrame:s=!1}=i,l=o&&!s,c=l||a?[...ea6(t)?euf(t):t.contextElement?euf(t.contextElement):[],...euf(n)]:[];c.forEach(t=>{l&&t.addEventListener("scroll",r,{passive:!0}),a&&t.addEventListener("resize",r)});let d=null;if(u){let f=!0;d=new ResizeObserver(()=>{f||r(),f=!1}),ea6(t)&&!s&&d.observe(t),ea6(t)||!t.contextElement||s||d.observe(t.contextElement),d.observe(n)}let p,h=s?euu(t):null;return s&&function n(){let i=euu(t);h&&(i.x!==h.x||i.y!==h.y||i.width!==h.width||i.height!==h.height)&&r(),h=i,p=requestAnimationFrame(n)}(),r(),()=>{var t;c.forEach(t=>{l&&t.removeEventListener("scroll",r),a&&t.removeEventListener("resize",r)}),null==(t=d)||t.disconnect(),d=null,s&&cancelAnimationFrame(p)}}let euv=(t,n,r)=>{let i=new Map,o={platform:eug,...r},a={...o.platform,_c:i};return eaD(t,n,{...o,platform:a})};var eub="u">typeof document?o.useLayoutEffect:o.useEffect;function eux(t,n){if(t===n)return!0;if(typeof t!=typeof n)return!1;if("function"==typeof t&&t.toString()===n.toString())return!0;let r,i,o;if(t&&n&&"object"==typeof t){if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(i=r;0!=i--;)if(!eux(t[i],n[i]))return!1;return!0}if((r=(o=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(i=r;0!=i--;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;0!=i--;){let a=o[i];if(!("_owner"===a&&t.$$typeof)&&!eux(t[a],n[a]))return!1}return!0}return t!=t&&n!=n}function eu_(t){let n=o.useRef(t);return eub(()=>{n.current=t}),n}var euS="u">typeof document?o.useLayoutEffect:o.useEffect;let euT=!1,euw=0,euO=()=>"floating-ui-"+euw++,euk=(H4||(H4=r.t(o,2)))["useId".toString()],euC=euk??function(){let[t,n]=o.useState(()=>euT?euO():void 0);return euS(()=>{null==t&&n(euO())},[]),o.useEffect(()=>{euT||(euT=!0)},[]),t},euI=o.createContext(null),euM=o.createContext(null),euR=()=>{var t,n;return null!=(t=null==(n=o.useContext(euI))?void 0:n.id)?t:null},euE=()=>o.useContext(euM);function euj(t){var n;return null!=(n=null==t?void 0:t.ownerDocument)?n:document}function euA(t){var n;return null!=(n=euj(t).defaultView)?n:window}function euN(t){return!!t&&t instanceof euA(t).Element}let euP=(H4||(H4=r.t(o,2)))["useInsertionEffect".toString()];function euL(t){let n=o.useRef(()=>{});return euP?euP(()=>{n.current=t}):n.current=t,o.useCallback(function(){for(var t=arguments.length,r=Array(t),i=0;i<t;i++)r[i]=arguments[i];return null==n.current?void 0:n.current(...r)},[])}function euF(t,n,r){let i=new Map;return{..."floating"===r&&{tabIndex:-1},...t,...n.map(t=>t?t[r]:null).concat(t).reduce((t,n)=>(n&&Object.entries(n).forEach(n=>{let[r,o]=n;if(0===r.indexOf("on")){if(i.has(r)||i.set(r,[]),"function"==typeof o){var a;null==(a=i.get(r))||a.push(o),t[r]=function(){for(var t,n=arguments.length,o=Array(n),a=0;a<n;a++)o[a]=arguments[a];null==(t=i.get(r))||t.forEach(t=>t(...o))}}}else t[r]=o}),t),{})}}function euD(t,n){var r,i;let o=null!=(r=t.filter(t=>{var r;return t.parentId===n&&(null==(r=t.context)?void 0:r.open)}))?r:[],a=o;for(;a.length;)a=null!=(i=t.filter(t=>{var n;return null==(n=a)?void 0:n.some(n=>{var r;return t.parentId===n.id&&(null==(r=t.context)?void 0:r.open)})}))?i:[],o=o.concat(a);return o}function euW(t){let n=t.activeElement;for(;(null==(r=n)||null==(i=r.shadowRoot)?void 0:i.activeElement)!=null;){var r,i;n=n.shadowRoot.activeElement}return n}function euU(t){t.preventDefault(),t.stopPropagation()}function euz(t){let n=(0,o.useRef)();return euS(()=>{n.current=t},[t]),n.current}let euB=function(t,n){let{open:r}=t,{enabled:i=!0,role:o="dialog"}=void 0===n?{}:n,a=euC(),u=euC(),s={id:a,role:o};return i?"tooltip"===o?{reference:{"aria-describedby":r?a:void 0},floating:s}:{reference:{"aria-expanded":r?"true":"false","aria-haspopup":"alertdialog"===o?"dialog":o,"aria-controls":r?a:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:u}},floating:{...s,..."menu"===o&&{"aria-labelledby":u}}}:{}};function euV(t,n){return null!=n&&("composedPath"in t?t.composedPath().includes(n):null!=t.target&&n.contains(t.target))}let eu$=function(t,n){let{open:r,onOpenChange:i,refs:a,events:u,nodeId:s}=t,{enabled:l=!0,escapeKey:c=!0,outsidePointerDown:d=!0,referencePointerDown:f=!1,ancestorScroll:p=!1,bubbles:h=!0}=void 0===n?{}:n,m=euE(),g=null!=euR(),y=o.useRef(!1);return o.useEffect(()=>{if(!r||!l)return;function t(t){"Escape"!==t.key||!h&&m&&euD(m.nodesRef.current,s).length>0||(u.emit("dismiss",{preventScroll:!1}),i(!1))}function n(t){var n,r;let o=y.current;if(y.current=!1,o)return;let l="composedPath"in t?t.composedPath()[0]:t.target;if(euN(l)&&a.floating.current){let c=null!=(r=a.floating.current.ownerDocument.defaultView)?r:window,d=l.scrollWidth>l.clientWidth,f=l.scrollHeight>l.clientHeight,p=f&&t.offsetX>l.clientWidth;if(f&&"rtl"===c.getComputedStyle(l).direction&&(p=t.offsetX<=l.offsetWidth-l.clientWidth),p||d&&t.offsetY>l.clientHeight)return}let v=m&&euD(m.nodesRef.current,s).some(n=>{var r;return euV(t,null==(r=n.context)?void 0:r.refs.floating.current)});euV(t,a.floating.current)||euV(t,a.domReference.current)||v||!h&&m&&euD(m.nodesRef.current,s).length>0||(u.emit("dismiss",!!g&&{preventScroll:!0}),i(!1))}function o(){i(!1)}let f=euj(a.floating.current);c&&f.addEventListener("keydown",t),d&&f.addEventListener("pointerdown",n);let v=(p?[...euN(a.reference.current)?euf(a.reference.current):[],...euN(a.floating.current)?euf(a.floating.current):[]]:[]).filter(t=>{var n;return t!==(null==(n=f.defaultView)?void 0:n.visualViewport)});return v.forEach(t=>t.addEventListener("scroll",o,{passive:!0})),()=>{c&&f.removeEventListener("keydown",t),d&&f.removeEventListener("pointerdown",n),v.forEach(t=>t.removeEventListener("scroll",o))}},[c,d,u,m,s,r,i,p,l,h,a,g]),l?{reference:{onPointerDown(){f&&(u.emit("dismiss"),i(!1))}},floating:{onPointerDownCapture(){y.current=!0}}}:{}},euq="ArrowUp",euK="ArrowDown",euH="ArrowLeft",euG="ArrowRight";function euZ(t,n,r){return Math.floor(t/n)!==r}function euY(t,n){return n<0||n>=t.current.length}function euJ(t,n){let{startingIndex:r=-1,decrement:i=!1,disabledIndices:o,amount:a=1}=void 0===n?{}:n,u=t.current,s=r;do{var l,c;s+=i?-a:a}while(s>=0&&s<=u.length-1&&(o?o.includes(s):null==u[s]||null!=(l=u[s])&&l.hasAttribute("disabled")||(null==(c=u[s])?void 0:c.getAttribute("aria-disabled"))==="true"));return s}function euQ(t,n,r){switch(t){case"vertical":return n;case"horizontal":return r;default:return n||r}}function euX(t,n){return euQ(n,t===euq||t===euK,t===euH||t===euG)}function eu0(t,n,r){return euQ(n,t===euK,r?t===euH:t===euG)||"Enter"===t||" "==t||""===t}function eu1(t,n){return euJ(t,{disabledIndices:n})}function eu2(t,n){return euJ(t,{decrement:!0,startingIndex:t.current.length,disabledIndices:n})}let eu3=function(t,n){let{open:r,onOpenChange:i,refs:a}=t,{listRef:u,activeIndex:s,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:d=null,allowEscape:f=!1,loop:p=!1,nested:h=!1,rtl:m=!1,virtual:g=!1,focusItemOnOpen:y="auto",focusItemOnHover:v=!0,openOnArrowKeyDown:b=!0,disabledIndices:x,orientation:_="vertical",cols:S=1}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate(){}}:n,T=euR(),w=euE(),O=euz(r),k=euL(l),C=euL(euz(l)),I=o.useRef(y),M=o.useRef(d??-1),R=o.useRef(null),E=function(t){let n=(0,o.useRef)(t);return euS(()=>{n.current=t}),n}(x),j=o.useRef(!1),A=o.useRef(-1),[N,P]=o.useState(),L=o.useCallback((t,n)=>{A.current=requestAnimationFrame(()=>{var r,i;g?P(null==(r=t.current[n.current])?void 0:r.id):null==(i=t.current[n.current])||i.focus({preventScroll:!0})})},[g]);function F(t){var n,o,s,l;if(j.current=!0,h&&(n=t.key,euQ(_,m?n===euG:n===euH,n===euq))){euU(t),i(!1),(l=a.domReference.current)&&l instanceof euA(l).HTMLElement&&a.domReference.current.focus();return}let c=M.current,d=eu1(u,x),y=eu2(u,x);if("Home"===t.key&&(M.current=d,k(M.current)),"End"===t.key&&(M.current=y,k(M.current)),S>1){let v=M.current;if(t.key===euq){if(euU(t),-1===v)M.current=y;else if(M.current=euJ(u,{startingIndex:v,amount:S,decrement:!0,disabledIndices:x}),p&&(v-S<d||M.current<0)){let b=v%S,T=y%S,w=y-(T-b);T===b?M.current=y:M.current=T>b?w:w-S}euY(u,M.current)&&(M.current=v),k(M.current)}if(t.key===euK&&(euU(t),-1===v?M.current=d:(M.current=euJ(u,{startingIndex:v,amount:S,disabledIndices:x}),p&&v+S>y&&(M.current=euJ(u,{startingIndex:v%S-S,amount:S,disabledIndices:x}))),euY(u,M.current)&&(M.current=v),k(M.current)),"both"===_){let O=Math.floor(v/S);t.key===euG&&(euU(t),v%S!=S-1?(M.current=euJ(u,{startingIndex:v,disabledIndices:x}),p&&euZ(M.current,S,O)&&(M.current=euJ(u,{startingIndex:v-v%S-1,disabledIndices:x}))):p&&(M.current=euJ(u,{startingIndex:v-v%S-1,disabledIndices:x})),euZ(M.current,S,O)&&(M.current=v)),t.key===euH&&(euU(t),v%S!=0?(M.current=euJ(u,{startingIndex:v,disabledIndices:x,decrement:!0}),p&&euZ(M.current,S,O)&&(M.current=euJ(u,{startingIndex:v+(S-v%S),decrement:!0,disabledIndices:x}))):p&&(M.current=euJ(u,{startingIndex:v+(S-v%S),decrement:!0,disabledIndices:x})),euZ(M.current,S,O)&&(M.current=v)),euY(u,M.current)&&(p&&Math.floor(y/S)===O?M.current=t.key===euH?y:euJ(u,{startingIndex:v-v%S-1,disabledIndices:x}):M.current=v),k(M.current);return}}if(euX(t.key,_)){if(euU(t),r&&!g&&euW(t.currentTarget.ownerDocument)===t.currentTarget){M.current=eu0(t.key,_,m)?d:y,k(M.current);return}eu0(t.key,_,m)?p?M.current=c>=y?f&&c!==u.current.length?-1:d:euJ(u,{startingIndex:c,disabledIndices:x}):M.current=Math.min(y,euJ(u,{startingIndex:c,disabledIndices:x})):p?M.current=c<=d?f&&-1!==c?u.current.length:y:euJ(u,{startingIndex:c,decrement:!0,disabledIndices:x}):M.current=Math.max(d,euJ(u,{startingIndex:c,decrement:!0,disabledIndices:x})),euY(u,M.current)?k(null):k(M.current)}}return euS(()=>{c&&(!O&&r&&I.current&&null!=d&&k(d),O&&!r&&(cancelAnimationFrame(A.current),M.current=-1,C(null)))},[r,O,d,u,L,c,k,C]),euS(()=>{c&&r&&(null==s?null==d&&(O&&(M.current=-1,L(u,M)),!O&&I.current&&(null!=R.current||!0===I.current&&null==R.current)&&(M.current=null==R.current||eu0(R.current,_,m)||h?eu1(u,E.current):eu2(u,E.current),k(M.current),L(u,M))):euY(u,s)||(M.current=s,L(u,M)))},[r,O,s,d,h,u,k,L,c,f,_,m,g,E]),euS(()=>{if(c&&!r&&O){var t,n;let i=null==w||null==(t=w.nodesRef.current.find(t=>t.id===T))||null==(n=t.context)?void 0:n.refs.floating.current;i&&!i.contains(euW(euj(i)))&&i.focus({preventScroll:!0})}},[c,r,O,w,T]),euS(()=>{R.current=null}),c?{reference:{...g&&r&&null!=s&&{"aria-activedescendant":N},onKeyDown(t){if(j.current=!0,g&&r)return F(t);if((0===t.key.indexOf("Arrow")||"Enter"===t.key||" "===t.key||""===t.key)&&(R.current=t.key),h){var n,o,a;n=t.key,euQ(_,m?n===euH:n===euG,n===euK)&&(euU(t),r?(M.current=eu1(u,x),k(M.current)):i(!0));return}euX(t.key,_)&&(null!=d&&(M.current=d),euU(t),!r&&b?i(!0):F(t),r&&k(M.current))}},floating:{"aria-orientation":"both"===_?void 0:_,...g&&null!=s&&{"aria-activedescendant":N},onKeyDown:F,onPointerMove(){j.current=!1}},item:{onFocus(t){let{currentTarget:n}=t,r=u.current.indexOf(n);-1!==r&&k(r)},onClick(t){let{currentTarget:n}=t;return n.focus({preventScroll:!0})},...v&&{onMouseMove(t){let{currentTarget:n}=t;if(n){let r=u.current.indexOf(n);-1!==r&&k(r)}},onPointerLeave(){if(!j.current&&(M.current=-1,L(u,M),k(null),!g)){var t;null==(t=a.floating.current)||t.focus({preventScroll:!0})}}}}}:{}},eu4=new JH("suggestion"),eu5=enK.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:t}){return["p",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),eu6={heading1:"heading1",heading2:"heading2",heading3:"heading3",heading4:"heading4",heading5:"heading5",heading6:"heading6",paragraph:"paragraph",preformatted:"preformatted",strong:"strong",em:"em",listItem:"list-item",oListItem:"o-list-item",list:"group-list-item",oList:"group-o-list-item",image:"image",embed:"embed",hyperlink:"hyperlink",label:"label",span:"span"},eu9=()=>(++eu9.i).toString();eu9.i=0;let eu8=t=>{let n=est(t),r=[];for(let i=0;i<n.length;i++)r.push(esn(n[i]));return{key:eu9(),children:r}},eu7=(t,n=[])=>({key:eu9(),type:t.type,text:"text"in t?t.text:void 0,node:t,children:n}),ese=t=>eu7({type:eu6.span,text:t,spans:[]}),est=t=>{let n=t.slice(0);for(let r=0;r<n.length;r++){let i=n[r];if(i.type===eu6.listItem||i.type===eu6.oListItem){let o=[i];for(;n[r+1]&&n[r+1].type===i.type;)o.push(n[r+1]),n.splice(r,1);i.type===eu6.listItem?n[r]={type:eu6.list,items:o}:n[r]={type:eu6.oList,items:o}}}return n},esn=t=>{if("text"in t)return eu7(t,esr(t.spans,t));if("items"in t){let n=[];for(let r=0;r<t.items.length;r++)n.push(esn(t.items[r]));return eu7(t,n)}return eu7(t)},esr=(t,n,r)=>{if(!t.length)return[ese(n.text)];let i=t.slice(0);i.sort((t,n)=>t.start-n.start||n.end-t.end);let o=[];for(let a=0;a<i.length;a++){let u=i[a],s=r&&r.start||0,l=u.start-s,c=u.end-s,d=n.text.slice(l,c),f=[];for(let p=a;p<i.length;p++){let h=i[p];h!==u&&h.start>=u.start&&h.end<=u.end&&(f.push(h),i.splice(p,1),p--)}0===a&&l>0&&o.push(ese(n.text.slice(0,l)));let m={...u,text:d};o.push(eu7(m,esr(f,{...n,text:d},u))),c<n.text.length&&o.push(ese(n.text.slice(c,i[a+1]?i[a+1].start-s:void 0)))}return o},esi=(t,n)=>eso(eu8(t).children,n),eso=(t,n)=>{let r=[];for(let i=0;i<t.length;i++){let o=t[i],a=n(o.type,o.node,o.text,eso(o.children,n),o.key);null!=a&&r.push(a)}return r};eu6.listItem,eu6.oListItem,eu6.list,eu6.oList;let esa=enK.create({name:"text",group:"inline"});function esu(t){return t.sort((t,n)=>t.start-n.start)}let ess={fromPrismic:t=>n=>{switch(n.type){case"hyperlink":return es5.converter.fromPrismic(t)(n);case"em":return es3.converter.fromPrismic(t)(n);case"strong":return eap.converter.fromPrismic(t)(n);default:return}},toPrismic(t,n,r){let i=elo.find(n=>t.type.name===n.name);if(!i)throw Error(`Invalid mark extension '${t.type.name}'.`);let o=i.richTextNodeTypes;if("hyperlink"!==o)return{type:o,start:n,end:r};let a=i.converter.toPrismic(t);return{type:o,start:n,end:r,data:a}}},esl=esa.extend({name:"text"}),esc={name:esl.name,component:esl,converter:{fromPrismic:t=>function(n,r,i=!1){let o={type:n,text:r.content.text,spans:r.content.spans||[]};return esi([o],function(t,n=!1){return(r,i,o,a)=>{if("span"===r&&o&&o.length)return n?[t.text(o)]:eaR.splitTextToNodes(t,o)(n=>t.text(n));{let u=ess.fromPrismic(t)(i);return u?a.flat().map(t=>t.mark([...t.marks,u].sort((t,n)=>t.type.name.localeCompare(n.type.name)))):a.flat()}}}(t,i))[0]},toPrismic(t,n,r){let i=eac.children.reduce(t,(t,n)=>{let r=n.type.name===eaR.name?eaR.converter.toPrismic(n):n.textContent,i=r?t.text+r:t.text,o=t.text.length,a=i.length,u=n.marks.length?eac.marks.map(n,t=>ess.toPrismic(t,o,a)):void 0;return{...t,text:i,spans:u?[...t.spans,...u]:t.spans}},{text:"",spans:[]});return{type:n,content:{text:i.text,spans:[...function(t){var n;let r=t.reduce((t,n)=>{let r=(t[n.type]||[]).concat(n);return{...t,[n.type]:r}},{}),i=Object.entries(r).map(([t,n])=>esu(n).reduce((t,n)=>{if(!t.length)return[n];let r=t.length-1,i=t[r];return i?i.end<n.start?[...t,n]:i.end>=n.end?t:[...t.slice(0,r),{...i,end:n.end}]:t},[])).flat();return esu(i)}(i.spans)].sort((t,n)=>t.type.localeCompare(n.type))},...r}}}};var esd,esf=((esd=esf||{}).LeftToRight="ltr",esd.RightToLeft="rtl",esd);let esp=qJ.RichTextNodeType.rtl,esh=eth.create({name:"textDirection",addOptions:()=>({supportedExtensionNames:[]}),addGlobalAttributes(){return[{types:this.options.supportedExtensionNames,attributes:{dir:{default:"ltr",parseHTML:t=>t.getAttribute("dir"),renderHTML:t=>({dir:"ltr"===t.dir?"ltr":"rtl"})}}}]},addCommands(){return{setDirection:t=>({commands:n})=>"rtl"===t?n.setRightToLeft():n.setLeftToRight(),toggleDirection:t=>({commands:n})=>n.setDirection("rtl"===t?"ltr":"rtl"),setRightToLeft:()=>({commands:t})=>this.options.supportedExtensionNames.every(n=>t.updateAttributes(n,{dir:"rtl"})),setLeftToRight:()=>({commands:t})=>this.options.supportedExtensionNames.every(n=>t.resetAttributes(n,"dir"))}},addKeyboardShortcuts(){return{"Mod-Shift-r":()=>this.editor.commands.setRightToLeft(),"Mod-Shift-l":()=>this.editor.commands.setLeftToRight()}}}),esm={parseNodeAttrsDirection:t=>"rtl"===t.dir?"rtl":"ltr",fromPrismic(t){let n="rtl"===t.direction?"rtl":"ltr";return{dir:n}},toPrismic(t){return{direction:this.parseNodeAttrsDirection(t.attrs)}}},esg=eu5.extend({name:"paragraph",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:t}){return["p",ee5(this.options.HTMLAttributes,t),0]}}),esy=new eai([qJ.RichTextNodeType.paragraph],esg.name,esg,{fromPrismic:t=>function(n){var r;let i=esc.converter.fromPrismic(t)(esg.name,n);return null==(r=t.nodes[esg.name])?void 0:r.create(esm.fromPrismic(n),i)},toPrismic:t=>esc.converter.toPrismic(t,qJ.RichTextNodeType.paragraph,esm.toPrismic(t))},"Type '/' for commands"),esv=esy,esb=["ArrowDown","ArrowUp","End","Home"],esx=["Enter"],es_=["Escape",...esb,...esx],esS=eth.create({name:"slash-commands",addOptions:()=>({nodeTypes:[]}),addProseMirrorPlugins(){let t=elf(elu,this.options.nodeTypes);return t.length>1?[function({pluginKey:t=eu4,editor:n,char:r="@",allowSpaces:i=!1,allowedPrefixes:o=[" "],startOfLine:a=!1,decorationTag:u="span",decorationClass:s="suggestion",command:l=()=>null,items:c=()=>[],render:d=()=>({}),allow:f=()=>!0}){let p,h=null==d?void 0:d(),m=new J$({key:t,view(){return{update:async(t,r)=>{var i,o,a,u,s,d,f;let m=null===(i=this.key)||void 0===i?void 0:i.getState(r),g=null===(o=this.key)||void 0===o?void 0:o.getState(t.state),y=m.active&&g.active&&m.range.from!==g.range.from,v=!m.active&&g.active,b=m.active&&!g.active,x=!v&&!b&&m.query!==g.query,_=v||y,S=x&&!y,T=b||y;if(!_&&!S&&!T)return;let w=T&&!_?m:g,O=t.dom.querySelector(`[data-decoration-id="${w.decorationId}"]`);p={editor:n,range:w.range,query:w.query,text:w.text,items:[],command(t){l({editor:n,range:w.range,props:t})},decorationNode:O,clientRect:O?()=>{var r;let{decorationId:i}=null===(r=this.key)||void 0===r?void 0:r.getState(n.state),o=t.dom.querySelector(`[data-decoration-id="${i}"]`);return(null==o?void 0:o.getBoundingClientRect())||null}:null},_&&(null===(a=null==h?void 0:h.onBeforeStart)||void 0===a||a.call(h,p)),S&&(null===(u=null==h?void 0:h.onBeforeUpdate)||void 0===u||u.call(h,p)),(S||_)&&(p.items=await c({editor:n,query:w.query})),T&&(null===(s=null==h?void 0:h.onExit)||void 0===s||s.call(h,p)),S&&(null===(d=null==h?void 0:h.onUpdate)||void 0===d||d.call(h,p)),_&&(null===(f=null==h?void 0:h.onStart)||void 0===f||f.call(h,p))},destroy(){var t;p&&(null===(t=null==h?void 0:h.onExit)||void 0===t||t.call(h,p))}}},state:{init:()=>({active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}),apply(t,u,s,l){let{isEditable:c}=n,{composing:d}=n.view,{selection:p}=t,{empty:h,from:m}=p,g={...u};if(g.composing=d,c&&(h||n.view.composing)){(m<u.range.from||m>u.range.to)&&!d&&!u.composing&&(g.active=!1);let y=function(t){var n,r;let{char:i,allowSpaces:o,allowedPrefixes:a,startOfLine:u,$position:s}=t,l=i.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),c=RegExp(`\\s${l}$`),d=u?"^":"",f=o?RegExp(`${d}${l}.*?(?=\\s${l}|$)`,"gm"):RegExp(`${d}(?:^)?${l}[^\\s${l}]*`,"gm"),p=(null===(n=s.nodeBefore)||void 0===n?void 0:n.isText)&&s.nodeBefore.text;if(!p)return null;let h=s.pos-p.length,m=Array.from(p.matchAll(f)).pop();if(!m||void 0===m.input||void 0===m.index)return null;let g=m.input.slice(Math.max(0,m.index-1),m.index),y=RegExp(`^[${null==a?void 0:a.join("")}\0]?$`).test(g);if(null!==a&&!y)return null;let v=h+m.index,b=v+m[0].length;return o&&c.test(p.slice(b-1,b+1))&&(m[0]+=" ",b+=1),v<s.pos&&b>=s.pos?{range:{from:v,to:b},query:m[0].slice(i.length),text:m[0]}:null}({char:r,allowSpaces:i,allowedPrefixes:o,startOfLine:a,$position:p.$from}),v=`id_${Math.floor(4294967295*Math.random())}`;y&&f({editor:n,state:l,range:y.range})?(g.active=!0,g.decorationId=u.decorationId?u.decorationId:v,g.range=y.range,g.query=y.query,g.text=y.text):g.active=!1}else g.active=!1;return g.active||(g.decorationId=null,g.range={from:0,to:0},g.query=null,g.text=null),g}},props:{handleKeyDown(t,n){var r;let{active:i,range:o}=m.getState(t.state);return i&&(null===(r=null==h?void 0:h.onKeyDown)||void 0===r?void 0:r.call(h,{view:t,event:n,range:o}))||!1},decorations(t){let{active:n,range:r,decorationId:i}=m.getState(t);return n?X4.create(t.doc,[X1.inline(r.from,r.to,{nodeName:u,class:s,"data-decoration-id":i})]):null}}});return m}({allowSpaces:!0,char:"/",editor:this.editor,startOfLine:!0,allow({state:t}){let n=t.selection.$from;return n.parent.type.name===esv.name&&1===n.depth},command({editor:t,props:n,range:r}){n.runCommands(t,{deleteRange:r})},items({query:n}){let r=n.toLocaleLowerCase().trim();return t.filter(t=>{var n,i;return(null==(n=t.shortText)?void 0:n.toLocaleLowerCase().includes(r))||(null==(i=t.text)?void 0:i.toLocaleLowerCase().includes(r))})},render(){let t;return{onStart(n){t=new eiP(esT,{editor:n.editor,props:n}),document.body.appendChild(t.element)},onUpdate(n){null==t||t.updateProps(n)},onKeyDown({event:n}){var r;return Boolean(es_.includes(n.key)&&(null==(r=null==t?void 0:t.ref)?void 0:r.handleKeyDown(n)))},onExit(){null==t||t.destroy(),null==t||t.element.remove()}}}})]:[]}}),esT=(0,o.forwardRef)(function(t,n){var r,i,a,l,c;let{command:d,decorationNode:f,editor:p,items:h}=t,[m,g]=(0,o.useState)(!0),y=parseFloat(u.TV.space[0]),{context:v,floating:b,reference:_,x:S,y:T}=function(t){let{open:n=!1,onOpenChange:r,whileElementsMounted:i,placement:a,middleware:u,strategy:s,nodeId:l}=void 0===t?{}:t,[c,d]=o.useState(null),f=euE(),p=o.useRef(null),h=o.useRef({}),m=o.useState(()=>(function(){let t=new Map;return{emit(n,r){var i;null==(i=t.get(n))||i.forEach(t=>t(r))},on(n,r){t.set(n,[...t.get(n)||[],r])},off(n,r){t.set(n,(t.get(n)||[]).filter(t=>t!==r))}}})())[0],g=function(t){void 0===t&&(t={});let{placement:n="bottom",strategy:r="absolute",middleware:i=[],platform:a,whileElementsMounted:u,open:s}=t,[l,c]=o.useState({x:null,y:null,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[d,f]=o.useState(i);eux(d,i)||f(i);let p=o.useRef(null),h=o.useRef(null),m=o.useRef(l),g=eu_(u),y=eu_(a),[v,b]=o.useState(null),[_,S]=o.useState(null),T=o.useCallback(t=>{p.current!==t&&(p.current=t,b(t))},[]),w=o.useCallback(t=>{h.current!==t&&(h.current=t,S(t))},[]),O=o.useCallback(()=>{if(!p.current||!h.current)return;let t={placement:n,strategy:r,middleware:d};y.current&&(t.platform=y.current),euv(p.current,h.current,t).then(t=>{let n={...t,isPositioned:!0};k.current&&!eux(m.current,n)&&(m.current=n,x.flushSync(()=>{c(n)}))})},[d,n,r,y]);eub(()=>{!1===s&&m.current.isPositioned&&(m.current.isPositioned=!1,c(t=>({...t,isPositioned:!1})))},[s]);let k=o.useRef(!1);eub(()=>(k.current=!0,()=>{k.current=!1}),[]),eub(()=>{if(v&&_){if(g.current)return g.current(v,_,O);O()}},[v,_,O,g]);let C=o.useMemo(()=>({reference:p,floating:h,setReference:T,setFloating:w}),[T,w]),I=o.useMemo(()=>({reference:v,floating:_}),[v,_]);return o.useMemo(()=>({...l,update:O,refs:C,elements:I,reference:T,floating:w}),[l,O,C,I,T,w])}({placement:a,middleware:u,strategy:s,whileElementsMounted:i}),y=euL(r),v=o.useMemo(()=>({...g.refs,domReference:p}),[g.refs]),b=o.useMemo(()=>({...g,refs:v,dataRef:h,nodeId:l,events:m,open:n,onOpenChange:y,_:{domReference:c}}),[g,l,m,n,y,v,c]);euS(()=>{let t=null==f?void 0:f.nodesRef.current.find(t=>t.id===l);t&&(t.context=b)});let{reference:_}=g,S=o.useCallback(t=>{(euN(t)||null===t)&&(b.refs.domReference.current=t,d(t)),_(t)},[_,b.refs]);return o.useMemo(()=>({...g,context:b,refs:v,reference:S}),[g,v,b,S])}({middleware:[(void 0===(r=y)&&(r=0),{name:"offset",options:r,async fn(t){let{x:n,y:i}=t,o=await eaG(t,r);return{x:n+o.x,y:i+o.y,data:o}}}),(void 0===i&&(i={}),{name:"flip",options:i,async fn(t){var n,r,o,a;let{placement:u,middlewareData:s,rects:l,initialPlacement:c,platform:d,elements:f}=t,{mainAxis:p=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...b}=i,x=eaP(u),_=eaP(c)===c,S=await (null==d.isRTL?void 0:d.isRTL(f.floating)),T=m||(_||!v?[eaq(c)]:function(t){let n=eaq(t);return[eaH(t),n,eaH(n)]}(c));m||"none"===y||T.push(...function(t,n,r,i){let o=eaA(t),a=function(t,n,r){let i=["left","right"],o=["right","left"];switch(t){case"top":case"bottom":return r?n?o:i:n?i:o;case"left":case"right":return n?["top","bottom"]:["bottom","top"];default:return[]}}(eaP(t),"start"===r,i);return o&&(a=a.map(t=>t+"-"+o),n&&(a=a.concat(a.map(eaH)))),a}(c,v,y,S));let w=await eaU(t,b),O=[],k=(null==(n=s.flip)?void 0:n.overflows)||[];if(p&&O.push(w[x]),h){let{main:C,cross:I}=function(t,n,r){void 0===r&&(r=!1);let i=eaA(t),o=eaL(t),a=eaN(o),u="x"===o?i===(r?"end":"start")?"right":"left":"start"===i?"bottom":"top";return n.reference[a]>n.floating[a]&&(u=eaq(u)),{main:u,cross:eaq(u)}}(u,l,S);O.push(w[C],w[I])}if(k=[...k,{placement:u,overflows:O}],!O.every(t=>t<=0)){let M=((null==(r=s.flip)?void 0:r.index)||0)+1,R=[c,...T][M];if(R)return{data:{index:M,overflows:k},reset:{placement:R}};let E=null==(o=k.filter(t=>t.overflows[0]<=0).sort((t,n)=>t.overflows[1]-n.overflows[1])[0])?void 0:o.placement;if(!E)switch(g){case"bestFit":{let j=null==(a=k.map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,n)=>t+n,0)]).sort((t,n)=>t[1]-n[1])[0])?void 0:a[0];j&&(E=j);break}case"initialPlacement":E=c}if(u!==E)return{reset:{placement:E}}}return{}}}),(l={limiter:(void 0===a&&(a={}),{options:a,fn(t){let{x:n,y:r,placement:i,rects:o,middlewareData:u}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=a,d={x:n,y:r},f=eaL(i),p=eaZ(f),h=d[f],m=d[p],g="function"==typeof s?s(t):s,y="number"==typeof g?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(l){let v="y"===f?"height":"width",b=o.reference[f]-o.floating[v]+y.mainAxis,x=o.reference[f]+o.reference[v]-y.mainAxis;h<b?h=b:h>x&&(h=x)}if(c){var _,S;let T="y"===f?"width":"height",w=["top","left"].includes(eaP(i)),O=o.reference[p]-o.floating[T]+(w&&(null==(_=u.offset)?void 0:_[p])||0)+(w?0:y.crossAxis),k=o.reference[p]+o.reference[T]+(w?0:(null==(S=u.offset)?void 0:S[p])||0)-(w?y.crossAxis:0);m<O?m=O:m>k&&(m=k)}return{[f]:h,[p]:m}}})},{name:"shift",options:l,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:u={fn(t){let{x:n,y:r}=t;return{x:n,y:r}}},...s}=l,c={x:n,y:r},d=await eaU(t,s),f=eaL(eaP(i)),p=eaZ(f),h=c[f],m=c[p];if(o){let g=h+d["y"===f?"top":"left"],y=h-d["y"===f?"bottom":"right"];h=eaV(g,h,y)}if(a){let v=m+d["y"===p?"top":"left"],b=m-d["y"===p?"bottom":"right"];m=eaV(v,m,b)}let x=u.fn({...t,[f]:h,[p]:m});return{...x,data:{x:x.x-n,y:x.y-r}}}})],onOpenChange:g,open:m,placement:"top-start",strategy:"fixed",whileElementsMounted:euy});(0,o.useLayoutEffect)(()=>{_(f)},[_,f]),(0,o.useEffect)(()=>{let t,n=()=>{t=window.setTimeout(()=>{g(!0)})},r=()=>{g(!1)};return p.on("focus",n).on("blur",r),()=>{p.off("focus",n).off("blur",r),clearTimeout(t)}},[p]);let[w,O]=(0,o.useState)(0),k=(0,o.useRef)([]);(0,s.pQ)(h,()=>{O(0),k.current=[]});let{getFloatingProps:C,getItemProps:I,getReferenceProps:R}=(c=[eu$(v,{outsidePointerDown:!1}),eu3(v,{activeIndex:w,listRef:k,onNavigate(t){O(n=>t??n)},openOnArrowKeyDown:!1,virtual:!0}),euB(v,{role:"menu"})],{getReferenceProps:t=>euF(t,c,"reference"),getFloatingProps:t=>euF(t,c,"floating"),getItemProps:t=>euF(t,c,"item")}),E=R().onKeyDown;return(0,o.useImperativeHandle)(n,()=>({handleKeyDown(t){if(!m)return!1;if(esb.includes(t.key)&&E(t),esx.includes(t.key)){let n=h[w];void 0!==n&&d(n)}return!0}}),[w,d,h,E,m]),m?M.jsx(u.xu,{...C(),minWidth:256,backgroundColor:"grey1",border:!0,borderStyle:"solid",borderRadius:6,flexDirection:"column",ref:b,top:parseFloat(u.TV.space[0]),left:parseFloat(u.TV.space[0]),position:"fixed",transform:null!==S&&null!==T?`translate3d(${Math.round(S)}px, ${Math.round(T)}px, 0)`:"translate3d(0, -200%, 0)",children:M.jsxs("div",{style:{boxShadow:"0px 2px 10px 0px hsla(0, 0%, 0%, 0.1)"},children:[h.map((t,n)=>{let r=I({onClick(){d(t)},onPointerDown(t){t.preventDefault()}});return(0,o.createElement)(esw,{...r,key:t.nodeType,ref(t){k.current[n]=t},active:n===w,isFirstItem:0===n,isLastItem:n===h.length-1,shortcut:`/${t.shortText??""}`},t.text)}),0===h.length&&M.jsx(esw,{...I({onPointerDown(t){t.preventDefault()}}),disabled:!0,ref(t){k.current[0]=t},children:"No results"})]})}):null}),esw=(0,o.forwardRef)(function(t,n){let{children:r,disabled:i=!1,shortcut:o,active:a=!1,isFirstItem:s=!1,isLastItem:l=!1,...c}=t,d=function(t){let{isFirstItem:n,isLastItem:r}=t;return n?{topRight:6,topLeft:6}:r?{bottomRight:6,bottomLeft:6}:void 0}({isFirstItem:s,isLastItem:l});return M.jsx("div",{...c,role:"button",style:{all:"unset",cursor:i?"default":"pointer"},ref:n,children:M.jsxs(u.xu,{alignItems:"center",height:32,flexDirection:"row",gap:8,padding:8,backgroundColor:a?"grey4":"inherit",justifyContent:"space-between",borderRadius:d,opacity:i?"50%":"100%",children:[M.jsx(u.xv,{color:"grey12",component:"span",children:r}),o&&M.jsx(u.xv,{color:"inherit",component:"span",variant:"small",children:o})]})})}),esO=eay.extend({name:"bulletList",parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:t}){return["ul",ee5(this.options.HTMLAttributes,t),0]}}).configure({itemTypeName:"listItem"}),esk=new eau([qJ.RichTextNodeType.list],esO.name,esO,{fromPrismic:t=>function(n){var r;let i=ea_.converter.fromPrismic(t)(n);if(i)return null==(r=t.nodes[esO.name])?void 0:r.create(esm.fromPrismic(n),i)},toPrismic:t=>eac.children.map(t,t=>ea_.converter.toPrismic(t,qJ.RichTextNodeType.list).filter(c.$)).flat()}),esC=esk,esI=/^```([a-z]+)?[\s\n]$/,esM=/^~~~([a-z]+)?[\s\n]$/,esR=enK.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:null,parseHTML:t=>{var n;let{languageClassPrefix:r}=this.options,i=[...(null===(n=t.firstElementChild)||void 0===n?void 0:n.classList)||[]].filter(t=>t.startsWith(r)).map(t=>t.replace(r,""))[0];return i||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:t,HTMLAttributes:n}){return["pre",ee5(this.options.HTMLAttributes,n),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:n})=>n.setNode(this.name,t),toggleCodeBlock:t=>({commands:n})=>n.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:t,$anchor:n}=this.editor.state.selection,r=1===n.pos;return!!t&&n.parent.type.name===this.name&&(!!r||!n.parent.textContent.length)&&this.editor.commands.clearNodes()},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:n}=t,{selection:r}=n,{$from:i,empty:o}=r;if(!o||i.parent.type!==this.type)return!1;let a=i.parentOffset===i.parent.nodeSize-2,u=i.parent.textContent.endsWith(`
|
|
95
95
|
|
|
96
96
|
`);return!!a&&!!u&&t.chain().command(({tr:t})=>(t.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;let{state:n}=t,{selection:r,doc:i}=n,{$from:o,empty:a}=r;if(!a||o.parent.type!==this.type||o.parentOffset!==o.parent.nodeSize-2)return!1;let u=o.after();return!(void 0===u||i.nodeAt(u))&&t.commands.exitCode()}}},addInputRules(){return[enV({find:esI,type:this.type,getAttributes:t=>({language:t[1]})}),enV({find:esM,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new J$({key:new JH("codeBlockVSCodeHandler"),props:{handlePaste:(t,n)=>{if(!n.clipboardData||this.editor.isActive(this.type.name))return!1;let r=n.clipboardData.getData("text/plain"),i=n.clipboardData.getData("vscode-editor-data"),o=i?JSON.parse(i):void 0,a=null==o?void 0:o.mode;if(!r||!a)return!1;let{tr:u}=t.state;return u.replaceSelectionWith(this.type.create({language:a})),u.setSelection(JR.near(u.doc.resolve(Math.max(0,u.selection.from-2)))),u.insertText(r.replace(/\r\n?/g,`
|
|
97
|
-
`)),u.setMeta("paste",!0),t.dispatch(u),!0}}})]}}),esE=esR.extend({name:"preformatted",addAttributes(){return{language:{default:null,parseHTML:t=>{var n;let{languageClassPrefix:r}=this.options,i=[...(null==(n=t.firstElementChild)?void 0:n.classList)||[]].filter(t=>t.startsWith(r)).map(t=>t.replace(r,""))[0];return i||null},renderHTML:t=>t.language?{class:this.options.languageClassPrefix+t.language}:null}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({HTMLAttributes:t}){return["pre",ee5(this.options.HTMLAttributes),["code",t,0]]}}).configure({exitOnTripleEnter:!1}),esj=new eai([qJ.RichTextNodeType.preformatted],esE.name,esE,{fromPrismic:t=>function(n){var r;let i=esc.converter.fromPrismic(t)(esE.name,n,!0);return null==(r=t.nodes[esE.name])?void 0:r.create(esm.fromPrismic(n),i)},toPrismic:t=>esc.converter.toPrismic(t,qJ.RichTextNodeType.preformatted,esm.toPrismic(t))},"",!0);function esA(t){let{editor:n,getPos:r,node:i}=t,[a,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{function t(){let{from:t,to:o}=n.state.selection,a=r(),s=r()+i.nodeSize;u(t<=a&&o>=s)}function o(){u(!1)}return n.on("blur",o),n.on("selectionUpdate",t),()=>{n.off("blur",o),n.off("selectionUpdate",t)}},[n,r,i.nodeSize]),{selected:a}}function esN(t){let n=(0,o.useRef)(null),r=(0,o.useRef)(null),{onKeyDown:i,url:a,urlChanged:l,onContentChange:c,debouncedUrl:d,content:f}=function(t,n,r){let{node:i}=t,a=i.attrs.content,u=(0,s.R9)(t.updateAttributes),l=(0,s.$P)({initialState:(null==a?void 0:a.embed_url)??"",startTransition:o.startTransition});function c(t){u({content:t})}let{onKeyDown:d}=function(t,n,r,i){let{editor:a,getPos:u,node:s}=t,[l,c]=(0,o.useState)(!0);return(0,o.useEffect)(()=>{l&&t.editor.isFocused&&eiD(()=>{var t;return null==(t=r.current)?void 0:t.focus()})},[r,l,t.editor.isFocused]),{containerRef:i,inputRef:r,onKeyDown:function(t){let r=u(),i=u()+s.nodeSize;"Enter"===t.code&&(c(!1),a.chain().insertContentAt(i,{type:"paragraph"}).focus(i+1).run()),"Backspace"===t.code&&""===n&&a.chain().deleteRange({from:r,to:i}).focus(i+1).run(),"ArrowUp"===t.code&&(c(!1),a.chain().focus(r-1).run()),"ArrowDown"===t.code&&(c(!1),a.chain().focus(i+1).run())}}}(t,l.value,n,r);return{inputRef:n,containerRef:r,onKeyDown:d,url:l.value,urlChanged:function(t){l.set(t),(0,v.ju)(t)||c(void 0)},onContentChange:c,debouncedUrl:l.debouncedValue,content:t.node.attrs.content}}(t,n,r),{selected:p}=esA(t);return M.jsx(eiN,{className:"custom-embed",children:M.jsxs("div",{contentEditable:"false",suppressContentEditableWarning:!0,children:[M.jsxs(u.xu,{flexGrow:1,alignItems:"center",children:[M.jsx(u.I5,{size:"small",name:"cloud",color:"grey11"}),M.jsx(u.xu,{flexGrow:1,height:40,ref:r,children:M.jsx(Z5,{id:"id",ref:n,value:a,variant:(0,v.ju)(a)?"link":"normal",placeholder:"Paste your link here",onValueChange:l,onKeyDown:i})})]}),(0,v.ju)(a)&&M.jsx(eiW,{selected:p,debouncedUrl:d,onContentChange:c,content:f})]})})}let esP=enK.create({name:"embed",group:"block",atom:!0,content:"block*",marks:"",addAttributes:()=>({content:{default:void 0}}),addCommands(){return{setEmbed:()=>({tr:t,dispatch:n})=>{let r=this.type.create();return n&&t.replaceSelectionWith(r),!0}}},parseHTML:()=>[{tag:"embed"}],renderHTML:()=>["embed"],addNodeView:()=>eiF(esN)}),esL=new class{constructor(t,n,r,i){w(this,"extType","node"),w(this,"nodeType","embed"),this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i}}([qJ.RichTextNodeType.embed],esP.name,esP,{fromPrismic:t=>function(n){var r;return null==(r=t.nodes[esP.name])?void 0:r.create({content:n.data})},toPrismic:t=>void 0===t.attrs.content?{type:"embed",data:{type:"embed",embed_url:"",__TYPE__:"EmbedContent",all:[]}}:{type:"embed",data:{...t.attrs.content}}}),esF=enK.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:n}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ee5(this.options.HTMLAttributes,n),0]},addCommands(){return{setHeading:t=>({commands:n})=>!!this.options.levels.includes(t.level)&&n.setNode(this.name,t),toggleHeading:t=>({commands:n})=>!!this.options.levels.includes(t.level)&&n.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return this.options.levels.reduce((t,n)=>({...t,[`Mod-Alt-${n}`]:()=>this.editor.commands.toggleHeading({level:n})}),{})},addInputRules(){return this.options.levels.map(t=>enV({find:RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),esD="heading";function esW(t){switch(t){case 1:return qJ.RichTextNodeType.heading1;case 2:return qJ.RichTextNodeType.heading2;case 3:return qJ.RichTextNodeType.heading3;case 4:return qJ.RichTextNodeType.heading4;case 5:return qJ.RichTextNodeType.heading5;case 6:return qJ.RichTextNodeType.heading6}}function esU(t){return{fullName:esW(t),level:t}}let esz=[1,2,3,4,5,6];function esB(t,n=esz){let r=RegExp(`^heading([${n.join(",")}]){1}$`),i=t.match(r);if(!i||!i[1])return;let o=parseInt(i[1]);return{fullName:esW(o),level:o}}function esV(t,n){let r=t.level;if(n.includes(r))return{fullName:esW(r),level:r}}let es$=t=>{let n=t[0]??1;return{fromPrismic:r=>function(i){var o;let a=esc.converter.fromPrismic(r)(esD,i),u=esB(i.type,t)||esU(n);return null==(o=r.nodes[esD])?void 0:o.create({level:u.level,...esm.fromPrismic(i)},a)},toPrismic(r){let{fullName:i}=esV(r.attrs,t)||esU(n);return esc.converter.toPrismic(r,i,esm.toPrismic(r))}}},esq={name:esD,build(t){var n,r;let i=t?t.size?Array.from(t.values()).reduce((t,n)=>{let r=esB(n);return r?[...t,r.level]:t},[]).sort((t,n)=>t-n):[]:esz;if(!i)return;let o=i.map(t=>esW(t));return new eaa(o,esF.extend({name:"heading"}).configure({levels:i}),i,es$(i),t=>{let n=esV(t,i);return n&&`Heading ${n.level}`})}};function esK(t){let{node:n}=t,r=n.attrs.content,{selected:i}=esA(t),a={width:null==r?void 0:r.width,height:null==r?void 0:r.height,name:eiY},{onMediaSelected:s,onCropperDialogClose:l,isUpdating:c,updateContent:d,onClear:f}=function(t){let{content:n,thumbnail:r,imageViewProps:{getPos:i,updateAttributes:a,editor:u,node:s}}=t,[l,c]=(0,o.useTransition)();function d(t){c(()=>a({content:t}))}return{onMediaSelected:function(t){let r=ei2(t),o=i()+s.nodeSize;d({__TYPE__:"ImageContent",...n,...r}),u.chain().focus(o+1).run()},onCropperDialogClose:function({croppedImages:t}){if(!n)return;let i=t[r.name];if(!i)return;let o=eoi({content:n,thumbnail:r.name,croppedImage:i});o!==n&&d(o)},isUpdating:l,updateContent:d,onClear:function(){let t=i(),n=i()+s.nodeSize;u.chain().deleteRange({from:t,to:n}).focus(n).run()}}}({content:r,thumbnail:a,imageViewProps:t}),p=(null==r?void 0:r.width)===0&&(null==r?void 0:r.height)===0,h=r&&!p?[`${r.width}x${r.height}px`]:[],m=(null==r?void 0:r.alt)??"",g={thumbnail:a,contentView:r,labels:eiJ(a,r,r)};return M.jsx(eiN,{className:"custom-image",children:M.jsx("div",{contentEditable:"false",suppressContentEditableWarning:!0,children:M.jsx(eof,{content:r,selected:i,fieldLabel:"Feature image",imageLabel:h,initialImages:[g],readOnly:!1,onMediaSelected:s,onCropperDialogClose:l,onClear:f,children:M.jsx(o.Suspense,{fallback:esH,children:null!=r&&r.url?M.jsxs(u.aY,{children:[M.jsx(u.hM,{children:M.jsx(u.xu,{flexDirection:"column",alignItems:"center",position:"relative",height:400,children:M.jsx(u.xu,{justifyContent:"center",flexGrow:1,maxHeight:"100%",maxWidth:"100%",children:M.jsx(u.kg,{src:ei0(r.url),alt:m,sizing:"contain"})})})}),M.jsx(eon,{onValueChange(t){d({...r,alt:t})},altText:m,readOnly:!r,selected:i})]}):M.jsx(eot,{isUpdating:c,readOnly:!1,onMediaSelected:s})})})})})}let esH=M.jsx("div",{style:{height:468}}),esG=enK.create({name:"image",group:"block",atom:!0,addAttributes:()=>({content:{default:void 0}}),addCommands(){return{setImage:()=>t=>{let{dispatch:n,tr:r}=t,i=this.type.create();return n&&r.replaceSelectionWith(i),!0}}},parseHTML:()=>[{tag:"image"}],renderHTML:({HTMLAttributes:t})=>["image",ee5(t)],addNodeView:()=>eiF(esK)}),esZ=new class{constructor(t,n,r,i){w(this,"extType","node"),w(this,"nodeType","image"),this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i}}([qJ.RichTextNodeType.image],esG.name,esG,{fromPrismic:t=>function(n){var r;return null==(r=t.nodes[esG.name])?void 0:r.create({content:n.data})},toPrismic(t){if(void 0!==t.attrs.content)return{type:"image",data:{...t.attrs.content}}}}),esY=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,esJ=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,esQ=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,esX=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,es0=enq.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"em"},{tag:"i",getAttrs:t=>"normal"!==t.style.fontStyle&&null},{style:"font-style=italic"}],renderHTML({HTMLAttributes:t}){return["em",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[enB({find:esY,type:this.type}),enB({find:esQ,type:this.type})]},addPasteRules(){return[enG({find:esJ,type:this.type}),enG({find:esX,type:this.type})]}}),es1=es0.extend({name:"em"}),es2=new class{constructor(t,n,r){w(this,"extType",ean.Mark),w(this,"richTextNodeTypes",qJ.RichTextNodeType.em),this.name=t,this.component=n,this.converter=r}}(es1.name,es1,{fromPrismic:t=>function(){var n;return null==(n=t.marks[es1.name])?void 0:n.create()},toPrismic(){}}),es3=es2,es4=enq.create({name:"hyperlink",priority:1e3,keepOnSplit:!1,inclusive:!1,addOptions:()=>({openOnClick:!1,linkOnPaste:!0,autolink:!0,protocols:[],htmlAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null,id:""},validate:void 0}),addAttributes:()=>({href:{default:""},id:{default:""},target:{default:"_blank"},rel:{default:"noopener noreferrer nofollow"},class:{default:null},media:{default:null}}),parseHTML:()=>[{tag:'a[href]:not([href *= "javascript:" i])'}],renderHTML({HTMLAttributes:t}){return["a",ee5(this.options.htmlAttributes,t),0]},addCommands(){return{setWebLink:t=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,t).setMeta("preventAutolink",!0).run(),setDocumentLink:t=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,t).setMeta("preventAutolink",!0).run(),setMediaLink:t=>({chain:n})=>{let r=es6(eoP({media:t.media}).value);return n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,{media:r}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}}}),es5=new class{constructor(t,n,r){w(this,"extType",ean.Mark),w(this,"richTextNodeTypes",qJ.RichTextNodeType.hyperlink),this.name=t,this.component=n,this.converter=r}}(es4.name,es4,{fromPrismic:t=>function(n){var r,i,o,a;let u=n.data;if("DocumentLink"===u.__TYPE__){let s={type:es4.name,id:u.id};return null==(r=t.marks[es4.name])?void 0:r.create(s)}if("ImageLink"===u.__TYPE__){let l={type:es4.name,media:es6(u)};return null==(i=t.marks[es4.name])?void 0:i.create(l)}if("FileLink"===u.__TYPE__){let c={type:es4.name,media:es6(u)};return null==(o=t.marks[es4.name])?void 0:o.create(c)}if("ExternalLink"===u.__TYPE__){let d={type:es4.name,url:u.url,href:u.url,target:u.target};return null==(a=t.marks[es4.name])?void 0:a.create(d)}},toPrismic:t=>t.attrs.media?es9(t.attrs.media):t.attrs.id?{__TYPE__:"DocumentLink",id:t.attrs.id}:{__TYPE__:"ExternalLink",url:t.attrs.href,target:t.attrs.target}});function es6(t){return JSON.stringify(t)}function es9(t){return JSON.parse(t)}let es8=enK.create({name:"listItem",addOptions:()=>({HTMLAttributes:{}}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:t}){return["li",ee5(this.options.HTMLAttributes,t),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)}}}),es7=enq.create({name:"textStyle",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"span",getAttrs:t=>!!t.hasAttribute("style")&&{}}],renderHTML({HTMLAttributes:t}){return["span",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:n})=>{let r=enu(t,this.type);return!!Object.entries(r).some(([,t])=>!!t)||n.unsetMark(this.name)}}}}),ele=/^(\d+)\.\s$/,elt=enK.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:t}){let{start:n,...r}=t;return 1===n?["ol",ee5(this.options.HTMLAttributes,r),0]:["ol",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:n})=>this.options.keepAttributes?n().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(es8.name,this.editor.getAttributes(es7.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=en$({find:ele,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=en$({find:ele,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(es7.name)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[t]}}),eln=elt.extend({name:"orderedList",addAttributes:()=>({start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1}}),renderHTML({HTMLAttributes:t}){let{start:n,...r}=t;return 1===n?["ol",ee5(this.options.HTMLAttributes,r),0]:["ol",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}}}).configure({itemTypeName:"listItem"}),elr=new eau([qJ.RichTextNodeType.orderedList],eln.name,eln,{fromPrismic:t=>function(n){var r;let i=ea_.converter.fromPrismic(t)(n);if(i)return null==(r=t.nodes[eln.name])?void 0:r.create(esm.fromPrismic(n),i)},toPrismic:t=>eac.children.map(t,t=>ea_.converter.toPrismic(t,qJ.RichTextNodeType.orderedList).filter(c.$)).flat()}),eli=elr,elo=[eap,es3,es5];function ela(t){return[esv,esC,eli,esq.build(t),esj,esL,esZ,...elo].filter(c.$)}let elu=[{nodeType:qJ.RichTextNodeType.paragraph,icon:"textFields",isActive:t=>t.isActive(esv.name)&&!t.isActive(esC.name)&&!t.isActive(eli.name),runCommands:elc((t,n)=>t.clearNodes().setDirection(eld(n))),shortText:"par",text:"Paragraph"},{nodeType:qJ.RichTextNodeType.heading1,icon:"looks1",isActive:t=>t.isActive(esq.name,{level:1}),runCommands:elc((t,n)=>t.setHeading({level:1}).setDirection(eld(n))),shortText:"h1",text:"Heading 1"},{nodeType:qJ.RichTextNodeType.heading2,icon:"looks2",isActive:t=>t.isActive(esq.name,{level:2}),runCommands:elc((t,n)=>t.setHeading({level:2}).setDirection(eld(n))),shortText:"h2",text:"Heading 2"},{nodeType:qJ.RichTextNodeType.heading3,icon:"looks3",isActive:t=>t.isActive(esq.name,{level:3}),runCommands:elc((t,n)=>t.setHeading({level:3}).setDirection(eld(n))),shortText:"h3",text:"Heading 3"},{nodeType:qJ.RichTextNodeType.heading4,icon:"looks4",isActive:t=>t.isActive(esq.name,{level:4}),runCommands:elc((t,n)=>t.setHeading({level:4}).setDirection(eld(n))),shortText:"h4",text:"Heading 4"},{nodeType:qJ.RichTextNodeType.heading5,icon:"looks5",isActive:t=>t.isActive(esq.name,{level:5}),runCommands:elc((t,n)=>t.setHeading({level:5}).setDirection(eld(n))),shortText:"h5",text:"Heading 5"},{nodeType:qJ.RichTextNodeType.heading6,icon:"looks6",isActive:t=>t.isActive(esq.name,{level:6}),runCommands:elc((t,n)=>t.setHeading({level:6}).setDirection(eld(n))),shortText:"h6",text:"Heading 6"},{nodeType:qJ.RichTextNodeType.list,icon:"formatListBulleted",isActive:t=>t.isActive(esC.name),runCommands:elc((t,n)=>t.toggleBulletList().setDirection(eld(n))),shortText:"bull",text:"Bulleted list"},{nodeType:qJ.RichTextNodeType.orderedList,icon:"formatListNumbered",isActive:t=>t.isActive(eli.name),runCommands:elc((t,n)=>t.toggleOrderedList().setDirection(eld(n))),shortText:"num",text:"Numbered list"},{nodeType:qJ.RichTextNodeType.preformatted,icon:"dataObject",isActive:t=>t.isActive(esj.name),runCommands:elc((t,n)=>t.setCodeBlock().setDirection(eld(n))),shortText:"code",text:"Code"},{nodeType:qJ.RichTextNodeType.embed,icon:"cloud",isActive:t=>t.isActive(esL.name),runCommands:elc(t=>t.setEmbed()),shortText:"emb",text:"Embed"},{nodeType:qJ.RichTextNodeType.image,icon:"image",isActive:t=>t.isActive(esZ.name),runCommands:elc(t=>t.setImage()),shortText:"img",text:"Image"}],els=[{nodeType:qJ.RichTextNodeType.strong,icon:"formatBold",isActive:t=>t.isActive(eap.name),runCommands:elc(t=>t.toggleBold())},{nodeType:qJ.RichTextNodeType.em,icon:"formatItalic",isActive:t=>t.isActive(es3.name),runCommands:elc(t=>t.toggleItalic())}],ell=[{nodeType:qJ.RichTextNodeType.rtl,icon:"formatTextDirectionRToL",isActive:t=>t.isActive({dir:esf.RightToLeft}),runCommands:elc((t,n)=>t.toggleDirection(eld(n)))}];function elc(t){return(n,r={})=>{let i=!0===r.can?n.can().chain():n.chain().focus();return void 0!==r.deleteRange&&(i=i.deleteRange(r.deleteRange)),r.can?function(t,n,r){try{return r(n,t).run()}catch{return!1}}(n,i,t):t(i,n).run()}}function eld(t){let n=t.state.selection.$from.parent.attrs;return esm.parseNodeAttrsDirection(n)}function elf(t,n){return t.filter(t=>n.includes(t.nodeType))}function elp(t){let{items:n,editor:r}=t;return 0===n.length?null:M.jsxs(M.Fragment,{children:[M.jsx(u.Jf,{}),n.map(t=>M.jsx(u.r8,{disabled:!t.runCommands(r,{can:!0}),onPressedChange(){t.runCommands(r)},pressed:t.isActive(r),startIcon:t.icon},t.nodeType))]})}function elh(t){let{disabled:n,showWebLinkModal:r,showDocumentsLinkModal:i,showMediaLinkModal:o}=function(t){let{editor:n,setModal:r}=t;return{disabled:!elc(t=>t.setWebLink({href:""}))(n,{can:!0}),showWebLinkModal:function(){r("webLink")},showDocumentsLinkModal:function(){r("documentLink")},showMediaLinkModal:function(){r("mediaLink")}}}(t);return M.jsxs(M.Fragment,{children:[M.jsx(u.Jf,{}),M.jsxs(u.yM,{density:"compact",children:[M.jsx(u.hA,{disabled:n,startIcon:"link",onClick:r},qJ.RichTextNodeType.hyperlink),M.jsxs(u.h_,{children:[M.jsx(u.$F,{children:M.jsx(u.hA,{startIcon:"arrowDropDown"})}),M.jsxs(u.AW,{align:"end",asPortal:!1,children:[M.jsx(u.Xi,{startIcon:M.jsx(u.I5,{name:"public"}),onSelect:r,children:"Link to web page"}),M.jsx(u.Xi,{startIcon:M.jsx(u.I5,{name:"description"}),onSelect:i,children:"Link to document"}),M.jsx(u.Xi,{startIcon:M.jsx(u.I5,{name:"image"}),onSelect:o,children:"Link to media"})]})]})]})]})}function elm(t){let{docId:n,onEdit:r,onUnlink:i}=t,o=function(t){let n=P();n.searchDocuments||F("searchDocuments");let{coreApiUrl:r,env:i}=n;return(0,d.QT)(h.EK,[r,i,t])}(n),a=P();if(!o)return null;let s=o.versions[0],l=(0,b.u)({status:null==s?void 0:s.status,releaseId:(null==s?void 0:s.status)==="release"?s.release_id:void 0,documentId:o.id,versionId:null==s?void 0:s.version_id,env:a.env}),c=(null==s?void 0:s.preview_summary)??"",f=(null==s?void 0:s.custom_type_label)??"";return M.jsx(u.oZ,{url:l,title:o.title,subTitle:f,description:c,onEdit:r,onUnlink:i,largeIconName:"description"})}function elg(t){let{editor:n}=t,{searchDocuments:r}=P(),i=n.getAttributes(qJ.RichTextNodeType.hyperlink);if(i.id&&r){let o=i.id;return M.jsx(ely,{docId:o,...t})}if(i.href){let a=i.href;return M.jsx(elv,{url:a,...t})}if(i.media){let u=es9(i.media);return M.jsx(elb,{media:u,...t})}return null}function ely(t){let{editor:n,onEditDocumentLink:r,docId:i}=t;return M.jsx(u.SV,{renderError:()=>M.jsx(u.oZ,{url:"",title:"Failed to Load Linked Document Data",subTitle:"",error:!0,onEdit:r,onUnlink:()=>elx(n)}),children:M.jsx(o.Suspense,{fallback:M.jsx(u.oZ,{url:"",title:"",subTitle:"",loading:!0,onEdit:r,onUnlink:()=>elx(n)}),children:M.jsx(elm,{docId:i,onEdit:r,onUnlink:()=>elx(n)})})})}function elv(t){let{url:n,editor:r,onEditWebLink:i}=t,o=(0,v.ju)(n);return o?M.jsx(u.oZ,{url:n,title:(0,v.S$)(o),subTitle:n,onEdit:i,onUnlink:()=>elx(r)}):M.jsx(u.oZ,{url:n,title:"",subTitle:n,onEdit:i,onUnlink:()=>elx(r)})}function elb(t){let{media:n,editor:r,onEditMediaLink:i}=t;return"ImageLink"===n.__TYPE__?M.jsx(u.Qi,{url:n.url,title:n.name,subTitle:`${n.width} x ${n.height} pixels`,onEdit:i,onUnlink:()=>elx(r)}):"FileLink"===n.__TYPE__?M.jsx(u.oZ,{url:n.url,title:n.name,subTitle:function(t){let{filename:n}=t,r=n.split(".").pop();return r?r.toLowerCase():""}({filename:n.name}),onEdit:i,onUnlink:()=>elx(r),largeIconName:"insertDriveFile"}):null}function elx(t){elc(t=>t.unsetLink())(t)}function el_(t){let{open:n}=t,{onOpenChange:r,onSelectDocument:i}=function(t){let{editor:n,setOpen:r}=t;function i(t){r(t)}return{onSelectDocument:function(t){elc(n=>n.extendMarkRange(qJ.RichTextNodeType.hyperlink).setDocumentLink({id:t}))(n),r(!1)},onOpenChange:i}}(t);return M.jsx(eoO,{open:n,onOpenChange:r,onSelectDocument:i})}function elS(t){let{open:n}=t,{onOpenChange:r,onMediaSelected:i}=function(t){let{editor:n,setOpen:r}=t;return{onMediaSelected:function(t){elc(n=>n.extendMarkRange(qJ.RichTextNodeType.hyperlink).setMediaLink({media:t}))(n),r(!1)},onOpenChange:r}}(t);return M.jsx(eoe,{open:n,onOpenChange:r,onMediaSelected:i,assetType:"all"})}function elT(t){let{open:n}=t,{url:r,setUrl:i,onOpenChange:a,onKeyDown:s,openInNewTab:l,setOpenInNewTab:c,onSetUrl:d,selectionUrl:f,selectionUrlTitle:p}=function(t){var n;let{editor:r,setOpen:i}=t,[a,u]=(0,o.useState)(""),[s,l]=(0,o.useState)(!1),c=function(t){let n=t.getAttributes(qJ.RichTextNodeType.hyperlink);return n.href?n.href:void 0}(r),d=(n=r,"_blank"===n.getAttributes(qJ.RichTextNodeType.hyperlink).target);(0,o.useEffect)(()=>{u(c??"")},[c]),(0,o.useEffect)(()=>{l(d??!1)},[d]);let f=c?(0,v.ju)(c):void 0,p=f?(0,v.S$)(f):"";function h(t){let n=s?"_blank":"_self";elc(r=>r.extendMarkRange(qJ.RichTextNodeType.hyperlink).setWebLink({href:t,target:n}))(r),i(!1)}return{url:a,setUrl:u,onSetUrl:h,selectionUrl:c,selectionUrlTitle:p,openInNewTab:s,selectionOpenInNewTab:d,setOpenInNewTab:l,onKeyDown:function(t){"Enter"===t.key&&h(a)},onOpenChange:function(t){u(""),l(!1),i(t)}}}(t);return M.jsx(u.Vq,{open:n,onOpenChange:a,hasClose:!1,size:"small",children:M.jsx(u.cZ,{children:M.jsxs(u.xu,{flexDirection:"column",children:[M.jsxs(u.xu,{flexDirection:"column",height:"100%",padding:16,gap:4,children:[M.jsx(u.yt,{value:r,onValueChange:i,placeholder:"Paste URL",icon:"public",onKeyDown:s}),f&&M.jsxs(u.xu,{flexDirection:"column",padding:{top:8},gap:4,children:[M.jsx(u.xv,{variant:"smallBold",color:"grey11",children:"Linked to"}),M.jsxs(u.xu,{backgroundColor:"grey4",borderRadius:6,padding:8,alignItems:"center",gap:8,children:[M.jsx(u.pI,{largeIconName:"public",smallIconName:"link"}),M.jsxs(u.xu,{flexDirection:"column",children:[M.jsx(u.xv,{variant:"bold",color:"grey12",children:p}),M.jsx(u.xv,{color:"grey11",variant:"small",children:"Web page"})]})]})]})]}),r&&M.jsxs(u.xu,{flexDirection:"column",padding:{block:8},border:{top:!0},children:[M.jsx(u.UN,{onSelect:()=>c(!l),icon:l?"checkBox":"checkBoxOutlinedBlank",textContent:"Open in new tab"}),M.jsx(u.UN,{onSelect:()=>d(r),icon:"link",textContent:"Link to URL"})]})]})})})}function elw(t){let{items:n,editor:r}=t;return 0===n.length?null:M.jsxs(M.Fragment,{children:[M.jsx(u.Jf,{}),M.jsx(u.dV,{onValueChange(t){n.forEach(n=>{(n.isActive(r)&&!t.includes(n.nodeType)||!n.isActive(r)&&t.includes(n.nodeType))&&n.runCommands(r)})},type:"multiple",value:n.filter(t=>t.isActive(r)).map(t=>t.nodeType),children:n.map(t=>M.jsx(u.nG,{disabled:!t.runCommands(r,{can:!0}),startIcon:t.icon,value:t.nodeType},t.nodeType))},"mark")]})}function elO(t){var n;let{items:r,editor:i}=t;return 0===r.length?null:M.jsx(u.vT,{disabled:1===r.length,value:(null==(n=r.find(t=>t.isActive(i)))?void 0:n.nodeType)??"",onValueChange(t){var n;null==(n=r.find(n=>n.nodeType===t))||n.runCommands(i)},children:r.map(t=>M.jsx(u.KG,{value:t.nodeType,children:t.text},t.nodeType))})}let elk={duration:100,hideOnClick:!0,offset:[-48,8],placement:"top-start",zIndex:30};function elC(t){let{editor:n,nodeTypes:r}=t,[i,a]=(0,o.useState)(),u=r.includes(qJ.RichTextNodeType.hyperlink),s=!i,{shouldShowBubbleMenu:l,shouldShowLinkPopover:c}=function(t){let{editor:n}=t;return{shouldShowBubbleMenu:function(t){let{view:r,state:i,from:o,to:a}=t;if(!r.hasFocus())return!1;let{doc:u,selection:s}=i;return!(n.isActive(qJ.RichTextNodeType.preformatted)||s.empty||0===u.textBetween(o,a).length)},shouldShowLinkPopover:function(t){let{view:n,state:r,from:i,to:o}=t,a=n.state.doc.nodeAt(i),{doc:u,selection:s}=r;return!!s.empty&&!(u.textBetween(i,o).length>0)&&!!(null!=a&&a.marks.some(t=>"hyperlink"===t.type.name))}}}({editor:n});return M.jsxs(M.Fragment,{children:[M.jsx(eiC,{editor:n,tippyOptions:elk,shouldShow:l,children:s&&M.jsx(elI,{...t,setModal:a})}),M.jsx(eiC,{editor:n,tippyOptions:elk,shouldShow:c,children:s&&M.jsx(elg,{editor:n,onEditWebLink:()=>a("webLink"),onEditDocumentLink:()=>a("documentLink"),onEditMediaLink:()=>a("mediaLink")})}),u&&M.jsxs(M.Fragment,{children:[M.jsx(elT,{open:"webLink"===i,setOpen:function(t){a(t?"webLink":void 0)},editor:n}),M.jsx(el_,{open:"documentLink"===i,setOpen:function(t){a(t?"documentLink":void 0)},editor:n}),M.jsx(elS,{open:"mediaLink"===i,setOpen:function(t){a(t?"mediaLink":void 0)},editor:n})]})]})}function elI(t){let{editor:n,nodeTypes:r}=t,i=r.includes("hyperlink"),o=elf(elu,r),a=elf(els,r),s=elf(ell,r),l=o.length+a.length+s.length+Number(i);return 0===l?null:M.jsxs(u.o8,{children:[M.jsx(elO,{items:o,editor:n}),M.jsx(elw,{items:a,editor:n}),i&&M.jsx(elh,{...t}),M.jsx(elp,{items:s,editor:n}),l>1&&M.jsxs(M.Fragment,{children:[M.jsx(u.Jf,{}),M.jsx(u.hA,{onClick(){n.chain().focus().clearNodes().unsetAllMarks().run()},startIcon:"formatClear"},"clear")]})]})}function elM(t){var n;let{content:r,field:i,id:a,readOnly:l}=t,d=function(t){var n,r;let i=`${(null==(n=t.config)?void 0:n.multi)??""}-${(null==(r=t.config)?void 0:r.single)??""}`;return(0,o.useMemo)(()=>{let{extensions:n,defaultTextConverter:r}=function(t){var n;if(!t||!(null!=t&&t.single)&&!(null!=t&&t.multi))return ead();let r=function(t){let n=(t.single||t.multi||"").split(/\s*,\s*/).map(t=>{let n=qJ.RichTextNodeTypeCodec.decode(t);return"Right"===n._tag?n.right:void 0}).filter(c.$);return new Set(n)}(t);if(!(null!=r&&r.size))return ead();let i=(n=r,ela(n).filter(t=>(0,g.G)(n,n=>t.richTextNodeTypes.includes(n)))),o=function(t){let n=new Set(t);return(0,g.G)(n,eas)&&n.add(esv),(0,g.G)(n,eao)||n.add(esv),[...n]}(i);return{extensions:o,defaultTextConverter:function(t){let n=t.find(eao)??esv;return function(t){return r=>n.converter.fromPrismic(t)({...r,type:n.richTextNodeTypes[0]??"heading1"})}}(o)}}(t.config),i=n.filter(elR),o=n.flatMap(t=>t.richTextNodeTypes),a=n.map(t=>t.component),u=n.filter(elE).map(t=>t.name),s=[...a,...function(t,n){var r,i,o;let a=n.map(t=>t.richTextNodeTypes).flat(),u={placeholderByNodeType:(o=n,o.reduce((t,n)=>(n.nodeType===ear.Text&&(t[n.name]=n.placeholder),t),{})),unfocusedPlaceholder:null==(r=t.config)?void 0:r.placeholder,nodeExtensions:n},s=a.includes(qJ.RichTextNodeType.orderedList)||a.includes(qJ.RichTextNodeType.list);return[eaO.component((null==(i=t.config)?void 0:i.single)===void 0),esc.component,eaR.component,eaj(u),s?ea_.component:void 0,esS.configure({nodeTypes:a})].filter(c.$)}(t,i),esh.configure({supportedExtensionNames:u}),eo4],l=s.map(t=>t.name),d=function(t,n){let r=etd.resolve(t);return ett(r,void 0)}(s);return{allComponents:s,extensionNames:l,defaultTextConverter:r,nodeExtensions:i,names:o,schema:d}},[i])}(i),f=r&&eaO.converter(d.nodeExtensions).fromPrismic(d.schema,null==(n=d.defaultTextConverter)?void 0:n.call(d,d.schema))(r),p=(0,s.R9)(t.onContentChange),h=function(t={},n=[]){let{onUpdate:r}=t,[i,a]=(0,o.useState)(),u=(0,o.useRef)(r),l=(0,s.NW)();return(0,o.useEffect)(()=>{i&&r&&(i.off("update",u.current),i.on("update",r),u.current=r)},[r,i]),(0,o.useLayoutEffect)(()=>{let n=!0,r=new eiI(t);return a(r),r.on("transaction",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{n&&l()})})}),()=>{n=!1}},n),(0,o.useEffect)(()=>()=>{null==i||i.destroy()},[i]),i}({content:null==f?void 0:f.toJSON(),editable:!l,editorProps:{attributes:{class:u.rk,id:a,tabIndex:"0"}},extensions:d.allComponents,injectCSS:!1,onUpdate({editor:t}){if(t.isEmpty)return p(void 0);let n=eaO.converter(d.nodeExtensions).toPrismic(t.state.doc);p(n)}},[d,l]);return M.jsxs(u.gN,{children:[M.jsx(u.Qy,{htmlFor:a,children:Z0(i)}),M.jsxs(u.JO,{children:[M.jsx(eiE,{editor:h??null,style:{flex:1}}),(null==h?void 0:h.isEditable)&&M.jsx(elC,{editor:h,nodeTypes:d.names.concat(esp)})]})]})}function elR(t){return t.extType===ean.Node}function elE(t){return!(t.extType!==ean.Node||t.nodeType!==ear.Text||t.lockedFormat)}function elj(t){var n,r,i,o,a;let{content:s,field:l,id:c,onContentChange:d,readOnly:f}=t,p=Z1(l),h=(i=l,(null==(o=i.config)?void 0:o.default_value)===void 0||null==(a=i.config.options)?void 0:a[0]),m=(null==s?void 0:s.value)??h;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"arrowDropDownCircle"}),M.jsx(u.Qy,{htmlFor:c,children:Z0(l)}),M.jsx(u.JO,{children:M.jsx(u.Ph,{id:c,size:"large",color:"grey",value:m,renderTrigger:()=>M.jsx(u.JF,{id:c,placeholder:p}),onValueChange(t){var n;f||d((n=t,0===n.length?void 0:{__TYPE__:"FieldContent",type:"Select",value:n}))},children:null==(r=null==(n=l.config)?void 0:n.options)?void 0:r.map(t=>M.jsx(u.Ql,{value:t,children:t},t))})})]})}function elA(t){let{id:n,readOnly:r,field:i,content:o,onContentChange:a}=t,s=null!=o&&o.value?(0,l._O)(o.value):void 0;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"event"}),M.jsx(u.Qy,{id:n,children:Z0(i)}),M.jsx(u.JO,{children:M.jsx(u.xu,{padding:{left:4,right:12},width:"100%",flexDirection:"column",justifyContent:"center",children:M.jsx(u.Wr,{mode:"date-time","aria-labelledby":n,disabled:r,value:s,onValueChange:t=>a(function(t){if(t)return{__TYPE__:"FieldContent",type:"Timestamp",value:function(t){let n=`${t.getUTCFullYear()}`.padStart(4,"0"),r=`${t.getUTCMonth()+1}`.padStart(2,"0"),i=`${t.getUTCDate()}`.padStart(2,"0"),o=`${t.getUTCHours()}`.padStart(2,"0"),a=`${t.getUTCMinutes()}`.padStart(2,"0");return`${n}-${r}-${i}T${o}:${a}:00+00:00`}(t)}}(t))})})})]})}function elN(t){let{id:n,readOnly:r,content:i,nestableWidget:a}=t,u=(0,s.R9)(t.onContentChange);return(0,o.useMemo)(()=>{let t={id:n,readOnly:r,onContentChange:u};return"Boolean"===a.type?M.jsx(Z2,{...t,field:a,content:n0.isBooleanContent(i)?i:void 0}):"Date"===a.type?M.jsx(Z4,{...t,field:a,content:n0.isDateContent(i)?i:void 0}):"Timestamp"===a.type?M.jsx(elA,{...t,field:a,content:n0.isTimestampContent(i)?i:void 0}):"Image"===a.type?M.jsx(eop,{...t,field:a,content:n0.isImageContent(i)?i:void 0}):"Link"===a.type?M.jsx(eoL,{...t,field:a,content:n0.isLinkContent(i)?i:void 0}):"Number"===a.type?M.jsx(eoU,{...t,field:a,content:n0.isNumberContent(i)?i:void 0}):"StructuredText"===a.type?M.jsx(elM,{...t,field:a,content:n0.isRichTextContent(i)?i:void 0}):"Select"===a.type?M.jsx(elj,{...t,field:a,content:n0.isSelectContent(i)?i:void 0}):"Text"===a.type?M.jsx(eom,{...t,field:a,content:n0.isTextContent(i)?i:void 0}):"Embed"===a.type?M.jsx(ei$,{...t,field:a,content:n0.isEmbedContent(i)?i:void 0}):"Color"===a.type?M.jsx(Z3,{...t,field:a,content:n0.isColorContent(i)?i:void 0}):"GeoPoint"===a.type?M.jsx(eiZ,{...t,field:a,content:n0.isGeoPointContent(i)?i:void 0}):null},[i,n,a,u,r])}function elP(t){let{content:n,id:r,nonRepeatableZone:i,onContentChange:u,readOnly:s}=t,l=(0,o.useMemo)(()=>Object.entries(i),[i]);return M.jsx(M.Fragment,{children:l.map(([t,i])=>{let o=n[t];return M.jsx(elN,{id:`${r}.${t}`,readOnly:s,nestableWidget:i,content:n0.isNestableContent(o)?o:void 0,onContentChange(r){var i,o,s;u((i=n,o=t,s=r,s?{...i,[o]:s}:(0,a.ud)(i,o)))}},t)})})}function elL(t){let{id:n,title:r,content:i,onContentChange:a,readOnly:s,repeatable:l=!0,repeatableZone:c}=t,d=(0,o.useMemo)(()=>Object.entries(c),[c]),p=i??[elF];!l&&p.length>1&&(p=p.slice(0,1));let h=(0,o.useRef)(new Map);function m(t){return h.current.get(t)??"!bugged!"}function g(t){let{index:n,offset:r}=t;a((0,f.pB)(p,n,n+r))}function y(t){let{index:n}=t;a((0,f.$E)(p,n))}return!function(t,n){let r=new Set(n);n.forEach(n=>{t.has(n)||t.set(n,(0,_.d)())}),(0,o.useLayoutEffect)(()=>{for(let[n]of t)r.has(n)||t.delete(n)})}(h.current,p),0===Object.keys(c).length?null:M.jsx(u.ZA,{title:`Repeatable zone${r?` • ${r}`:""}`,addItemButtonTitle:"Add item in group",items:p,maxItems:l?void 0:1,getItemKey:m,onAddItem:function(){a(p.concat(elD()))},children(t,r){let i=new Map(t.value),o=m(t);return M.jsx(u.MN,{index:r,title:"Item",onMove:g,onDelete:y,children:d.map(([u,l])=>{let c=i.get(u),d=n0.isNestableContent(c)?c:void 0;return M.jsx(elN,{id:`${n}[${o}].${u}`,content:d,nestableWidget:l,onContentChange:n=>(function(t,n,r,i){let o=function(t,n){let[r,i]=n;if(!i){let o=t.value.filter(([t])=>t!==r);return elD(o)}let a=Array.from(new Map(t.value).set(r,i));return elD(a)}(t,[r,i]),u=function(t,n){let[r,i]=n;return i?t.map((t,n)=>n===r?i:t):t.filter((t,n)=>n!==r)}(p,[n,o]);(function(t,n,r){let i=t.get(n);void 0!==i&&t.set(r,i)})(h.current,t,o),a(u)})(t,r,u,n),readOnly:s},u)})})}})}let elF={__TYPE__:"GroupItemContent",value:[]};function elD(t=[]){return{__TYPE__:"GroupItemContent",value:t}}function elW(t){var n,r,i,a;let{config:s,content:l,sliceKey:c,readOnly:d=!1,sharedSlice:f,onContentChange:p,...h}=t,m=(n=f,r=l.variation,(0,o.useMemo)(()=>n.variations.find(t=>t.id===r),[n,r])),g=(0,o.useId)(),y={id:h.id??g,readOnly:d},{selected:v,selectionId:b,selection:x}=function(t){let{sliceKey:n}=t||{},r=(0,o.useContext)(ZX),i=function(t,n){if(n)return`${t}___${n}`}("sliceFieldSet",n),a=n===(null==r?void 0:r.id);return{selectionId:i,selected:a,selection:r}}({sliceKey:c}),_=()=>{c&&x.update("sliceFieldSet",c)};return void 0===m?null:M.jsx(N.Provider,{value:s,children:M.jsxs(u.C3,{id:b,selected:v,onFocus:_,children:[M.jsx(u.ax,{children:(i=f,a=m,[i.name,a.name].join(" • "))}),M.jsxs(u.En,{heightEstimate:400,box:{gap:u.jM},children:[M.jsx(elP,{...y,nonRepeatableZone:m.primary??{},content:l.primary,onContentChange(t){p({...l,primary:t})}}),M.jsx(elL,{...y,repeatableZone:m.items??{},content:l.items,onContentChange(t){p({...l,items:t})}})]})]})})}(0,o.createContext)({editedUID:!1,onEditUID(){}})}}]);
|
|
97
|
+
`)),u.setMeta("paste",!0),t.dispatch(u),!0}}})]}}),esE=esR.extend({name:"preformatted",addAttributes(){return{language:{default:null,parseHTML:t=>{var n;let{languageClassPrefix:r}=this.options,i=[...(null==(n=t.firstElementChild)?void 0:n.classList)||[]].filter(t=>t.startsWith(r)).map(t=>t.replace(r,""))[0];return i||null},renderHTML:t=>t.language?{class:this.options.languageClassPrefix+t.language}:null}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({HTMLAttributes:t}){return["pre",ee5(this.options.HTMLAttributes),["code",t,0]]}}).configure({exitOnTripleEnter:!1}),esj=new eai([qJ.RichTextNodeType.preformatted],esE.name,esE,{fromPrismic:t=>function(n){var r;let i=esc.converter.fromPrismic(t)(esE.name,n,!0);return null==(r=t.nodes[esE.name])?void 0:r.create(esm.fromPrismic(n),i)},toPrismic:t=>esc.converter.toPrismic(t,qJ.RichTextNodeType.preformatted,esm.toPrismic(t))},"",!0);function esA(t){let{editor:n,getPos:r,node:i}=t,[a,u]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{function t(){let{from:t,to:o}=n.state.selection,a=r(),s=r()+i.nodeSize;u(t<=a&&o>=s)}function o(){u(!1)}return n.on("blur",o),n.on("selectionUpdate",t),()=>{n.off("blur",o),n.off("selectionUpdate",t)}},[n,r,i.nodeSize]),{selected:a}}function esN(t){let n=(0,o.useRef)(null),r=(0,o.useRef)(null),{onKeyDown:i,url:a,urlChanged:l,onContentChange:c,debouncedUrl:d,content:f}=function(t,n,r){let{node:i}=t,a=i.attrs.content,u=(0,s.R9)(t.updateAttributes),l=(0,s.$P)({initialState:(null==a?void 0:a.embed_url)??"",startTransition:o.startTransition});function c(t){u({content:t})}let{onKeyDown:d}=function(t,n,r,i){let{editor:a,getPos:u,node:s}=t,[l,c]=(0,o.useState)(!0);return(0,o.useEffect)(()=>{l&&t.editor.isFocused&&eiD(()=>{var t;return null==(t=r.current)?void 0:t.focus()})},[r,l,t.editor.isFocused]),{containerRef:i,inputRef:r,onKeyDown:function(t){let r=u(),i=u()+s.nodeSize;"Enter"===t.code&&(c(!1),a.chain().insertContentAt(i,{type:"paragraph"}).focus(i+1).run()),"Backspace"===t.code&&""===n&&a.chain().deleteRange({from:r,to:i}).focus(i+1).run(),"ArrowUp"===t.code&&(c(!1),a.chain().focus(r-1).run()),"ArrowDown"===t.code&&(c(!1),a.chain().focus(i+1).run())}}}(t,l.value,n,r);return{inputRef:n,containerRef:r,onKeyDown:d,url:l.value,urlChanged:function(t){l.set(t),(0,v.ju)(t)||c(void 0)},onContentChange:c,debouncedUrl:l.debouncedValue,content:t.node.attrs.content}}(t,n,r),{selected:p}=esA(t);return M.jsx(eiN,{className:"custom-embed",children:M.jsxs("div",{contentEditable:"false",suppressContentEditableWarning:!0,children:[M.jsxs(u.xu,{flexGrow:1,alignItems:"center",children:[M.jsx(u.I5,{size:"small",name:"cloud",color:"grey11"}),M.jsx(u.xu,{flexGrow:1,height:40,ref:r,children:M.jsx(Z5,{id:"id",ref:n,value:a,variant:(0,v.ju)(a)?"link":"normal",placeholder:"Paste your link here",onValueChange:l,onKeyDown:i})})]}),(0,v.ju)(a)&&M.jsx(eiW,{selected:p,debouncedUrl:d,onContentChange:c,content:f})]})})}let esP=enK.create({name:"embed",group:"block",atom:!0,content:"block*",marks:"",addAttributes:()=>({content:{default:void 0}}),addCommands(){return{setEmbed:()=>({tr:t,dispatch:n})=>{let r=this.type.create();return n&&t.replaceSelectionWith(r),!0}}},parseHTML:()=>[{tag:"embed"}],renderHTML:()=>["embed"],addNodeView:()=>eiF(esN)}),esL=new class{constructor(t,n,r,i){w(this,"extType","node"),w(this,"nodeType","embed"),this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i}}([qJ.RichTextNodeType.embed],esP.name,esP,{fromPrismic:t=>function(n){var r;return null==(r=t.nodes[esP.name])?void 0:r.create({content:n.data})},toPrismic:t=>void 0===t.attrs.content?{type:"embed",data:{type:"embed",embed_url:"",__TYPE__:"EmbedContent",all:[]}}:{type:"embed",data:{...t.attrs.content}}}),esF=enK.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:n}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ee5(this.options.HTMLAttributes,n),0]},addCommands(){return{setHeading:t=>({commands:n})=>!!this.options.levels.includes(t.level)&&n.setNode(this.name,t),toggleHeading:t=>({commands:n})=>!!this.options.levels.includes(t.level)&&n.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return this.options.levels.reduce((t,n)=>({...t,[`Mod-Alt-${n}`]:()=>this.editor.commands.toggleHeading({level:n})}),{})},addInputRules(){return this.options.levels.map(t=>enV({find:RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),esD="heading";function esW(t){switch(t){case 1:return qJ.RichTextNodeType.heading1;case 2:return qJ.RichTextNodeType.heading2;case 3:return qJ.RichTextNodeType.heading3;case 4:return qJ.RichTextNodeType.heading4;case 5:return qJ.RichTextNodeType.heading5;case 6:return qJ.RichTextNodeType.heading6}}function esU(t){return{fullName:esW(t),level:t}}let esz=[1,2,3,4,5,6];function esB(t,n=esz){let r=RegExp(`^heading([${n.join(",")}]){1}$`),i=t.match(r);if(!i||!i[1])return;let o=parseInt(i[1]);return{fullName:esW(o),level:o}}function esV(t,n){let r=t.level;if(n.includes(r))return{fullName:esW(r),level:r}}let es$=t=>{let n=t[0]??1;return{fromPrismic:r=>function(i){var o;let a=esc.converter.fromPrismic(r)(esD,i),u=esB(i.type,t)||esU(n);return null==(o=r.nodes[esD])?void 0:o.create({level:u.level,...esm.fromPrismic(i)},a)},toPrismic(r){let{fullName:i}=esV(r.attrs,t)||esU(n);return esc.converter.toPrismic(r,i,esm.toPrismic(r))}}},esq={name:esD,build(t){var n,r;let i=t?t.size?Array.from(t.values()).reduce((t,n)=>{let r=esB(n);return r?[...t,r.level]:t},[]).sort((t,n)=>t-n):[]:esz;if(!i)return;let o=i.map(t=>esW(t));return new eaa(o,esF.extend({name:"heading"}).configure({levels:i}),i,es$(i),t=>{let n=esV(t,i);return n&&`Heading ${n.level}`})}};function esK(t){let{node:n}=t,r=n.attrs.content,{selected:i}=esA(t),a={width:null==r?void 0:r.width,height:null==r?void 0:r.height,name:eiY},{onMediaSelected:s,onCropperDialogClose:l,isUpdating:c,updateContent:d,onClear:f}=function(t){let{content:n,thumbnail:r,imageViewProps:{getPos:i,updateAttributes:a,editor:u,node:s}}=t,[l,c]=(0,o.useTransition)();function d(t){c(()=>a({content:t}))}return{onMediaSelected:function(t){let r=ei2(t),o=i()+s.nodeSize;d({__TYPE__:"ImageContent",...n,...r}),u.chain().focus(o+1).run()},onCropperDialogClose:function({croppedImages:t}){if(!n)return;let i=t[r.name];if(!i)return;let o=eoi({content:n,thumbnail:r.name,croppedImage:i});o!==n&&d(o)},isUpdating:l,updateContent:d,onClear:function(){let t=i(),n=i()+s.nodeSize;u.chain().deleteRange({from:t,to:n}).focus(n).run()}}}({content:r,thumbnail:a,imageViewProps:t}),p=(null==r?void 0:r.width)===0&&(null==r?void 0:r.height)===0,h=r&&!p?[`${r.width}x${r.height}px`]:[],m=(null==r?void 0:r.alt)??"",g={thumbnail:a,contentView:r,labels:eiJ(a,r,r)};return M.jsx(eiN,{className:"custom-image",children:M.jsx("div",{contentEditable:"false",suppressContentEditableWarning:!0,children:M.jsx(eof,{content:r,selected:i,fieldLabel:"Feature image",imageLabel:h,initialImages:[g],readOnly:!1,onMediaSelected:s,onCropperDialogClose:l,onClear:f,children:M.jsx(o.Suspense,{fallback:esH,children:null!=r&&r.url?M.jsxs(u.aY,{children:[M.jsx(u.hM,{children:M.jsx(u.xu,{flexDirection:"column",alignItems:"center",position:"relative",height:400,children:M.jsx(u.xu,{justifyContent:"center",flexGrow:1,maxHeight:"100%",maxWidth:"100%",children:M.jsx(u.kg,{src:ei0(r.url),alt:m,sizing:"contain"})})})}),M.jsx(eon,{onValueChange(t){d({...r,alt:t})},altText:m,readOnly:!r,selected:i})]}):M.jsx(eot,{isUpdating:c,readOnly:!1,onMediaSelected:s})})})})})}let esH=M.jsx("div",{style:{height:468}}),esG=enK.create({name:"image",group:"block",atom:!0,addAttributes:()=>({content:{default:void 0}}),addCommands(){return{setImage:()=>t=>{let{dispatch:n,tr:r}=t,i=this.type.create();return n&&r.replaceSelectionWith(i),!0}}},parseHTML:()=>[{tag:"image"}],renderHTML:({HTMLAttributes:t})=>["image",ee5(t)],addNodeView:()=>eiF(esK)}),esZ=new class{constructor(t,n,r,i){w(this,"extType","node"),w(this,"nodeType","image"),this.richTextNodeTypes=t,this.name=n,this.component=r,this.converter=i}}([qJ.RichTextNodeType.image],esG.name,esG,{fromPrismic:t=>function(n){var r;return null==(r=t.nodes[esG.name])?void 0:r.create({content:n.data})},toPrismic(t){if(void 0!==t.attrs.content)return{type:"image",data:{...t.attrs.content}}}}),esY=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,esJ=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,esQ=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,esX=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,es0=enq.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"em"},{tag:"i",getAttrs:t=>"normal"!==t.style.fontStyle&&null},{style:"font-style=italic"}],renderHTML({HTMLAttributes:t}){return["em",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[enB({find:esY,type:this.type}),enB({find:esQ,type:this.type})]},addPasteRules(){return[enG({find:esJ,type:this.type}),enG({find:esX,type:this.type})]}}),es1=es0.extend({name:"em"}),es2=new class{constructor(t,n,r){w(this,"extType",ean.Mark),w(this,"richTextNodeTypes",qJ.RichTextNodeType.em),this.name=t,this.component=n,this.converter=r}}(es1.name,es1,{fromPrismic:t=>function(){var n;return null==(n=t.marks[es1.name])?void 0:n.create()},toPrismic(){}}),es3=es2,es4=enq.create({name:"hyperlink",priority:1e3,keepOnSplit:!1,inclusive:!1,addOptions:()=>({openOnClick:!1,linkOnPaste:!0,autolink:!0,protocols:[],htmlAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null,id:""},validate:void 0}),addAttributes:()=>({href:{default:""},id:{default:""},target:{default:"_blank"},rel:{default:"noopener noreferrer nofollow"},class:{default:null},media:{default:null}}),parseHTML:()=>[{tag:'a[href]:not([href *= "javascript:" i])'}],renderHTML({HTMLAttributes:t}){return["a",ee5(this.options.htmlAttributes,t),0]},addCommands(){return{setWebLink:t=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,t).setMeta("preventAutolink",!0).run(),setDocumentLink:t=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,t).setMeta("preventAutolink",!0).run(),setMediaLink:t=>({chain:n})=>{let r=es6(eoP({media:t.media}).value);return n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMark(this.name,{media:r}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}}}),es5=new class{constructor(t,n,r){w(this,"extType",ean.Mark),w(this,"richTextNodeTypes",qJ.RichTextNodeType.hyperlink),this.name=t,this.component=n,this.converter=r}}(es4.name,es4,{fromPrismic:t=>function(n){var r,i,o,a;let u=n.data;if("DocumentLink"===u.__TYPE__){let s={type:es4.name,id:u.id};return null==(r=t.marks[es4.name])?void 0:r.create(s)}if("ImageLink"===u.__TYPE__){let l={type:es4.name,media:es6(u)};return null==(i=t.marks[es4.name])?void 0:i.create(l)}if("FileLink"===u.__TYPE__){let c={type:es4.name,media:es6(u)};return null==(o=t.marks[es4.name])?void 0:o.create(c)}if("ExternalLink"===u.__TYPE__){let d={type:es4.name,url:u.url,href:u.url,target:u.target};return null==(a=t.marks[es4.name])?void 0:a.create(d)}},toPrismic:t=>t.attrs.media?es9(t.attrs.media):t.attrs.id?{__TYPE__:"DocumentLink",id:t.attrs.id}:{__TYPE__:"ExternalLink",url:t.attrs.href,target:t.attrs.target}});function es6(t){return JSON.stringify(t)}function es9(t){return JSON.parse(t)}let es8=enK.create({name:"listItem",addOptions:()=>({HTMLAttributes:{}}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:t}){return["li",ee5(this.options.HTMLAttributes,t),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)}}}),es7=enq.create({name:"textStyle",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"span",getAttrs:t=>!!t.hasAttribute("style")&&{}}],renderHTML({HTMLAttributes:t}){return["span",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:n})=>{let r=enu(t,this.type);return!!Object.entries(r).some(([,t])=>!!t)||n.unsetMark(this.name)}}}}),ele=/^(\d+)\.\s$/,elt=enK.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:t}){let{start:n,...r}=t;return 1===n?["ol",ee5(this.options.HTMLAttributes,r),0]:["ol",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:n})=>this.options.keepAttributes?n().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(es8.name,this.editor.getAttributes(es7.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=en$({find:ele,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=en$({find:ele,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(es7.name)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[t]}}),eln=elt.extend({name:"orderedList",addAttributes:()=>({start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1}}),renderHTML({HTMLAttributes:t}){let{start:n,...r}=t;return 1===n?["ol",ee5(this.options.HTMLAttributes,r),0]:["ol",ee5(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}}}).configure({itemTypeName:"listItem"}),elr=new eau([qJ.RichTextNodeType.orderedList],eln.name,eln,{fromPrismic:t=>function(n){var r;let i=ea_.converter.fromPrismic(t)(n);if(i)return null==(r=t.nodes[eln.name])?void 0:r.create(esm.fromPrismic(n),i)},toPrismic:t=>eac.children.map(t,t=>ea_.converter.toPrismic(t,qJ.RichTextNodeType.orderedList).filter(c.$)).flat()}),eli=elr,elo=[eap,es3,es5];function ela(t){return[esv,esC,eli,esq.build(t),esj,esL,esZ,...elo].filter(c.$)}let elu=[{nodeType:qJ.RichTextNodeType.paragraph,icon:"textFields",isActive:t=>t.isActive(esv.name)&&!t.isActive(esC.name)&&!t.isActive(eli.name),runCommands:elc((t,n)=>t.clearNodes().setDirection(eld(n))),shortText:"par",text:"Paragraph"},{nodeType:qJ.RichTextNodeType.heading1,icon:"looks1",isActive:t=>t.isActive(esq.name,{level:1}),runCommands:elc((t,n)=>t.setHeading({level:1}).setDirection(eld(n))),shortText:"h1",text:"Heading 1"},{nodeType:qJ.RichTextNodeType.heading2,icon:"looks2",isActive:t=>t.isActive(esq.name,{level:2}),runCommands:elc((t,n)=>t.setHeading({level:2}).setDirection(eld(n))),shortText:"h2",text:"Heading 2"},{nodeType:qJ.RichTextNodeType.heading3,icon:"looks3",isActive:t=>t.isActive(esq.name,{level:3}),runCommands:elc((t,n)=>t.setHeading({level:3}).setDirection(eld(n))),shortText:"h3",text:"Heading 3"},{nodeType:qJ.RichTextNodeType.heading4,icon:"looks4",isActive:t=>t.isActive(esq.name,{level:4}),runCommands:elc((t,n)=>t.setHeading({level:4}).setDirection(eld(n))),shortText:"h4",text:"Heading 4"},{nodeType:qJ.RichTextNodeType.heading5,icon:"looks5",isActive:t=>t.isActive(esq.name,{level:5}),runCommands:elc((t,n)=>t.setHeading({level:5}).setDirection(eld(n))),shortText:"h5",text:"Heading 5"},{nodeType:qJ.RichTextNodeType.heading6,icon:"looks6",isActive:t=>t.isActive(esq.name,{level:6}),runCommands:elc((t,n)=>t.setHeading({level:6}).setDirection(eld(n))),shortText:"h6",text:"Heading 6"},{nodeType:qJ.RichTextNodeType.list,icon:"formatListBulleted",isActive:t=>t.isActive(esC.name),runCommands:elc((t,n)=>t.toggleBulletList().setDirection(eld(n))),shortText:"bull",text:"Bulleted list"},{nodeType:qJ.RichTextNodeType.orderedList,icon:"formatListNumbered",isActive:t=>t.isActive(eli.name),runCommands:elc((t,n)=>t.toggleOrderedList().setDirection(eld(n))),shortText:"num",text:"Numbered list"},{nodeType:qJ.RichTextNodeType.preformatted,icon:"dataObject",isActive:t=>t.isActive(esj.name),runCommands:elc((t,n)=>t.setCodeBlock().setDirection(eld(n))),shortText:"code",text:"Code"},{nodeType:qJ.RichTextNodeType.embed,icon:"cloud",isActive:t=>t.isActive(esL.name),runCommands:elc(t=>t.setEmbed()),shortText:"emb",text:"Embed"},{nodeType:qJ.RichTextNodeType.image,icon:"image",isActive:t=>t.isActive(esZ.name),runCommands:elc(t=>t.setImage()),shortText:"img",text:"Image"}],els=[{nodeType:qJ.RichTextNodeType.strong,icon:"formatBold",isActive:t=>t.isActive(eap.name),runCommands:elc(t=>t.toggleBold())},{nodeType:qJ.RichTextNodeType.em,icon:"formatItalic",isActive:t=>t.isActive(es3.name),runCommands:elc(t=>t.toggleItalic())}],ell=[{nodeType:qJ.RichTextNodeType.rtl,icon:"formatTextDirectionRToL",isActive:t=>t.isActive({dir:esf.RightToLeft}),runCommands:elc((t,n)=>t.toggleDirection(eld(n)))}];function elc(t){return(n,r={})=>{let i=!0===r.can?n.can().chain():n.chain().focus();return void 0!==r.deleteRange&&(i=i.deleteRange(r.deleteRange)),r.can?function(t,n,r){try{return r(n,t).run()}catch{return!1}}(n,i,t):t(i,n).run()}}function eld(t){let n=t.state.selection.$from.parent.attrs;return esm.parseNodeAttrsDirection(n)}function elf(t,n){return t.filter(t=>n.includes(t.nodeType))}function elp(t){let{items:n,editor:r}=t;return 0===n.length?null:M.jsxs(M.Fragment,{children:[M.jsx(u.Jf,{}),n.map(t=>M.jsx(u.r8,{disabled:!t.runCommands(r,{can:!0}),onPressedChange(){t.runCommands(r)},pressed:t.isActive(r),startIcon:t.icon},t.nodeType))]})}function elh(t){let{disabled:n,showWebLinkModal:r,showDocumentsLinkModal:i,showMediaLinkModal:o}=function(t){let{editor:n,setModal:r}=t;return{disabled:!elc(t=>t.setWebLink({href:""}))(n,{can:!0}),showWebLinkModal:function(){r("webLink")},showDocumentsLinkModal:function(){r("documentLink")},showMediaLinkModal:function(){r("mediaLink")}}}(t);return M.jsxs(M.Fragment,{children:[M.jsx(u.Jf,{}),M.jsxs(u.yM,{density:"compact",children:[M.jsx(u.hA,{disabled:n,startIcon:"link",onClick:r},qJ.RichTextNodeType.hyperlink),M.jsxs(u.h_,{children:[M.jsx(u.$F,{children:M.jsx(u.hA,{startIcon:"arrowDropDown"})}),M.jsxs(u.AW,{align:"end",asPortal:!1,children:[M.jsx(u.Xi,{startIcon:M.jsx(u.I5,{name:"public"}),onSelect:r,children:"Link to web page"}),M.jsx(u.Xi,{startIcon:M.jsx(u.I5,{name:"description"}),onSelect:i,children:"Link to document"}),M.jsx(u.Xi,{startIcon:M.jsx(u.I5,{name:"image"}),onSelect:o,children:"Link to media"})]})]})]})]})}function elm(t){let{docId:n,onEdit:r,onUnlink:i}=t,o=function(t){let n=P();n.searchDocuments||F("searchDocuments");let{coreApiUrl:r,env:i}=n;return(0,d.QT)(h.EK,[r,i,t])}(n),a=P();if(!o)return null;let s=o.versions[0],l=(0,b.u)({status:null==s?void 0:s.status,releaseId:(null==s?void 0:s.status)==="release"?s.release_id:void 0,documentId:o.id,versionId:null==s?void 0:s.version_id,env:a.env}),c=(null==s?void 0:s.preview_summary)??"",f=(null==s?void 0:s.custom_type_label)??"";return M.jsx(u.oZ,{url:l,title:o.title,subTitle:f,description:c,onEdit:r,onUnlink:i,largeIconName:"description"})}function elg(t){let{editor:n}=t,{searchDocuments:r}=P(),i=n.getAttributes(qJ.RichTextNodeType.hyperlink);if(i.id&&r){let o=i.id;return M.jsx(ely,{docId:o,...t})}if(i.href){let a=i.href;return M.jsx(elv,{url:a,...t})}if(i.media){let u=es9(i.media);return M.jsx(elb,{media:u,...t})}return null}function ely(t){let{editor:n,onEditDocumentLink:r,docId:i}=t;return M.jsx(u.SV,{renderError:()=>M.jsx(u.oZ,{url:"",title:"Failed to Load Linked Document Data",subTitle:"",error:!0,onEdit:r,onUnlink:()=>elx(n)}),children:M.jsx(o.Suspense,{fallback:M.jsx(u.oZ,{url:"",title:"",subTitle:"",loading:!0,onEdit:r,onUnlink:()=>elx(n)}),children:M.jsx(elm,{docId:i,onEdit:r,onUnlink:()=>elx(n)})})})}function elv(t){let{url:n,editor:r,onEditWebLink:i}=t,o=(0,v.ju)(n);return o?M.jsx(u.oZ,{url:n,title:(0,v.S$)(o),subTitle:n,onEdit:i,onUnlink:()=>elx(r)}):M.jsx(u.oZ,{url:n,title:"",subTitle:n,onEdit:i,onUnlink:()=>elx(r)})}function elb(t){let{media:n,editor:r,onEditMediaLink:i}=t;return"ImageLink"===n.__TYPE__?M.jsx(u.Qi,{url:n.url,title:n.name,subTitle:`${n.width} x ${n.height} pixels`,onEdit:i,onUnlink:()=>elx(r)}):"FileLink"===n.__TYPE__?M.jsx(u.oZ,{url:n.url,title:n.name,subTitle:function(t){let{filename:n}=t,r=n.split(".").pop();return r?r.toLowerCase():""}({filename:n.name}),onEdit:i,onUnlink:()=>elx(r),largeIconName:"insertDriveFile"}):null}function elx(t){elc(t=>t.unsetLink())(t)}function el_(t){let{open:n}=t,{onOpenChange:r,onSelectDocument:i}=function(t){let{editor:n,setOpen:r}=t;function i(t){r(t)}return{onSelectDocument:function(t){elc(n=>n.extendMarkRange(qJ.RichTextNodeType.hyperlink).setDocumentLink({id:t}))(n),r(!1)},onOpenChange:i}}(t);return M.jsx(eoO,{open:n,onOpenChange:r,onSelectDocument:i})}function elS(t){let{open:n}=t,{onOpenChange:r,onMediaSelected:i}=function(t){let{editor:n,setOpen:r}=t;return{onMediaSelected:function(t){elc(n=>n.extendMarkRange(qJ.RichTextNodeType.hyperlink).setMediaLink({media:t}))(n),r(!1)},onOpenChange:r}}(t);return M.jsx(eoe,{open:n,onOpenChange:r,onMediaSelected:i,assetType:"all"})}function elT(t){let{open:n}=t,{url:r,setUrl:i,onOpenChange:a,onKeyDown:s,openInNewTab:l,setOpenInNewTab:c,onSetUrl:d,selectionUrl:f,selectionUrlTitle:p}=function(t){var n;let{editor:r,setOpen:i}=t,[a,u]=(0,o.useState)(""),[s,l]=(0,o.useState)(!1),c=function(t){let n=t.getAttributes(qJ.RichTextNodeType.hyperlink);return n.href?n.href:void 0}(r),d=(n=r,"_blank"===n.getAttributes(qJ.RichTextNodeType.hyperlink).target);(0,o.useEffect)(()=>{u(c??"")},[c]),(0,o.useEffect)(()=>{l(d??!1)},[d]);let f=c?(0,v.ju)(c):void 0,p=f?(0,v.S$)(f):"";function h(t){let n=s?"_blank":"_self";elc(r=>r.extendMarkRange(qJ.RichTextNodeType.hyperlink).setWebLink({href:t,target:n}))(r),i(!1)}return{url:a,setUrl:u,onSetUrl:h,selectionUrl:c,selectionUrlTitle:p,openInNewTab:s,selectionOpenInNewTab:d,setOpenInNewTab:l,onKeyDown:function(t){"Enter"===t.key&&h(a)},onOpenChange:function(t){u(""),l(!1),i(t)}}}(t);return M.jsx(u.Vq,{open:n,onOpenChange:a,hasClose:!1,size:"small",children:M.jsx(u.cZ,{children:M.jsxs(u.xu,{flexDirection:"column",children:[M.jsxs(u.xu,{flexDirection:"column",height:"100%",padding:16,gap:4,children:[M.jsx(u.yt,{value:r,onValueChange:i,placeholder:"Paste URL",icon:"public",onKeyDown:s}),f&&M.jsxs(u.xu,{flexDirection:"column",padding:{top:8},gap:4,children:[M.jsx(u.xv,{variant:"smallBold",color:"grey11",children:"Linked to"}),M.jsxs(u.xu,{backgroundColor:"grey4",borderRadius:6,padding:8,alignItems:"center",gap:8,children:[M.jsx(u.pI,{largeIconName:"public",smallIconName:"link"}),M.jsxs(u.xu,{flexDirection:"column",children:[M.jsx(u.xv,{variant:"bold",color:"grey12",children:p}),M.jsx(u.xv,{color:"grey11",variant:"small",children:"Web page"})]})]})]})]}),r&&M.jsxs(u.xu,{flexDirection:"column",padding:{block:8},border:{top:!0},children:[M.jsx(u.UN,{onSelect:()=>c(!l),icon:l?"checkBox":"checkBoxOutlinedBlank",textContent:"Open in new tab"}),M.jsx(u.UN,{onSelect:()=>d(r),icon:"link",textContent:"Link to URL"})]})]})})})}function elw(t){let{items:n,editor:r}=t;return 0===n.length?null:M.jsxs(M.Fragment,{children:[M.jsx(u.Jf,{}),M.jsx(u.dV,{onValueChange(t){n.forEach(n=>{(n.isActive(r)&&!t.includes(n.nodeType)||!n.isActive(r)&&t.includes(n.nodeType))&&n.runCommands(r)})},type:"multiple",value:n.filter(t=>t.isActive(r)).map(t=>t.nodeType),children:n.map(t=>M.jsx(u.nG,{disabled:!t.runCommands(r,{can:!0}),startIcon:t.icon,value:t.nodeType},t.nodeType))},"mark")]})}function elO(t){var n;let{items:r,editor:i}=t;return 0===r.length?null:M.jsx(u.vT,{disabled:1===r.length,value:(null==(n=r.find(t=>t.isActive(i)))?void 0:n.nodeType)??"",onValueChange(t){var n;null==(n=r.find(n=>n.nodeType===t))||n.runCommands(i)},children:r.map(t=>M.jsx(u.KG,{value:t.nodeType,children:t.text},t.nodeType))})}let elk={duration:100,hideOnClick:!0,offset:[-48,8],placement:"top-start",zIndex:30};function elC(t){let{editor:n,nodeTypes:r}=t,[i,a]=(0,o.useState)(),u=r.includes(qJ.RichTextNodeType.hyperlink),s=!i,{shouldShowBubbleMenu:l,shouldShowLinkPopover:c}=function(t){let{editor:n}=t;return{shouldShowBubbleMenu:function(t){let{view:r,state:i,from:o,to:a}=t;if(!r.hasFocus())return!1;let{doc:u,selection:s}=i;return!(n.isActive(qJ.RichTextNodeType.preformatted)||s.empty||0===u.textBetween(o,a).length)},shouldShowLinkPopover:function(t){let{view:n,state:r,from:i,to:o}=t,a=n.state.doc.nodeAt(i),{doc:u,selection:s}=r;return!!s.empty&&!(u.textBetween(i,o).length>0)&&!!(null!=a&&a.marks.some(t=>"hyperlink"===t.type.name))}}}({editor:n});return M.jsxs(M.Fragment,{children:[M.jsx(eiC,{editor:n,tippyOptions:elk,shouldShow:l,children:s&&M.jsx(elI,{...t,setModal:a})}),M.jsx(eiC,{editor:n,tippyOptions:elk,shouldShow:c,children:s&&M.jsx(elg,{editor:n,onEditWebLink:()=>a("webLink"),onEditDocumentLink:()=>a("documentLink"),onEditMediaLink:()=>a("mediaLink")})}),u&&M.jsxs(M.Fragment,{children:[M.jsx(elT,{open:"webLink"===i,setOpen:function(t){a(t?"webLink":void 0)},editor:n}),M.jsx(el_,{open:"documentLink"===i,setOpen:function(t){a(t?"documentLink":void 0)},editor:n}),M.jsx(elS,{open:"mediaLink"===i,setOpen:function(t){a(t?"mediaLink":void 0)},editor:n})]})]})}function elI(t){let{editor:n,nodeTypes:r}=t,i=r.includes("hyperlink"),o=elf(elu,r),a=elf(els,r),s=elf(ell,r),l=o.length+a.length+s.length+Number(i);return 0===l?null:M.jsxs(u.o8,{children:[M.jsx(elO,{items:o,editor:n}),M.jsx(elw,{items:a,editor:n}),i&&M.jsx(elh,{...t}),M.jsx(elp,{items:s,editor:n}),l>1&&M.jsxs(M.Fragment,{children:[M.jsx(u.Jf,{}),M.jsx(u.hA,{onClick(){n.chain().focus().clearNodes().unsetAllMarks().run()},startIcon:"formatClear"},"clear")]})]})}function elM(t){var n;let{content:r,field:i,id:a,readOnly:l}=t,d=function(t){var n,r;let i=`${(null==(n=t.config)?void 0:n.multi)??""}-${(null==(r=t.config)?void 0:r.single)??""}`;return(0,o.useMemo)(()=>{let{extensions:n,defaultTextConverter:r}=function(t){var n;if(!t||!(null!=t&&t.single)&&!(null!=t&&t.multi))return ead();let r=function(t){let n=(t.single||t.multi||"").split(/\s*,\s*/).map(t=>{let n=qJ.RichTextNodeTypeCodec.decode(t);return"Right"===n._tag?n.right:void 0}).filter(c.$);return new Set(n)}(t);if(!(null!=r&&r.size))return ead();let i=(n=r,ela(n).filter(t=>(0,g.G)(n,n=>t.richTextNodeTypes.includes(n)))),o=function(t){let n=new Set(t);return(0,g.G)(n,eas)&&n.add(esv),(0,g.G)(n,eao)||n.add(esv),[...n]}(i);return{extensions:o,defaultTextConverter:function(t){let n=t.find(eao)??esv;return function(t){return r=>n.converter.fromPrismic(t)({...r,type:n.richTextNodeTypes[0]??"heading1"})}}(o)}}(t.config),i=n.filter(elR),o=n.flatMap(t=>t.richTextNodeTypes),a=n.map(t=>t.component),u=n.filter(elE).map(t=>t.name),s=[...a,...function(t,n){var r,i,o;let a=n.map(t=>t.richTextNodeTypes).flat(),u={placeholderByNodeType:(o=n,o.reduce((t,n)=>(n.nodeType===ear.Text&&(t[n.name]=n.placeholder),t),{})),unfocusedPlaceholder:null==(r=t.config)?void 0:r.placeholder,nodeExtensions:n},s=a.includes(qJ.RichTextNodeType.orderedList)||a.includes(qJ.RichTextNodeType.list);return[eaO.component((null==(i=t.config)?void 0:i.single)===void 0),esc.component,eaR.component,eaj(u),s?ea_.component:void 0,esS.configure({nodeTypes:a})].filter(c.$)}(t,i),esh.configure({supportedExtensionNames:u}),eo4],l=s.map(t=>t.name),d=function(t,n){let r=etd.resolve(t);return ett(r,void 0)}(s);return{allComponents:s,extensionNames:l,defaultTextConverter:r,nodeExtensions:i,names:o,schema:d}},[i])}(i),f=r&&eaO.converter(d.nodeExtensions).fromPrismic(d.schema,null==(n=d.defaultTextConverter)?void 0:n.call(d,d.schema))(r),p=(0,s.R9)(t.onContentChange),h=function(t={},n=[]){let{onUpdate:r}=t,[i,a]=(0,o.useState)(),u=(0,o.useRef)(r),l=(0,s.NW)();return(0,o.useEffect)(()=>{i&&r&&(i.off("update",u.current),i.on("update",r),u.current=r)},[r,i]),(0,o.useLayoutEffect)(()=>{let n=!0,r=new eiI(t);return a(r),r.on("transaction",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{n&&l()})})}),()=>{n=!1}},n),(0,o.useEffect)(()=>()=>{null==i||i.destroy()},[i]),i}({content:null==f?void 0:f.toJSON(),editable:!l,editorProps:{attributes:{class:u.rk,id:a,tabIndex:"0"}},extensions:d.allComponents,injectCSS:!1,onUpdate({editor:t}){if(t.isEmpty)return p(void 0);let n=eaO.converter(d.nodeExtensions).toPrismic(t.state.doc);p(n)}},[d,l]);return M.jsxs(u.gN,{children:[M.jsx(u.Qy,{htmlFor:a,children:Z0(i)}),M.jsxs(u.JO,{children:[M.jsx(eiE,{editor:h??null,style:{flex:1}}),(null==h?void 0:h.isEditable)&&M.jsx(elC,{editor:h,nodeTypes:d.names.concat(esp)})]})]})}function elR(t){return t.extType===ean.Node}function elE(t){return!(t.extType!==ean.Node||t.nodeType!==ear.Text||t.lockedFormat)}function elj(t){var n,r,i,o,a;let{content:s,field:l,id:c,onContentChange:d,readOnly:f}=t,p=Z1(l),h=(i=l,(null==(o=i.config)?void 0:o.default_value)===void 0||null==(a=i.config.options)?void 0:a[0]),m=(null==s?void 0:s.value)??h;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"arrowDropDownCircle"}),M.jsx(u.Qy,{htmlFor:c,children:Z0(l)}),M.jsx(u.JO,{children:M.jsx(u.Ph,{id:c,size:"large",color:"grey",value:m,renderTrigger:()=>M.jsx(u.JF,{id:c,placeholder:p}),onValueChange(t){var n;f||d((n=t,0===n.length?void 0:{__TYPE__:"FieldContent",type:"Select",value:n}))},children:null==(r=null==(n=l.config)?void 0:n.options)?void 0:r.map(t=>M.jsx(u.Ql,{value:t,children:t},t))})})]})}function elA(t){let{id:n,readOnly:r,field:i,content:o,onContentChange:a}=t,s=null!=o&&o.value?(0,l._O)(o.value):void 0;return M.jsxs(u.gN,{children:[M.jsx(u.fw,{name:"event"}),M.jsx(u.Qy,{id:n,children:Z0(i)}),M.jsx(u.JO,{children:M.jsx(u.xu,{padding:{left:4,right:12},width:"100%",flexDirection:"column",justifyContent:"center",children:M.jsx(u.Wr,{mode:"date-time","aria-labelledby":n,disabled:r,value:s,onValueChange:t=>a(function(t){if(t)return{__TYPE__:"FieldContent",type:"Timestamp",value:function(t){let n=`${t.getUTCFullYear()}`.padStart(4,"0"),r=`${t.getUTCMonth()+1}`.padStart(2,"0"),i=`${t.getUTCDate()}`.padStart(2,"0"),o=`${t.getUTCHours()}`.padStart(2,"0"),a=`${t.getUTCMinutes()}`.padStart(2,"0");return`${n}-${r}-${i}T${o}:${a}:00+00:00`}(t)}}(t))})})})]})}function elN(t){let{id:n,readOnly:r,content:i,nestableWidget:a}=t,u=(0,s.R9)(t.onContentChange);return(0,o.useMemo)(()=>{let t={id:n,readOnly:r,onContentChange:u};return"Boolean"===a.type?M.jsx(Z2,{...t,field:a,content:n0.isBooleanContent(i)?i:void 0}):"Date"===a.type?M.jsx(Z4,{...t,field:a,content:n0.isDateContent(i)?i:void 0}):"Timestamp"===a.type?M.jsx(elA,{...t,field:a,content:n0.isTimestampContent(i)?i:void 0}):"Image"===a.type?M.jsx(eop,{...t,field:a,content:n0.isImageContent(i)?i:void 0}):"Link"===a.type?M.jsx(eoL,{...t,field:a,content:n0.isLinkContent(i)?i:void 0}):"Number"===a.type?M.jsx(eoU,{...t,field:a,content:n0.isNumberContent(i)?i:void 0}):"StructuredText"===a.type?M.jsx(elM,{...t,field:a,content:n0.isRichTextContent(i)?i:void 0}):"Select"===a.type?M.jsx(elj,{...t,field:a,content:n0.isSelectContent(i)?i:void 0}):"Text"===a.type?M.jsx(eom,{...t,field:a,content:n0.isTextContent(i)?i:void 0}):"Embed"===a.type?M.jsx(ei$,{...t,field:a,content:n0.isEmbedContent(i)?i:void 0}):"Color"===a.type?M.jsx(Z3,{...t,field:a,content:n0.isColorContent(i)?i:void 0}):"GeoPoint"===a.type?M.jsx(eiZ,{...t,field:a,content:n0.isGeoPointContent(i)?i:void 0}):null},[i,n,a,u,r])}function elP(t){let{content:n,id:r,nonRepeatableZone:i,onContentChange:u,readOnly:s}=t,l=(0,o.useMemo)(()=>Object.entries(i),[i]);return M.jsx(M.Fragment,{children:l.map(([t,i])=>{let o=n[t];return M.jsx(elN,{id:`${r}.${t}`,readOnly:s,nestableWidget:i,content:n0.isNestableContent(o)?o:void 0,onContentChange(r){var i,o,s;u((i=n,o=t,s=r,s?{...i,[o]:s}:(0,a.ud)(i,o)))}},t)})})}function elL(t){let{id:n,title:r,content:i,onContentChange:a,readOnly:s,repeatable:l=!0,repeatableZone:c}=t,d=(0,o.useMemo)(()=>Object.entries(c),[c]),p=i??[elF];!l&&p.length>1&&(p=p.slice(0,1));let h=(0,o.useRef)(new Map);function m(t){return h.current.get(t)??"!bugged!"}function g(t){let{index:n,offset:r}=t;a((0,f.pB)(p,n,n+r))}function y(t){let{index:n}=t;a((0,f.$E)(p,n))}return!function(t,n){let r=new Set(n);n.forEach(n=>{t.has(n)||t.set(n,(0,_.d)())}),(0,o.useLayoutEffect)(()=>{for(let[n]of t)r.has(n)||t.delete(n)})}(h.current,p),0===Object.keys(c).length?null:M.jsx(u.ZA,{title:`Repeatable zone${r?` • ${r}`:""}`,addItemButtonTitle:"Add item in group",items:p,maxItems:l?void 0:1,getItemKey:m,onAddItem:function(){a(p.concat(elD()))},children(t,r){let i=new Map(t.value),o=m(t);return M.jsx(u.MN,{index:r,title:"Item",onMove:g,onDelete:y,children:d.map(([u,l])=>{let c=i.get(u),d=n0.isNestableContent(c)?c:void 0;return M.jsx(elN,{id:`${n}[${o}].${u}`,content:d,nestableWidget:l,onContentChange:n=>(function(t,n,r,i){let o=function(t,n){let[r,i]=n;if(!i){let o=t.value.filter(([t])=>t!==r);return elD(o)}let a=Array.from(new Map(t.value).set(r,i));return elD(a)}(t,[r,i]),u=function(t,n){let[r,i]=n;return i?t.map((t,n)=>n===r?i:t):t.filter((t,n)=>n!==r)}(p,[n,o]);(function(t,n,r){let i=t.get(n);void 0!==i&&t.set(r,i)})(h.current,t,o),a(u)})(t,r,u,n),readOnly:s},u)})})}})}let elF={__TYPE__:"GroupItemContent",value:[]};function elD(t=[]){return{__TYPE__:"GroupItemContent",value:t}}function elW(t){var n,r,i,a;let{config:s,content:l,sliceKey:c,readOnly:d=!1,sharedSlice:f,onContentChange:p,...h}=t,m=(n=f,r=l.variation,(0,o.useMemo)(()=>n.variations.find(t=>t.id===r),[n,r])),g=(0,o.useId)(),y={id:h.id??g,readOnly:d},{selected:v,selectionId:b,selection:x}=function(t){let{sliceKey:n}=t||{},r=(0,o.useContext)(ZX),i=function(t,n){if(n)return`${t}___${n}`}("sliceFieldSet",n),a=n===(null==r?void 0:r.id);return{selectionId:i,selected:a,selection:r}}({sliceKey:c});return void 0===m?null:M.jsx(N.Provider,{value:s,children:M.jsxs(u.C3,{id:b,selected:v,onFocus:function(){c&&x.update("sliceFieldSet",c)},children:[M.jsx(u.ax,{children:(i=f,a=m,[i.name,a.name].join(" • "))}),M.jsxs(u.En,{heightEstimate:400,box:{gap:u.jM},children:[M.jsx(elP,{...y,nonRepeatableZone:m.primary??{},content:l.primary,onContentChange(t){p({...l,primary:t})}}),M.jsx(elL,{...y,repeatableZone:m.items??{},content:l.items,onContentChange(t){p({...l,items:t})}})]})]})})}(0,o.createContext)({editedUID:!1,onEditUID(){}})}}]);
|